Montgomery multiplication acceleration method and device for elliptic curve and computer equipment

By performing bit width segmentation and displacement calculation on the modulus of the elliptic curve, the problem of long multiplication operation time in traditional Montgomery multiplication is solved, and accelerated operations are realized and efficiency is improved.

CN119668554APending Publication Date: 2025-03-21FANSHENG MICROELECTRONICS (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411821765.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

When traditional Montgomery multiplication occurs multiple operations by different parts of the modulus in a loop, the multiplication operation time is long and affects the operation efficiency.

Method used

By obtaining the modulus of the elliptic curve and dividing it according to the preset operation bit width to obtain the modulus to be multiplied, and then shifting the modulus to be multiplied according to the preset operation bit width to simplify the modulus multiplication.

Benefits of technology

By replacing multiplication by displacement operation, modulus multiplication is simplified, the operation speed is significantly accelerated, and the overhead of area and delay is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119668554A_ABST
    Figure CN119668554A_ABST
Patent Text Reader

Abstract

The invention relates to a Montgomery multiplication acceleration method and device of an elliptic curve and computer equipment. The method comprises the following steps: acquiring the modulus of an elliptic curve; segmenting the modulus of the elliptic curve according to a preset operation bit width to obtain a modulus to be modulically multiplied; and performing displacement operation on the modulus to be subjected to modular multiplication according to the preset operation bit width to obtain a modular multiplication result of the elliptic curve. According to the method, multiplication operation can be replaced by displacement operation, analog-to-digital multiplication is simplified, the operation speed can be increased, and the area and delay overhead are greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of modular multiplication algorithms of elliptic curves, and in particular to a Montgomery multiplication acceleration method, device and computer equipment for elliptic curves. Background Art

[0002] Modular multiplication is the core computing unit of public key algorithms such as RSA (Rivest-Shamir-Adleman, invented by Ronald Rivest, Adi Shamir, and Leonard Adleman and named after the inventors' initials) and elliptic curve algorithms. Montgomery multiplication is a commonly used modular multiplication acceleration method.

[0003] When the traditional Montgomery multiplication operation of multiplying partial bits with different moduli appears multiple times in a loop, a multiplication operation is performed, which takes a long time to calculate. Summary of the invention

[0004] Based on this, it is necessary to provide a Montgomery multiplication acceleration method, device and computer equipment for elliptic curves that can accelerate calculations in order to solve the above technical problems.

[0005] In a first aspect, the present application provides a Montgomery multiplication acceleration method for an elliptic curve, and the modular multiplication acceleration method for an elliptic curve includes:

[0006] Get the modulus of the elliptic curve;

[0007] Dividing the modulus of the elliptic curve according to a preset operation bit width to obtain a modulus to be multiplied;

[0008] A shift operation is performed on the modulus to be modularly multiplied according to the preset operation bit width to obtain a modular multiplication result of the elliptic curve.

[0009] In one embodiment, dividing the modulus of the elliptic curve according to a preset operation bit width to obtain the modulus to be multiplied includes:

[0010] The modulus of the elliptic curve is divided from high bits to low bits into a plurality of groups of moduli to be multiplied, the number of which is the same as the number of bits of the preset operation bit width.

[0011] In one embodiment, the elliptic curve comprises an SM2 elliptic curve.

[0012] In one embodiment, the modulus of the SM2 elliptic curve is obtained as: 0xfffffffe_ffffffff_ffffffff_ffffffff_ffffffff_00000000_ffffffff_ffffffff; the number of bits of the preset operation bit width includes 32 bits; and the modulus of the elliptic curve is divided according to the preset operation bit width to obtain the modulus to be multiplied, including:

[0013] Split the modulus of the SM2 elliptic curve into {p7, p6, p5, p4, p3, p2, p1, p0};

[0014] Among them, the p7=0xfffffffe; the p6=0xffffffff; the p5=0xffffffff; the p4=0xffffffff; the p3=0xffffffff; the p2=0x00000000; the p1=0xffffffff; and the p0=0xffffffff.

[0015] In one embodiment, performing a shift operation on the modulus to be multiplied according to the preset operation bit width includes:

[0016] When the number x is multiplied by the p7, the bit shift operation performed on the p7 according to the preset operation bit width is: (x<<32)-(x<<1);

[0017] When the number x is multiplied by p6~p3, p1~p0, the shift operation performed on p6~p3, p1~p0 according to the preset operation bit width is: (x<<32)–x;

[0018] When the number x is multiplied by the p2, the bit shift operation performed on the p2 according to the preset operation bit width is: 0.

[0019] In one embodiment, the modulus of the SM2 elliptic curve is obtained as: 0xfffffffe_ffffffff_ffffffff_ffffffff_ffffffff_00000000_ffffffff_ffffffff; the number of bits of the preset operation bit width includes 64 bits; and the modulus of the elliptic curve is divided according to the preset operation bit width to obtain the modulus to be multiplied, including:

[0020] Splitting the modulus of the SM2 elliptic curve into {p3', p2', p1', p0'};

[0021] Among them, the p3'=0xfffffffe_ffffffff; the p2'=0xffffffff_ffffffff; the p1'=0xffffffff_00000000; the p0'=0xffffffff_ffffffff.

[0022] In one embodiment, performing a shift operation on the modulus to be multiplied according to the preset operation bit width includes:

[0023] When the number x is multiplied by the p3', the bit shift operation performed on the p3' according to the preset operation bit width is: (x<<64)-(x<<32)-x;

[0024] When the number x is multiplied by the p2' and p0', the bit shift operation performed on the p2' and p0' according to the preset operation bit width is: (x<<64)-x;

[0025] When the number x is multiplied by the p1', the bit shift operation performed on the p1' according to the preset operation bit width is: (x<<64)-(x<<32).

[0026] In a second aspect, the present application further provides an elliptic curve Montgomery multiplication acceleration device, the device comprising:

[0027] The modulus acquisition module is used to obtain the modulus of the elliptic curve;

[0028] A segmentation module, used for segmenting the modulus of the elliptic curve according to a preset operation bit width to obtain a modulus to be multiplied;

[0029] The operation module is used to perform a shift operation on the modulus to be multiplied according to the preset operation bit width to obtain the modular multiplication result of the elliptic curve.

[0030] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0031] In a fourth aspect, the present application also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.

[0032] The Montgomery multiplication acceleration method, device, computer equipment and computer-readable storage medium of the above elliptic curve include: obtaining the modulus of the elliptic curve; dividing the modulus of the elliptic curve according to a preset operation bit width to obtain the modulus to be multiplied; performing a shift operation on the modulus to be multiplied according to the preset operation bit width to obtain the modular multiplication result of the elliptic curve. The present application can replace the multiplication operation with a shift operation, simplify the modular multiplication, speed up the operation speed, and greatly reduce the area and delay overhead. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1 A schematic diagram of a flow chart of a Montgomery multiplication acceleration method for elliptic curves in one embodiment;

[0035] Figure 2 A block diagram of a Montgomery multiplication acceleration device for elliptic curves in one embodiment;

[0036] Figure 3 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0038] In one embodiment, a method for accelerating Montgomery multiplication of elliptic curves is provided. Figure 1 , attached Figure 1 The flowchart of the Montgomery multiplication acceleration method for elliptic curves in this embodiment is shown. This embodiment uses the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps S101 to S103.

[0039] Step S101, obtaining the modulus of the elliptic curve.

[0040] The modulus of the elliptic curve is generally a prime number specially selected by cryptographers. The elliptic curve can be any mainstream curve, such as the 192-521-bit prime field curve mentioned in the ECDSA (Elliptic Curve Digital Signature Algorithm) standard appendix by NIST (National Institute of Standards and Technology).

[0041] The modulus of the elliptic curve can be obtained by directly calling professional computing tools that support elliptic curve operations, such as SageMath, directly calculating the size of the elliptic curve equation and the finite field, etc. In practical applications, the specific implementation method can be flexibly selected, not limited to the above examples.

[0042] Step S102 : dividing the modulus of the elliptic curve according to a preset operation bit width to obtain a modulus to be multiplied.

[0043] The number of operands refers to the bit width of the operands involved in the operation. It can also be understood as the bit width of the operation machine. The number of operands can be flexibly set according to actual conditions. For example, it can be 32 bits, 64 bits, etc.

[0044] The number of moduli to be multiplied can be determined according to the data length of the modulus of the elliptic curve and the number of operation bits. The larger the number of operation bits, the higher the multiplication requirement, but the number of loops will be reduced and the operation speed will be faster.

[0045] For example, assuming that the operation bit width is 32 bits and the modulus of the elliptic curve is 256 bits of data, the modulus of the elliptic curve can be divided into 8 32-bit moduli to be multiplied.

[0046] As another example, assuming that the operation bit width is 64 bits and the modulus of the elliptic curve is 256 bits of data, the modulus of the elliptic curve can be divided into four 64-bit moduli to be multiplied.

[0047] Step S103, performing a shift operation on the modular multiplication modulus according to a preset operation bit width to obtain a modular multiplication result of the elliptic curve.

[0048] In this embodiment, the modulus of the elliptic curve is divided according to the preset operation bit width to obtain the modulus to be multiplied; the modulus to be multiplied is shifted according to the preset operation bit width to obtain the modular multiplication result of the elliptic curve. The present application can replace the multiplication operation with the shift operation, simplify the modular multiplication, speed up the operation speed, and greatly reduce the area and delay overhead.

[0049] It can be understood that the Montgomery multiplication acceleration method of the elliptic curve in this embodiment can also be applied to various elliptic curves, such as the SM2 elliptic curve exemplified in this application. As long as the modulus of the elliptic curve is obtained; the modulus of the elliptic curve is divided according to the preset operation bit width to obtain the modulus to be multiplied; the modulus to be multiplied is shifted according to the preset operation bit width to obtain the result of the modular multiplication of the elliptic curve, it belongs to the inventive concept of this application.

[0050] In some cases, when obtaining the modulus of the elliptic curve, the base of the modulus of the elliptic curve may also be converted, for example, from decimal to hexadecimal, etc., but the present invention is not limited thereto.

[0051] In some cases, the modulus length of the obtained elliptic curve is not 2 n As long as the modulus of the elliptic curve can be divided, the Montgomery multiplication acceleration method of the elliptic curve of the present application can also be used for calculation, but it is not limited to this.

[0052] In one embodiment, the modulus of the elliptic curve is divided according to a preset operation bit width to obtain the modulus to be multiplied, including: dividing the modulus of the elliptic curve from high bits to low bits into multiple groups of modulus to be multiplied with the same number of bits as the preset operation bit width.

[0053] For example, taking the SM2 elliptic curve as an example, the modulus of the SM2 elliptic curve is 0xfffffffe_ffffffff_ffffffff_ffffffff_ffffffff_00000000_ffffffff_ffffffff, a total of 256 bits, divided by the operation bit width, assuming that the operation bit width is 32 bits. Each 32 bits is a group of moduli to be multiplied, then the modulus of the SM2 elliptic curve from high to low is {p7, p6, p5, p4, p3, p2, p1, p0}, where p7~p0 is the order from high to low, p7 is the highest bit, which is 0xfffffffe; p0 is the lowest bit, which is 0xffffffff.

[0054] In this embodiment, the modulus of the elliptic curve is divided from high to low into multiple groups of moduli to be multiplied with the same number of bits as the preset operation bit width, and the division and operation are performed in order from high to low, which can further speed up the operation speed.

[0055] In one embodiment, the elliptic curve comprises an SM2 elliptic curve.

[0056] The SM2 elliptic curve is a special elliptic curve used to implement cryptographic operations such as encryption and digital signatures on finite fields. The SM2 algorithm has been incorporated into China's national standards as part of the national secret algorithm and is mainly used to replace the traditional RSA algorithm. Compared with the RSA algorithm, SM2 has higher security, faster processing speed and less machine performance consumption.

[0057] The elliptic curve used by SM2 is usually defined on a prime field or a binary field, and its equation form is y² = x+ax+b (mod p), where p is a prime number. The finite fields considered by SM2 include the prime field Fp and the binary extension field F2m. The operation rules on these fields are crucial to the security of the algorithm. The base point G on the elliptic curve is public and is used to generate public and private key pairs. The selection of the base point must meet specific security standards.

[0058] In this embodiment, the Montgomery multiplication acceleration method of the elliptic curve in this embodiment can accelerate the operation of the SM2 elliptic curve to improve the overall processing speed. For example, in applications that require real-time or near real-time response, such as online payment, instant messaging, etc., accelerated operation can significantly improve user experience. In mobile devices and embedded systems, energy consumption is an important consideration. Accelerated operation can reduce the workload of the processor, thereby reducing energy consumption.

[0059] In one embodiment, the modulus of the SM2 elliptic curve is obtained as: 0xfffffffe_ffffffff_ffffffff_ffffffff_ffffffff_00000000_ffffffff_ffffffff; the number of bits of the preset operation bit width includes 32 bits; the modulus of the elliptic curve is divided according to the preset operation bit width to obtain the modulus to be multiplied, including: dividing the modulus of the SM2 elliptic curve into {p7, p6, p5, p4, p3, p2, p1, p0}.

[0060] Among them, p7=0xfffffffe; p6=0xffffffff; p5=0xffffffff; p4=0xffffffff; p3=0xffffffff; p2=0x00000000; p1=0xffffffff; p0=0xffffffff.

[0061] In this embodiment, when the number of operation bits is 32 bits, there are only three types of modular multiplications to be segmented: 0x00000000, 0xffffffff, and 0xfffffffe. Therefore, it is only necessary to implement modular multiplication of 0x00000000, 0xffffffff, and 0xfffffffe, which significantly simplifies the modular multiplication and speeds up the operation.

[0062] In one embodiment, the modulus to be multiplied is shifted according to the preset operation bit width, including: when the number x is multiplied by p7, the shift operation of p7 is performed according to the preset operation bit width: (x<<32)-(x<<1). When the number x is multiplied by p6~p3, p1~p0, the shift operation of p6~p3, p1~p0 is performed according to the preset operation bit width: (x<<32)-x. When the number x is multiplied by p2, the shift operation of p2 is performed according to the preset operation bit width: 0.

[0063] In this embodiment, since the number of operands is 32 bits, there are only three types of modular numbers to be segmented for modular multiplication: 0x00000000, 0xffffffff, and 0xfffffffe. By performing shift operations on 0x00000000, 0xffffffff, and 0xfffffffe instead of multiplication operations, the operation can be further simplified and the operation speed can be accelerated.

[0064] In one embodiment, the modulus of the SM2 elliptic curve is obtained as: 0xfffffffe_ffffffff_ffffffff_ffffffff_ffffffff_00000000_ffffffff_ffffffff; the number of bits of the preset operation bit width includes 64 bits; the modulus of the elliptic curve is divided according to the preset operation bit width to obtain the modulus to be multiplied, including: dividing the modulus of the SM2 elliptic curve into {p3', p2', p1', p0'}.

[0065] Among them, p3'=0xfffffffe_ffffffff; p2'=0xffffffff_ffffffff; p1'=0xffffffff_00000000; p0'=0xffffffff_ffffffff.

[0066] In this embodiment, when the number of operands is 64 bits, there are only three types of modular multiplications: 0xfffffffe_ffffffff, 0xffffffff_ffffffff, and 0xffffffff_00000000. Therefore, it is only necessary to implement modular multiplication of 0xfffffffe_ffffffff, 0xffffffff_ffffffff, and 0xffffffff_00000000, which can significantly simplify modular multiplication and speed up the calculation.

[0067] In addition, the number of operation bits in this embodiment is 64 bits, which can process 64-bit data operations simultaneously. The number of moduli to be multiplied is only 4. Compared with the case where the number of operation bits is 32 in the above embodiment, the operation can be performed faster in this embodiment.

[0068] In one embodiment, the shift operation is performed on the modulus to be multiplied according to the preset operation bit width, including: when the number x is multiplied by p3', the shift operation is performed on p3' according to the preset operation bit width: (x<<64)-(x<<32)-x. When the number x is multiplied by p2' and p0', the shift operation is performed on p2' and p0' according to the preset operation bit width: (x<<64)-x. When the number x is multiplied by p1', the shift operation is performed on p1' according to the preset operation bit width: (x<<64)-(x<<32).

[0069] In this embodiment, when the number of operation bits is 64 bits, there are only three types of modular numbers to be multiplied: 0xfffffffe_ffffffff, 0xffffffff_ffffffff, and 0xffffffff_00000000. Therefore, the three types of modular numbers to be multiplied can be operated by bit shift operation without multiplication operation, which reduces the difficulty of operation and speeds up the operation.

[0070] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0071] Based on the same inventive concept, the embodiment of the present application also provides an elliptic curve Montgomery multiplication acceleration device for implementing the above-mentioned elliptic curve Montgomery multiplication acceleration method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations of the one or more elliptic curve Montgomery multiplication acceleration device embodiments provided below can refer to the limitations of the elliptic curve Montgomery multiplication acceleration method above, and will not be repeated here.

[0072] In an exemplary embodiment, Figure 2As shown, a Montgomery multiplication acceleration device 200 for an elliptic curve is provided, and the Montgomery multiplication acceleration device 200 for an elliptic curve includes: a modulus acquisition module 210, a segmentation module 220 and an operation module 230, wherein the modulus acquisition module 210 is used to obtain the modulus of the elliptic curve; the segmentation module 220 is used to segment the modulus of the elliptic curve according to a preset operation bit width to obtain the modulus to be multiplied; the operation module 230 is used to perform a shift operation on the modulus to be multiplied according to the preset operation bit width to obtain the modular multiplication result of the elliptic curve.

[0073] In an exemplary embodiment, the segmentation module is further used to segment the modulus of the elliptic curve from high bits to low bits into a plurality of groups of moduli to be multiplied whose bit numbers are the same as the bit numbers of the preset operation bit width.

[0074] In an exemplary embodiment, the modulus acquisition module is further used to acquire the modulus of the SM2 elliptic curve.

[0075] In an exemplary embodiment, the modulus acquisition module is further used to obtain the modulus of the SM2 elliptic curve: 0xfffffffe_ffffffff_ffffffff_ffffffff_ffffffff_00000000_ffffffff_ffffffff; the preset operation bit width includes 32 bits. The segmentation module is also used to segment the modulus of the SM2 elliptic curve into {p7, p6, p5, p4, p3, p2, p1, p0}; wherein p7=0xfffffffe; p6=0xffffffff; p5=0xffffffff; p4=0xffffffff; p3=0xffffffff; p2=0x00000000; p1=0xffffffff; p0=0xffffffff.

[0076] In an exemplary embodiment, the operation module is also used to, when the number x is multiplied by p7, perform a shift operation on p7 according to the preset operation bit width: (x<<32)-(x<<1); when the number x is multiplied by p6~p3, p1~p0, perform a shift operation on p6~p3, p1~p0 according to the preset operation bit width: (x<<32)-x; when the number x is multiplied by p2, perform a shift operation on p2 according to the preset operation bit width: 0.

[0077] In an exemplary embodiment, the modulus acquisition module is further used to obtain the modulus of the SM2 elliptic curve as: 0xfffffffe_ffffffff_ffffffff_ffffffff_ffffffff_00000000_ffffffff_ffffffff; the preset operation bit width includes 64 bits. The segmentation module is also used to segment the modulus of the SM2 elliptic curve into {p3', p2', p1', p0'}; wherein p3'=0xfffffffe_ffffffff; p2'=0xffffffff_ffffffff; p1'=0xffffffff_00000000; p0'=0xffffffff_ffffffff.

[0078] In an exemplary embodiment, the operation module is also used to, when the number x is multiplied by the p3', perform a shift operation on p3' according to the preset operation bit width: (x<<64)–(x<<32)-x; when the number x is multiplied by p2', p0', perform a shift operation on p2', p0' according to the preset operation bit width: (x<<64)–x; when the number x is multiplied by p1', perform a shift operation on p1' according to the preset operation bit width: (x<<64)–(x<<32).

[0079] Each module in the above-mentioned Montgomery multiplication acceleration device for elliptic curves can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.

[0080] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 3As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store various data involved in the Montgomery multiplication acceleration method of elliptic curves. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a Montgomery multiplication acceleration method of an elliptic curve is implemented.

[0081] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0082] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0083] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0084] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0085] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0086] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0087] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A Montgomery multiplication acceleration method for elliptic curves, characterized in that: The modular multiplication acceleration method of the elliptic curve comprises: Get the modulus of the elliptic curve; Dividing the modulus of the elliptic curve according to a preset operation bit width to obtain a modulus to be multiplied; A shift operation is performed on the modulus to be modularly multiplied according to the preset operation bit width to obtain a modular multiplication result of the elliptic curve.

2. The Montgomery multiplication acceleration method for elliptic curves according to claim 1, characterized in that: The step of dividing the modulus of the elliptic curve according to a preset operation bit width to obtain the modulus to be multiplied includes: The modulus of the elliptic curve is divided from high bits to low bits into a plurality of groups of moduli to be multiplied, the number of which is the same as the number of bits of the preset operation bit width.

3. The Montgomery multiplication acceleration method for elliptic curves according to claim 1 or 2, characterized in that: The elliptic curve includes an SM2 elliptic curve.

4. The Montgomery multiplication acceleration method of elliptic curve according to claim 3, characterized in that: The modulus of the SM2 elliptic curve is obtained as: 0xfffffffe_ffffffff_ffffffff_ffffffff_ffffffff_00000000_ffffffff_ffffffff; the number of bits of the preset operation bit width includes 32 bits; the modulus of the elliptic curve is divided according to the preset operation bit width to obtain the modulus to be multiplied, including: Split the modulus of the SM2 elliptic curve into {p7, p6, p5, p4, p3, p2, p1, p0}; Among them, the p7=0xfffffffe; the p6=0xffffffff; the p5=0xffffffff; the p4=0xffffffff; the p3=0xffffffff; the p2=0x00000000; the p1=0xffffffff; and the p0=0xffffffff.

5. The Montgomery multiplication acceleration method of elliptic curve according to claim 4, characterized in that: The performing a shift operation on the modulus to be multiplied according to the preset operation bit width includes: When the number x is multiplied by the p7, the bit shift operation performed on the p7 according to the preset operation bit width is: (x<<32)-(x<<1); When the number x is multiplied by p6~p3, p1~p0, the shift operation performed on p6~p3, p1~p0 according to the preset operation bit width is: (x<<32)–x; When the number x is multiplied by the p2, the bit shift operation performed on the p2 according to the preset operation bit width is:

0.

6. The Montgomery multiplication acceleration method of elliptic curve according to claim 3, characterized in that: The modulus of the SM2 elliptic curve is obtained as: 0xfffffffe_ffffffff_ffffffff_ffffffff_ffffffff_00000000_ffffffff_ffffffff; the number of bits of the preset operation bit width includes 64 bits; the modulus of the elliptic curve is divided according to the preset operation bit width to obtain the modulus to be multiplied, including: Splitting the modulus of the SM2 elliptic curve into {p3', p2', p1', p0'}; Among them, the p3'=0xfffffffe_ffffffff; the p2'=0xffffffff_ffffffff; the p1'=0xffffffff_00000000; the p0'=0xffffffff_ffffffff.

7. The Montgomery multiplication acceleration method of elliptic curve according to claim 6, characterized in that: The performing a shift operation on the modulus to be multiplied according to the preset operation bit width includes: When the number x is multiplied by the p3', the bit shift operation performed on the p3' according to the preset operation bit width is: (x<<64)-(x<<32)-x; When the number x is multiplied by the p2' and p0', the bit shift operation performed on the p2' and p0' according to the preset operation bit width is: (x<<64)-x; When the number x is multiplied by the p1', the bit shift operation performed on the p1' according to the preset operation bit width is: (x<<64)-(x<<32).

8. An elliptic curve Montgomery multiplication acceleration device, characterized in that: The device comprises: The modulus acquisition module is used to obtain the modulus of the elliptic curve; A segmentation module, used for segmenting the modulus of the elliptic curve according to a preset operation bit width to obtain a modulus to be multiplied; The operation module is used to perform a shift operation on the modulus to be multiplied according to the preset operation bit width to obtain the modular multiplication result of the elliptic curve.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.