Method, device and equipment for generating and verifying digital signature
By combining precomputation technology and SIMD parallelization technology, the scalar multiplication in elliptic curve digital signatures is converted into parallel point addition operations, which solves the problem of low computational efficiency in the existing technology and improves the efficiency and performance of digital signatures.
Patent Information
- Application Number
- CN202411127125.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-10-15
AI Technical Summary
When generating and verifying digital signatures, existing technologies, especially elliptic curve digital signature algorithms, have problems of low computational efficiency and high resource consumption, especially in massive data processing and diverse application scenarios.
By combining precomputation technology and SIMD parallelization technology, fixed base point scalar multiplication is converted into scalar addition operations, and SIMD vector registers are used to perform parallel point addition operations to improve the calculation efficiency of elliptic curve target points.
It significantly reduces the online computing overhead of fixed-base point scalar multiplication, improves the efficiency and performance of digital signatures, and is suitable for massive data processing and diverse application scenarios.
Smart Images

Figure CN118784237A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital signature technology, and more particularly to a method for generating and verifying a digital signature. The present invention also relates to an apparatus for generating and verifying a digital signature and a computing device. Background Art
[0002] Digital signature is one of the important mechanisms to ensure network security. It is generated through specific rules and parameters, allowing the recipient of data to confirm the source and integrity of the data. The SM2 elliptic curve public key cryptography algorithm was first publicly released by the State Cryptography Administration in 2010, and was listed as China's national cryptography standard in 2016. It officially became an ISO / IEC international standard in 2018. The SM2 elliptic curve public key cryptography algorithm consists of three parts: digital signature algorithm, key exchange protocol and public key encryption algorithm. Compared with traditional digital signature algorithms (RSA, ELGamal, etc.), the SM2 digital signature algorithm has the advantages of small key space and fast signature speed. It has been widely used in e-government, online banking, Internet of Things and other fields, improving the security and reliability of data transmission. Batch verification schemes based on SM2 digital signatures and their derived functional signature schemes have been proposed one after another, and the application of signature algorithms has been further extended to blockchain, cloud computing and other fields.
[0003] Faced with massive data processing and diverse application scenarios, it is crucial to ensure data computing efficiency and the stability of cryptographic application systems. Among them, the rapid implementation of cryptographic algorithms has become a necessary condition. Summary of the invention
[0004] In view of this, embodiments of the present application provide methods, devices and equipment for generating and verifying digital signatures, so as to improve the efficiency of generating and verifying digital signatures.
[0005] According to a first aspect of an embodiment of the present application, a method for generating a digital signature is provided, comprising: obtaining a message to be signed and preset elliptic curve parameters; the elliptic curve parameters include coordinate values of a base point of the elliptic curve and the order of the base point; determining, according to the coordinate values of the base point and the order of the base point, a plurality of elliptic curve multiple points for calculating the coordinate values of a target point of the elliptic curve; obtaining the coordinate values of the plurality of elliptic curve multiple points from a pre-calculated table; storing the coordinate values of the plurality of elliptic curve multiple points in a group of SIMD vector registers, and performing point addition operations on data branches in a plurality of data channels of the SIMD vector registers in parallel to obtain the coordinate value of the target point; the data branches are obtained by dividing the coordinate values of the elliptic curve multiple points according to a preset data division bit width; a SIMD vector register comprises a plurality of data channels, a data branch is stored in a data channel, and data branches of different coordinate values of elliptic curve multiple points are stored in different data channels; and generating first signature information corresponding to the message based on the message and the coordinate value of the target point.
[0006] According to a second aspect of an embodiment of the present application, a method for verifying a digital signature is provided, comprising: obtaining a message to be verified, digital signature information corresponding to the message to be verified, elliptic curve parameters used to generate the digital signature information, and a public key corresponding to a private key used to generate the digital signature information; the digital signature information comprises first signature information and second signature information; the elliptic curve parameters comprise coordinate values of a base point of the elliptic curve and an order of the base point; determining, based on the coordinate values of the base point of the elliptic curve and the second signature information, a plurality of elliptic curve multiple points used to calculate the coordinate values of a target point of the elliptic curve; obtaining the coordinate values of the plurality of elliptic curve multiple points from a pre-calculated table; and converting the coordinate values of the plurality of elliptic curve multiple points into a public key. The coordinate values of the multiple points of the circular curve are stored in a group of SIMD vector registers, and point addition operations are performed in parallel on data branches in multiple data channels of the SIMD vector registers to obtain a first intermediate value for calculating the coordinate value of the target point; the data branches are obtained by dividing the coordinate values of the multiple points P of the elliptic curve according to a preset data division bit width; a SIMD vector register includes multiple data channels, one data channel stores one data branch, and data branches of the coordinate values of different multiple points of the elliptic curve are stored in different data channels; based on the first intermediate value, the order of the base point, the digital signature information and the public key, the verification result of the message to be verified is determined.
[0007] According to a third aspect of an embodiment of the present application, there is provided an apparatus for generating a digital signature, comprising: an initial parameter acquisition module, configured to acquire a message to be signed and preset elliptic curve parameters; the elliptic curve parameters include coordinate values of a base point of the elliptic curve and the order of the base point; a target point calculation module, configured to determine, according to the coordinate values of the base point and the order of the base point, a plurality of elliptic curve multiple points for calculating the coordinate values of a target point of the elliptic curve; a pre-calculated value acquisition module, configured to acquire the coordinate values of the plurality of elliptic curve multiple points from a pre-calculated table; a parallel point addition operation module, configured to store the coordinate values of the plurality of elliptic curve multiple points into a group of SIMD vector registers, and to perform point addition operations on data branches in a plurality of data channels of the SIMD vector registers in parallel to obtain the coordinate values of the target point; the data branches are obtained by dividing the coordinate values of the elliptic curve multiple points according to a preset data division bit width; a SIMD vector register comprises a plurality of data channels, a data branch is stored in a data channel, and data branches of different coordinate values of elliptic curve multiple points are stored in different data channels; and a digital signature information generation module, configured to generate first signature information corresponding to the message based on the message and the coordinate values of the target point.
[0008] According to a fourth aspect of an embodiment of the present application, there is provided a device for verifying a digital signature, comprising: an initial information acquisition module, used to obtain a message to be verified, digital signature information corresponding to the message to be verified, elliptic curve parameters used to generate the digital signature information, and a public key corresponding to a private key used to generate the digital signature information; the digital signature information comprises first signature information and second signature information; the elliptic curve parameters comprise coordinate values of a base point of the elliptic curve and the order of the base point; a target point calculation module, used to determine, according to the coordinate values of the base point of the elliptic curve and the second signature information, a plurality of elliptic curve multiple points used to calculate the coordinate values of a target point of the elliptic curve; a pre-calculated value acquisition module, used to obtain the coordinate values of the plurality of elliptic curve multiple points from a pre-calculated table; and A row point addition operation module is used to store the coordinate values of the multiple elliptic curve multiple points into a group of SIMD vector registers, and perform point addition operations on data branches in multiple data channels of the SIMD vector registers in parallel to obtain a first intermediate value for calculating the coordinate value of the target point; the data branches are obtained by dividing the coordinate values of the multiple points of the elliptic curve according to a preset data division bit width; a SIMD vector register includes multiple data channels, one data channel stores one data branch, and data branches of coordinate values of different multiple points of the elliptic curve are stored in different data channels; a verification result determination module is used to determine the verification result of the message to be verified based on the first intermediate value, the order of the base point, the digital signature information and the public key.
[0009] According to a fifth aspect of an embodiment of the present application, a computing device is provided, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the method for generating a digital signature or the method for verifying a digital signature when executing the computer instructions.
[0010] One embodiment of the present specification can achieve at least the following beneficial effects: by combining the pre-computation technology with the SIMD parallelization technology for the fixed base point scalar multiplication of the elliptic curve target point in the elliptic curve digital signature method during the process of generating a digital signature, the online computing overhead of the fixed base point scalar multiplication is reduced, the computing efficiency of the elliptic curve target point is improved, and the digital signature efficiency is thereby improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0012] Figure 1 A schematic diagram of a method for generating a digital signature provided in an embodiment of this specification is shown;
[0013] Figure 2 An online calculation flow chart of a fixed base point scalar multiplication method according to an embodiment of the present specification is shown;
[0014] Figure 3 An online calculation flow chart of a fixed base point scalar multiplication method according to another embodiment of the present specification is shown;
[0015] Figure 4 A flowchart of a method for generating a digital signature in an actual application scenario provided by an embodiment of this specification is shown;
[0016] Figure 5 A schematic diagram of a process for verifying a digital signature provided in an embodiment of this specification is shown;
[0017] Figure 6 A flowchart of a method for verifying a digital signature in an actual application scenario provided by an embodiment of this specification is shown;
[0018] Figure 7 The embodiment of this specification provides a corresponding Figure 1 A schematic diagram of the structure of a device for generating a digital signature;
[0019] Figure 8 The embodiment of this specification provides a corresponding Figure 5 A schematic diagram of the structure of a device for verifying a digital signature;
[0020] Fig. 9 A structural block diagram of a computing device 900 provided according to an embodiment of the present specification is shown. DETAILED DESCRIPTION
[0021] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0022] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.
[0023] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0024] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards in the relevant regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0025] First, the terms involved in one or more embodiments of the present application are explained.
[0026] Prime F p :p is an odd prime number, the prime field F p Contains p elements, represented by integers 0, 1, …, p-1 respectively.
[0027] Prime F p Basic operations: including addition, subtraction, multiplication, square, inversion, etc.
[0028] Prime F p Elliptic curve E(F p ): defined in F p The elliptic curve on p ).
[0029] Affine coordinate system: prime domain F p The elliptic curve on y can be simplified to y in the affine coordinate system. 2 =x 3 +ax+b,a,b∈F p And satisfy 4a 3 +27b 2 mod p≠0, the set of points on the elliptic curve is defined as: E(F p )={(x,y)|(x,y) satisfies in is a point at infinity. A point represented by affine coordinates contains two items (x, y).
[0030] Jacobi coordinate system: prime domain F p The elliptic curve on y can be simplified to y in the Jacobi coordinate system. 2 =x 3 +axz 4 +bz 6 ,a,b∈F p And satisfy 4a 3 +27b 2 mod p≠0, the set of points on the elliptic curve is defined as: E(F p )={(x,y,z)|(x,y,z) satisfies in The point at infinity is represented by the Jacobian coordinates, which contain three items (X, Y, Z).
[0031] Elliptic curve additive group: elliptic curve E(F p ) are constructed according to the addition operation to form a group.
[0032] Elliptic curve base point: A generator of the group of large prime factors of the elliptic curve additive group.
[0033] Elliptic curve scalar multiplication: Multiple additions to the same point on an elliptic curve are called scalar multiplication operations on that point. Let k be a positive integer, P be a point on the elliptic curve, and the k-times addition of point P is called the k-scalar multiplication of point P, denoted by
[0034] Fixed base point scalar multiplication: When point P is a fixed parameter, this type of scalar multiplication is called fixed base point scalar multiplication.
[0035] Variable base point scalar multiplication: When the point P is a non-fixed parameter, this type of scalar multiplication is called variable base point scalar multiplication.
[0036] Digital signature algorithm: A signer generates a digital signature on the data, and a verifier verifies the authenticity of the signature. Each signer has a public key and a private key, where the private key is used to generate the digital signature, and the verifier verifies the signature with the signer's public key.
[0037] SM2 elliptic curve: The prime field modulus p is defined as 2 256 -2 224 -2 96 +2 64 -1, the elliptic curve equation is y 2 =x 3 +ax+b, where a=-3, b=28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93 (in hexadecimal).
[0038] SM2 digital signature algorithm: SM2 digital signature algorithm includes key generation algorithm, signature generation algorithm and signature verification algorithm. First, the system generates a private key d according to the key generation algorithm. A and the public key P A ; Then, the signer uses the private key d A Run the signature generation algorithm to generate a signature pair (r; s) of message M and send it to the verifier. Finally, after receiving the signature pair (r; s), the verifier uses the signer’s public key P A Run the signature verification algorithm to verify whether the signature passes. The hash algorithm H specified in the SM2 digital signature algorithm 256 is the SM3 cryptographic hash algorithm, G is the base point of the SM2 elliptic curve, n is the order of the base point G, and the specific calculation process is as follows:
[0039] Key generation algorithm: input security parameters, output private key d A ∈[1, n-2] and public key P A =[d A ]G.
[0040] Signature generation algorithm:
[0041] (1) Calculate the hash value e = H of message M 256 (M);
[0042] (2) Generate a random number k∈[1,n-1];
[0043] (3) Calculate [k]G = (x1, y1), r = (e + x1) mod n. If r = 0 or r + k = n, return to (2).
[0044] (4) Calculate s = ((1 + d A ) -1 ·(kr·d A ))mod n, if s=0, return to (2);
[0045] (5) Output the signature pair (r; s) corresponding to the message M.
[0046] Signature verification algorithm:
[0047] (1) Verify whether r′∈[1, n-1]; s′∈[1, n-1] holds. If not, the signature verification fails.
[0048] (2) Calculate the hash value e′ of the received message M′ = H 256 (M′);
[0049] (3) Calculate t = (r′ + s′) mod n. If t = 0, the signature verification fails.
[0050] (4) Calculate (x′1, y′1) = [s′]G + [t]P A ; R = (e′ + x′1) mod n, verify whether R = r′ is true, if so, the signature verification passes, otherwise the signature verification fails.
[0051] In addition, according to the national standard GB / T 32918.2-2016, in the SM2 digital signature algorithm, n is the order of the SM2 elliptic curve generator (ie, the elliptic curve base point), and its length is 256 bits.
[0052] Instruction set: The instruction set is a hard program inside the CPU that is used to guide and optimize CPU operations. It is the interface between the software and the CPU, and specifies the set of instructions that the processor can execute. Different CPUs use different instruction sets. The instruction set architecture includes basic data types, instruction sets, registers, addressing modes, storage systems, interrupts, exception handling, and external IO. Each instruction corresponds to a circuit, and the hardware circuit is designed according to the instruction set.
[0053] SIMD (Single Instruction Multiple Data): Single instruction multiple data stream is a technology that uses one controller to control multiple processors and simultaneously performs the same operation on each data in a set of data (i.e., a data vector) to achieve spatial parallelism. A processor with a SIMD instruction set contains a set of special vector registers and related instruction sets that can calculate the data in the vector registers in parallel. Compared with the traditional x64 instruction set, the SIMD instruction set has a significant advantage in processing speed in data-intensive computing scenarios. Represented by Intel processors, the SIMD instruction set of this processor includes SSE, AVX, AVX2 and AVX512, and different versions of the instruction set registers have different lengths and numbers.
[0054] AVX instruction set: launched in 2011, it is the instruction set for Sandy Bridge and Larrabee architectures. The length of the vector register in the AVX instruction set is 256 bits, divided into two 128-bit channels, namely the high channel and the low channel.
[0055] AVX2 instruction set: Based on the AVX instruction set, the vector processing capability across floating-point and integer data domains is expanded. For example, when the operand is 64 bits wide, the AVX2 instruction set can process four 64-bit operands at a time.
[0056] AVX-512 (Advanced Vector Extensions 512-bit) instruction set: It is an extension of AVX / AVX2, and its feature is the use of 512-bit wide vector registers, which allows more data to be processed in a single instruction, and supports packing 8 64-bit data, 16 32-bit data, 32 16-bit data, or 64 8-bit data into registers. For example, when the operand is 64 bits wide, the AVX-512 instruction set can process 8 64-bit operands at a time.
[0057] AVX512-IFMA instruction set: It is an extension of the AVX-512 instruction set, which mainly provides fused multiplication and addition instructions for integer multiplication and addition operations, which can perform multiplication and addition operations in a single instruction.
[0058] YMM register: First introduced in the AVX instruction set and used in the AVX2 instruction set, it can operate 256-bit width data.
[0059] ZMM register: Introduced with the AVX-512 instruction set, it can operate on 512-bit wide data.
[0060] permute instruction: often called a permutation instruction. For example, the _mm256_permute4x64_epi64 permutation instruction is used to rearrange the 64-bit integer in the 256-bit YMM register.
[0061] Shuffle instruction: usually called shuffle instruction. For example, _mm256_shuffle_epi32 shuffle instruction is used to rearrange the 32-bit integer elements in the 256-bit YMM register. This instruction operates independently in each 128-bit data lane, and each lane contains four 32-bit integers.
[0062] At present, the SM2 algorithm has been widely used in the fields of electronic authentication, electronic signature, data encryption, etc. In the face of massive data processing and diversified application scenarios, it is crucial to ensure the efficiency of data operations and the stability of cryptographic application systems. Among them, the rapid implementation of cryptographic algorithms has become a necessary condition. In the embodiments of this specification, the SM2 commercial cryptographic algorithm is implemented based on the latest AVX2 and AVX-512 instruction sets, which greatly improves the software implementation performance of the SM2 algorithm, is conducive to promoting the research and development and application of cryptographic algorithm products in my country, and promoting the realization of independent control of cryptographic algorithm products.
[0063] In the present application, a method for generating a digital signature is provided. The present application also involves an apparatus for generating a digital signature and a computing device, which are described in detail one by one in the following embodiments.
[0064] Figure 1 A flowchart of a method for generating a digital signature provided in an embodiment of this specification.
[0065] From the program perspective, at least part of the execution of the process can be a program installed on an application server or an application terminal. It can be understood that the method can be executed by any device, equipment, platform, or device cluster with computing and processing capabilities.
[0066] like Figure 1 As shown, the process may include the following steps:
[0067] Step 102: Obtain a message to be signed and preset elliptic curve parameters; the elliptic curve parameters include coordinate values of a base point of the elliptic curve and the order of the base point.
[0068] Before performing digital signature based on elliptic curve algorithm, it is necessary to obtain the original data used for signature.
[0069] On the one hand, the original data for signing may include the content to be signed. Specifically, the content to be signed may include the message M to be signed. And optionally, the content to be signed may also include the user information of the user who initiated the signature, for example, the user identification Z A In practical applications, a cryptographic hash algorithm can be used to treat the signed message M and user identifier Z A After compression to obtain the hash value e, the digital signature information is calculated.
[0070] On the other hand, the original data for signing may include parameters for executing the signature. Specifically, the parameters for executing the signature may include preset elliptic curve parameters, and more specifically, the elliptic curve parameters may include the coordinate value of the base point G of the elliptic curve and the order n of the base point. Furthermore, the parameters for executing the signature may also include a secret key pre-generated based on the elliptic curve parameters, and more specifically, the parameters for executing the signature may include a private key d A In practical applications, it can be based on the elliptic curve parameters and the private key d A Calculate digital signature information.
[0071] In the process of digital signature based on elliptic curve algorithm, according to the principle of elliptic curve algorithm, it is necessary to generate a random parameter k and calculate the point multiplication operation of the random parameter k and the coordinate value of the elliptic curve base point G in the elliptic curve parameter, that is, it is necessary to calculate [k]G to obtain the coordinate value of a target point Q on the elliptic curve. In practical application, the target point Q calculated based on the random parameter k is actually a random point on the elliptic curve corresponding to the preset elliptic curve parameter. It is recorded as a "target point" only for the convenience of description. The word "target" does not actually limit the point on the elliptic curve.
[0072] Furthermore, in the embodiments of the present specification, the method for generating a digital signature specifically applies the SM2 digital signature algorithm. In the SM2 digital signature algorithm, the base point G of the SM2 elliptic curve is a fixed parameter. Therefore, when the target point of the elliptic curve is calculated according to [k]G, the calculation process of [k]G is actually a fixed base point scalar multiplication operation. In the embodiments of the present specification, considering that the consumption of computing resources is large if the scalar multiplication operation is performed in the process of executing the signature online, the scalar multiplication operation of the fixed base point can be converted into a scalar addition operation, and a pre-calculation technology is adopted, that is, the values of each item that may participate in the scalar addition operation are pre-calculated offline and stored in a pre-calculation table. When the operation is performed online, it is only necessary to obtain the pre-calculated data from the pre-calculation table and perform several point addition operations, which greatly reduces the amount of calculation of the online operation and improves the calculation rate of [k]G when calculating the coordinate value of the target point, thereby improving the efficiency of the digital signature.
[0073] Step 104: Determine a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve according to the coordinate value of the base point and the order of the base point.
[0074] Furthermore, in step 104, based on the coordinate value of the base point G and the order n of the base point, a plurality of elliptic curve multiple points P for calculating the coordinate value of the target point Q of the elliptic curve are determined, which may specifically include: first, based on the order n of the base point, a random parameter k that is less than the order n of the base point is generated; and then, based on the random parameter k and the coordinate value of the base point G, a plurality of elliptic curve multiple points P for calculating the coordinate value of the target point Q of the elliptic curve are determined.
[0075] Furthermore, based on the random parameter k and the coordinate value of the base point G, determining a plurality of elliptic curve multiple points P for calculating the coordinate value of the target point Q of the elliptic curve may specifically include: obtaining a preset base w, and converting the random parameter k into a base expression based on the base w; then, based on the base expression, converting the point multiplication operation between the random parameter k and the coordinate value of the base point G into a point addition operation between the plurality of elliptic curve multiple points P, and determining the plurality of elliptic curve multiple points P for calculating the coordinate value of the target point Q of the elliptic curve.
[0076] In the embodiment of the present specification, based on the preset base w, the elliptic curve multiple point can be [k i 2 wi ]G represents; where G represents the coordinate value of the base point of the elliptic curve, w represents the preset base number, and i ranges from 0 to integer, k i The value is 0 to 2 w An integer of -1.
[0077] Specifically, when the base number is w, the random parameter k can be multiplied by 2 w Represent it in base and get the base expression in, 0≤k i ≤2 w -1. In the SM2 digital signature algorithm, n is the order of the SM2 elliptic curve generator, and its length is 256 bits. Since the random parameter k∈[1,n-1], it can be known that the bit length of k does not exceed 256 bits. In practical applications, for convenience, when the length of k is less than 256 bits, its high bits can be padded with 0. Therefore, the above base expression In
[0078] More specifically, due to The point multiplication operation [k]G can be rewritten as a point addition operation, that is, Therefore, this dot multiplication operation of [k]G can be converted to [k0]G+[k1·2 w ]G+…+[k l-1 2 w(l-1) ]G=P0+P1+…+P l-1 , that is, converted into l elliptic curve multiple points P0 to P l-1 Therefore, in practical applications, offline, we can pre-calculate all i from 0 to l-1 and all k i From 0 to 2 w -1 hour [k i 2 wi ]G results, that is, a total of 2 w ·The values of l elliptic curve multiple points; on the line, we can obtain the values of the corresponding l elliptic curve multiple points P from the pre-calculated table according to the actual value of k, and then only need to perform l-1 point additions to get the result of the point multiplication operation of the fixed base point [k]G.
[0079] In the embodiment of the present specification, the process including step 104, step 106 and step 108 describes the online calculation process. Specifically, step 104 describes the online conversion of [k]G to [k0]G+[k1·2 w ]G+…+[k l-1 2 w(l-1) ]G=P0+P1+…+P l-1 Step 106 describes the process of obtaining the pre-calculated P0 to P from the pre-calculated table. l-1 Step 108 describes the process of calculating the value of P0 to P l-1 The process of performing a point addition operation.
[0080] Taking the base number w=16 as an example, In step 104, the calculation of [k]G can be converted into P0 = [k0]G, P1 = [k1·2 16 ]G,…,P 15 =[k 15 2 16×15 ]G, that is, it can be determined that the multiple points used for calculating [k]G and for point addition are P0 = [k0]G, P1 = [k1·2 16 ]G, ..., P 15 =[k 15 2 16·15 ]G these 16 elliptic curve multiple points. In practical applications, for different random parameters k, the corresponding k0 to k 15 The actual value of is not exactly the same, and the multiple points of the elliptic curve determined are not exactly the same.
[0081] Taking the base number w=8 as an example, In step 104, the calculation of [k]G can be converted into P0 = [k0]G, P1 = [k1·2 8 ]G,…,P 31 =[k 31 2 8×31 ]G, that is, it can be determined that the multiple points used for calculating [k]G and for point addition are P0 = [k0]G, P1 = [k1·2 8 ]G, ..., P 31 =[k 31 2 8×31 ]G these 32 elliptic curve multiple points. In practical applications, for different random parameters k, the corresponding k0 to k 31 The actual value of is not exactly the same, and the multiple points of the elliptic curve determined are not exactly the same.
[0082] Step 106: Obtain coordinate values of the multiple elliptic curve multiple points from the pre-calculated table.
[0083] In an embodiment of the present specification, before obtaining the coordinate values of the multiple elliptic curve multiple points P from the pre-calculated table online, the method may also include: offline, according to a preset base w, pre-calculating the coordinate values of the elliptic curve multiple points corresponding to the base w, wherein the coordinate values of the elliptic curve multiple points are calculated by the multiple point parameter k. i 2 wi The multiple point parameters are determined by multiplying the coordinate value of the base point G, and the multiple point parameters are determined based on the base w; and the coordinate values of the multiple points of the elliptic curve are stored in a pre-calculated table.
[0084] Specifically, during offline pre-calculation, for a selected base w, a set of corresponding coordinate values of multiple points of the elliptic curve can be pre-calculated. The base used in offline pre-calculation is the same as the base used in online calculation. In actual application, the base w used in offline pre-calculation is related to the configuration of the device used when performing the digital signature or signature verification operation, and when calculating the pre-calculation table, the configuration of the device used when the digital signature or signature verification operation is to be performed is usually known. Therefore, the pre-calculation table can be calculated for the base w corresponding to the device used when the digital signature or signature verification operation is to be performed.
[0085] More specifically, the elliptic curve multiple point can be expressed as [k i 2 wi ]G. For the selected base w, we can calculate Then for all i from 0 to l-1, all k i From 0 to 2w -1, precompute [k i 2 wi ]G, a total of 2 w The coordinate values of the i elliptic curve multiple points are stored in the pre-calculated table. Then, when step 106 is executed online, the coordinate values of the 2 points in the pre-calculated table can be obtained by looking up the table. w The coordinate values of the l elliptic curve multiple points corresponding to the actual random parameter k value are searched from the coordinate values of the l elliptic curve multiple points, and the subsequent point addition operation is performed (ie, step 108 is executed).
[0086] For example, taking the base number w = 16, l = 16, for all i from 0 to 15, all k i From 0 to 2 16 -1, you can pre-calculate [k i 2 16i ]G value, thus, we can get 2 16 ×16 coordinate values of multiple points of the elliptic curve are stored in the pre-calculated table. In actual application, they are stored in 2 16 ×16 elliptic curve multiple point coordinate values pre-calculated table size can be 64MB. Then, when calculating online, according to the determination of P0 = [k0] G, P1 = [k1·2 16 ]G, ..., P 15 =[k 15 2 16×15 ]GThese 16 elliptic curve multiple points, when executing step 106, the values of these 16 elliptic curve multiple points can be obtained by looking up the 216×16 values in the pre-calculated table, and subsequent point addition operations are performed, that is, 15 point additions are performed.
[0087] For example, taking the base number w = 8, l = 32, for all i from 0 to 31, all k i From 0 to 2 8 -1, you can precompute [k i 2 8i ]G value, thus, we can get 2 8 ×32 coordinate values of multiple points of the elliptic curve are stored in the pre-calculated table. In actual application, they are stored in 2 8 ×32 elliptic curve multiple point coordinate values pre-calculated table size can be 512KB. Then, when calculating online, according to the determination of P0 = [k0] G, P1 = [k1·2 8 ]G, ..., P 31 =[k 31 2 8×31 ]G These 32 elliptic curve multiple points, when executing step 106, can be obtained from the 2 pre-calculated table 8×32 values are looked up in the table to obtain the values of the 32 elliptic curve multiple points, and subsequent point addition operations are performed, that is, 31 point additions are performed.
[0088] In an embodiment of the present specification, after converting the online point multiplication operation used in the digital signature process into an online point addition operation based on the pre-calculation technology, SIMD parallelization technology is further used to perform the point addition operation to further improve the efficiency of the digital signature based on SM2, such as step 108.
[0089] Step 108: Store the coordinate values of the multiple elliptic curve multiple points into a group of SIMD vector registers, and perform point addition operations on the data branches in the multiple data channels of the SIMD vector registers in parallel to obtain the coordinate value of the target point; the data branches are obtained by dividing the coordinate values of the multiple points of the elliptic curve according to a preset data division bit width; a SIMD vector register includes multiple data channels, one data branch is stored in one data channel, and data branches of the coordinate values of different multiple points of the elliptic curve are stored in different data channels.
[0090] In practical applications, the coordinates of points on an elliptic curve are generally stored using a structure, in which each data is a coordinate component. A coordinate point can contain multiple coordinate components. For example, if the coordinate point is in the form of affine coordinates, then a coordinate point includes two coordinate components, corresponding to two prime domain elements. For another example, if the coordinate point is in the form of Jacobian coordinates, then a coordinate point includes three coordinate components, corresponding to three prime domain elements. When executing the operation of step 108, it is necessary to map the prime domain elements of each coordinate component to a vector register.
[0091] When step 108 is actually executed, for each coordinate component corresponding to the coordinate point, multiple data branches can be obtained by segmentation according to the preset data segmentation bit width, and the multiple data branches obtained by segmentation are respectively stored in the corresponding data channels of different vector registers in a set of vector registers. The coordinate value in step 108 can specifically include one or more coordinate components of the corresponding coordinate point. The data branches stored in each data channel can actually be used as operands when the SIMD instruction set performs operations on the data in the SIMD vector register.
[0092] In an embodiment of the present specification, each of the coordinate values may include multiple data branches; the i-th data branch of each of the coordinate values may be stored in the i-th SIMD vector register in the set of SIMD vector registers; wherein i may be a positive integer from 1 to M; and M may be the number of data branches determined based on the data segmentation bit width and the data bit length.
[0093] Furthermore, the data bit length may specifically be a prime field F used to represent an elliptic curve point. p The bit length of the element. For example, in the SM2 elliptic curve algorithm, the data bit length can be 256 bits.
[0094] Further, the data segmentation bit width can be determined according to the instruction set used to perform the basic operations of the prime field. In the embodiment of the present specification, the AVX512-IFMA instruction set can be applied to implement the underlying finite field operations, that is, the AVX512-IFMA instruction set is applied to implement the basic operations of the prime field such as addition, subtraction, multiplication, square, inversion, etc. In practical applications, since the AVX512-IFMA instruction set is applied to implement the basic operations of the prime field, and the input width of the multiplication and addition instruction of the AVX-512IFMA instruction set is 52 bits, the data segmentation bit width can be set to 52 bits.
[0095] Furthermore, the quotient of the data bit length divided by the data segmentation bit width may be rounded up to obtain the number of data branches. As an example, when the data bit length is 256 bits and the data segmentation bit width is 52 bits, the number of data branches M may be: In the embodiment of the present specification, by setting the data segmentation bit width to 52 bits, only 5 registers are occupied when representing a 256-bit large integer. In contrast, if the data segmentation bit width is conventionally set to 29 bits, 10 registers are required when representing a 256-bit large integer. It can be seen that in the embodiment of the present specification, by setting the appropriate data segmentation bit width, the number of registers required in the elliptic curve point operation can be reduced while meeting the calculation needs, and the occupation of registers when performing elliptic curve point addition operations in the digital signature process can be reduced.
[0096] In an embodiment of the present specification, each SIMD vector register may include multiple data channels; the data branch of the coordinate value of the jth elliptic curve multiple point among the multiple elliptic curve multiple points may be stored in the jth data channel of the corresponding SIMD vector register; wherein j may be a positive integer from 1 to N, and N may be the number of data channels determined based on the data channel width and the bit width of the SIMD vector register.
[0097] Furthermore, the data channel width can be determined based on the data segmentation bit width. For example, when the data segmentation bit width is set to 52 bits, the data channel width can be set to 64 bits to accommodate 52-bit data branches. Through this data segmentation scheme in which the data segmentation bit width is smaller than the data channel width, the data of each branch can accumulate more values without immediately generating external carry, thereby increasing the parallelism and efficiency of operations by sacrificing a certain degree of data density. In particular, when processing a large number of prime field operations, the parallel computing capability of the processor can be better utilized by delaying carry processing.
[0098] Furthermore, the quotient of the bit width of the SIMD vector register divided by the data channel width may be used as the number of data channels. For example, when the data channel width is 64 bits and the bit width of the SIMD vector register is 512 bits, the number of data channels N may be 512 / 64=8. For another example, when the data channel width is 64 bits and the bit width of the SIMD vector register is 256 bits, the number of data channels N may be 256 / 64=4.
[0099] As an example, if the AVX2 instruction set and YMM registers are used to implement the SM2 elliptic curve algorithm, then: before using the AVX2 instruction set to implement large integer operations, first, it is necessary to map the 256-bit prime field elements to the 256-bit YMM register. Specifically, the 256-bit integer can be represented in a 52-bit basis, which requires the use of words to represent a large integer, for example, the prime field F p The element a is represented in 52 bits as Furthermore, the 256-bit YMM register can be considered as consisting of four 64-bit channels, with the four prime fields F p The same weight words of elements a, b, c, and d are packed and stored in one YMM register, so a total of 5 YMM registers are required to represent a total of 4 integers.
[0100] For elliptic curve points, if we take affine coordinates as an example, based on the representation of prime field elements, 10 YMM registers are required to represent the elliptic curve point A under 4 affine coordinates = (x A ,y A ),B=(x B ,y B ),C=(x C ,y C ) and D=(x D ,y D), based on this data structure, since the register contains 4 data channels, it is possible to implement 4-way parallel prime field operations, specifically, 4-way parallel point addition operations between affine coordinates and affine coordinates. Taking Jacobian coordinates as an example, based on the representation of prime field elements, 15 YMM registers are required to represent the elliptic curve point A=(x A ,y A ,z A ),B=(x B ,y B ,z B ),C=(x C ,y C ,z C ) and D=(x D ,y D ,z D ), based on this data structure, since the register contains 4 data channels, it is possible to implement 4-way parallel prime field operations, specifically, 4-way parallel point addition operations of Jacobian coordinates and Jacobian coordinates.
[0101] As another example, if the AVX-512 instruction set and ZMM registers are used to implement the SM2 elliptic curve algorithm, then: before using the AVX-512 instruction set to implement large integer operations, first, it is necessary to map the 256-bit prime field elements to the 512-bit ZMM registers. Specifically, the 256-bit integer can be represented in a 52-bit basis, which requires the use of words to represent a large integer, for example, the prime field F p The element a is represented in 52 bits as Furthermore, the 512-bit ZMM register can be considered as consisting of eight 64-bit channels, with eight prime fields F p The same weight word of elements a, b, c, d, e, f, g, h is packed into one ZMM register, so a total of 5 ZMM registers are needed to represent a, b, c, d, e, f, g, h, a total of 8 integers.
[0102] For elliptic curve points, if we take affine coordinates as an example, based on the representation of prime field elements, 10 ZMM registers are required to represent the elliptic curve point A=(x A ,y A ),B=(x B ,y B ),C=(x C ,y C ),D=(x D ,y D ),E=(x E ,y E ),F=(xF ,y F ),G=(x G ,y G ) and H=(x H ,y H ), based on this data structure, since the register contains 8 data channels, it is possible to implement 8-way parallel prime field operations, specifically, 8-way parallel point addition operations between affine coordinates and affine coordinates. Taking Jacobian coordinates as an example, based on the representation of prime field elements, 15 ZMM registers are required to represent the elliptic curve point A=(x A ,y A ,z A ),B=(x B ,y B ,z B ),C=(x C ,y C ,z C ),D=(x D ,y D ,z D ),E=(x E ,y E ,z E ),F=(x F ,y F ,z F ),G=(x G ,y G ,z G ) and H=(x H ,y H ,z H ), based on this data structure, since the register contains 8 data channels, it is possible to implement 8-way parallel prime field operations, specifically, 8-way parallel point addition operations of Jacobian coordinates and Jacobian coordinates.
[0103] Step 110: Generate first signature information corresponding to the message based on the message and the coordinate value of the target point.
[0104] When performing a digital signature, generating the first signature information corresponding to the message based on the message and the coordinate value of the target point may specifically include: first, generating a hash value e of the message M; then, generating the first signature information r corresponding to the message M based on the hash value e, the coordinate value x1 of the target point Q and the order n of the base point.
[0105] The generating of the hash value e of the message M may be specifically to process the message M using a preset hash algorithm to obtain the hash value e. Alternatively, the message M and the identification information Z of the user executing the digital signature may be processed using a preset hash algorithm.A At the same time, the hash value e is obtained. For example, first calculate Then calculate Among them, Z A represents the user's identification information, M represents the message to be signed, and H v represents the preset hash algorithm, and e represents the hash value.
[0106] The generating of the first signature information r corresponding to the message M based on the hash value e, the coordinate value x1 of the target point Q, and the order n of the base point may specifically include: performing a modulo operation on the sum of the hash value e and the first coordinate component x1 of the target point with respect to the order n of the base point in the preset elliptic curve parameters to obtain the first signature information r. For example, r = (e + x1) mod n, wherein e represents the hash value, x1 represents the first coordinate component of the target point, n represents the order of the base point in the preset elliptic curve parameters, and r represents the first signature information.
[0107] Furthermore, when performing digital signature, the first signature information r corresponding to the message M is generated based on the message M and the coordinate value x1 of the target point Q (step 110), and then the second signature information may be generated. Specifically, the digital signature private key d A , the first signature information r, the random parameter k and the order n of the base point, to generate the second signature information s corresponding to the message M. For example, s=(1+d A ) -1 ·(kr·d A )mod n, where d A represents the private key, k represents the random parameter, r represents the first signature information, n represents the order of the base point in the preset elliptic curve parameter, and s represents the second signature information.
[0108] Furthermore, when performing digital signing, after obtaining the first signature information and the second signature information, the message M and the digital signature information corresponding to the message M can be output; the digital signature information includes the first signature information r and the second signature information s.
[0109] It should be understood that in the methods described in one or more embodiments of this specification, the order of some steps can be adjusted according to actual needs, or some steps can be omitted.
[0110] Figure 1The method in the paper combines the pre-computation technology with the SIMD parallelization technology for the fixed base point scalar multiplication of the elliptic curve target point in the elliptic curve digital signature method during the process of generating the digital signature, thereby reducing the online calculation overhead of the fixed base point scalar multiplication, improving the calculation efficiency of the elliptic curve target point, and thus improving the digital signature efficiency.
[0111] based on Figure 1 The method, the embodiments of this specification also provide some specific implementation methods of the method, which are described below.
[0112] In one or more embodiments of the present specification, during the process of generating digital signature information, it is also possible to verify whether the first signature information and the second signature information meet preset conditions.
[0113] Specifically, based on the digital signature key d A , the first signature information r, the random parameter k and the order n of the base point, before generating the second signature information s corresponding to the message M, it may also include: judging whether the first signature information r meets a first preset condition to obtain a first judgment result, wherein the first preset condition includes that the first signature information is zero or the sum of the first signature information and the random parameter is equal to the order n of the base point. Therefore, if the first judgment result is no, then based on the digital signature key d A , the first signature information r, the random parameter k and the order n of the base point, generate the second signature information s corresponding to the message M; if the first judgment result is yes, it can return to regenerate the random parameter k.
[0114] Before outputting the message M and the digital signature information (r, s) corresponding to the message M, it may also include: judging whether the second signature information s meets a second preset condition, and obtaining a second judgment result; the second preset condition includes that the second signature information is zero. Thus, if the second judgment result is no, the message M and the digital signature information (r, s) corresponding to the message M may be output; if the second judgment result is yes, it may return to regenerate the random parameter k.
[0115] In one or more embodiments of the present specification, after converting the online point multiplication operation used in the digital signature process into an online point addition operation based on the pre-computation technology, the point addition operation is further performed using SIMD parallelization technology. Furthermore, in the SIMD parallelization calculation process, in order to maximize the use of the CPU's computing performance and optimize the computing efficiency, the SIMD vector registers with different bit widths and the SIMD instruction set can be combined to implement the point addition operation in the SIMD parallelization calculation process.
[0116] Optionally, in step 108, the coordinate values of the multiple elliptic curve multiple points P are stored in a group of SIMD vector registers, and point addition operations are performed in parallel on data branches in multiple data channels of the SIMD vector registers to obtain the coordinate value of the target point Q, which may specifically include the following steps.
[0117] First, the coordinate values of the multiple elliptic curve multiple points are stored in a first SIMD vector register, and a first SIMD instruction set is used to perform a first multi-way parallel point addition operation corresponding to a first bit width of the first SIMD vector register on the coordinate values stored in the first SIMD vector register to obtain coordinate values of multiple intermediate elliptic curve points; wherein the first SIMD instruction set is used to operate data of the first bit width; and a first parallel operation number of the first multi-way parallel point addition operation is a first data channel number determined based on the data channel width and the first bit width of the first SIMD vector register.
[0118] Then, the coordinate values of the multiple intermediate elliptic curve points are stored in a second SIMD vector register, and a second SIMD instruction set is used to perform a second multi-way parallel point addition operation corresponding to the second bit width of the second SIMD vector register on the coordinate values stored in the second SIMD vector register to obtain the coordinate value of the target point; wherein the second bit width is smaller than the first bit width; the second SIMD instruction set is used to operate data of the second bit width; and the second parallel operation number of the second multi-way parallel point addition operation is the second data channel number determined based on the data channel width and the second bit width of the second SIMD vector register.
[0119] As described above, in the embodiments of this specification, in the process of SIMD parallel point addition calculation, in order to optimize the calculation efficiency, registers with appropriate bit widths and corresponding instruction sets can be selected to participate in the calculation. And usually, in the early stage of calculation, when the number of points to be added is large, registers with relatively large bit widths and corresponding instruction sets are used to perform the calculation; and when the number of points to be added is small after one or more calculations, registers with relatively small bit widths and corresponding instruction sets can be used to perform the calculation.
[0120] Furthermore, in actual application, the first multi-way parallel point addition operation can be performed once or multiple times until the number of the multiple intermediate elliptic curve points is reduced to meet the preset conditions to obtain the coordinate values of the multiple intermediate elliptic curve points, and then use registers with relatively small bit width and corresponding instruction sets to perform subsequent operations.
[0121] Specifically, storing the coordinate values of the multiple intermediate elliptic curve points in the second SIMD vector register may specifically include: determining whether the number of the multiple intermediate elliptic curve points is less than or equal to a preset number threshold (wherein the preset number threshold is determined according to the number of the second data channels) to obtain a determination result; if the determination result is yes, storing the coordinate values of the multiple intermediate elliptic curve points in the second SIMD vector register; if the determination result is no, performing the first multi-way parallel point addition operation again for the coordinate values of the multiple intermediate elliptic curve points until the number of the intermediate elliptic curve points obtained is less than or equal to the preset threshold. Wherein, the preset number threshold may be twice the number of the second data channels.
[0122] Further, the second bit width corresponding to the second SIMD vector register may be half of the first bit width corresponding to the first SIMD vector register. In practical applications, for example, the first bit width may be 512 bits, and the second bit width may be 256 bits. As an example, the first SIMD instruction set may include an AVX-512 instruction set, and the first SIMD vector register may include a ZMM register; the second SIMD instruction set may include an AVX2 instruction set, and the second SIMD vector register may include a YMM register.
[0123] As an example, when a 64-bit data channel width, a 512-bit first SIMD vector register, and a 256-bit second SIMD vector register are used, the number of the first data channels is 8, and the number of the second data channels is 4, then the preset number threshold may be 8. Accordingly, the first multi-way parallel point addition operation specifically includes an 8-way parallel point addition operation; and the second multi-way parallel point addition operation specifically includes a 4-way parallel point addition operation.
[0124] In this example, when the first multi-way parallel point addition operation is performed using the first SIMD instruction set and the first SIMD vector register, each time the first multi-way parallel point addition operation is performed, two groups of first SIMD vector registers can be used, each group stores 8 data points, and the point addition operation between the two groups of data points is performed. When the preset number is 8, when the number of data points obtained by performing the first multi-way parallel point addition operation is greater than 8, two groups of first SIMD vector registers can continue to be used, each group stores half (for example, greater than 4 and less than or equal to 8) of the data points, and the point addition operation between the two groups of data points is performed; when the number of data points obtained by performing the first multi-way parallel point addition operation is less than or equal to 8, two groups of second SIMD vector registers can be further used, each group stores half (for example, 4) of the data points, and the point addition operation between the two groups of data points is performed.
[0125] In the embodiments of the present specification, each time a multi-way parallel point addition operation is performed, the number of data in the obtained calculation result can be halved, so the number of SIMD vector registers used to store the result of this execution can be halved. In theory, after performing a second multi-way parallel point addition operation, the number of data points is halved, and a SIMD instruction set with a smaller bit width and a corresponding SIMD vector register can be used to perform subsequent point addition operations. However, in actual applications, the bit width of the register and the corresponding instruction set is not the smaller the better. In practice, the register and the corresponding instruction set with a suitable bit width can be selected according to the comprehensive computing performance.
[0126] Furthermore, in the process of calculating the coordinate value of the target point based on the second multi-way parallel point addition operation, the second SIMD instruction set is used to perform a second multi-way parallel point addition operation corresponding to the second bit width of the second SIMD vector register on the coordinate value stored in the second SIMD vector register to obtain the coordinate value of the target point. Specifically, it may include: using the point addition instruction in the second SIMD instruction set to perform a second multi-way parallel point addition operation on the coordinate value stored in the second SIMD vector register to obtain the coordinate value of the first intermediate elliptic curve point; using the first rearrangement instruction in the second SIMD instruction set to perform a first rearrangement operation on the coordinate value of the first intermediate elliptic curve point to obtain the coordinate value of the first intermediate elliptic curve point after rearrangement; using the point addition instruction in the second SIMD instruction set to perform a second multi-way parallel point addition operation on the coordinate value stored in the second SIMD vector register to obtain the coordinate value of the first intermediate elliptic curve point after rearrangement. The coordinate value of the point and the coordinate value of the first intermediate elliptic curve point after the rearrangement are subjected to a second multi-way parallel point addition operation to obtain the coordinate value of the second intermediate elliptic curve point; the second rearrangement instruction in the second SIMD instruction set is used to perform a second rearrangement operation on the coordinate value of the second intermediate elliptic curve point to obtain the coordinate value of the second intermediate elliptic curve point after the rearrangement; the point addition instruction in the second SIMD instruction set is used to perform a second multi-way parallel point addition operation on the coordinate value of the second intermediate elliptic curve point and the coordinate value of the second intermediate elliptic curve point after the rearrangement to obtain the coordinate value of the target point Q; wherein the first rearrangement instruction includes a permute instruction, and the second rearrangement instruction includes a shuffle instruction; or, the first rearrangement instruction includes a shuffle instruction, and the second rearrangement instruction includes a permute instruction.
[0127] In addition, in an embodiment of the present specification, the multiple elliptic curve multiple points stored in the first SIMD vector register before the first point addition calculation can be affine coordinates, and after performing the first first multi-way parallel point addition operation, the calculation result obtained is the Jacobi coordinate. Subsequent operations are performed with Jacobi coordinate points, and the results are also Jacobi coordinate points. In an embodiment of the present specification, considering that each affine coordinate operation process involves an inversion operation, and the computational overhead of the inversion operation is large, therefore, in order to avoid the inversion operation with large computational overhead, the point operation can be preferably performed under Jacobi coordinates.
[0128] In practical applications, assuming that 52 bits are used as the base to represent two 256-bit values in the coordinates, since each value needs to be mapped in 5 vector registers, an elliptic curve point represented by affine coordinates can be mapped in 10 vector registers, and an elliptic curve point represented by Jacobi coordinates can be mapped in 15 vector registers.
[0129] To facilitate understanding of the process of performing parallel point addition operations based on SIMD in the embodiments of this specification, an example is given below.
[0130] Specific Example 1
[0131] When calculating the fixed base point scalar multiplication [k]G, taking the base w = 16 as an example, then [k]G=[k0]G+[k1·2 w ]G+…+[k l-1 2 w(l-1) ]G=[k0]G+[k1·2 16 ]G+…+[k 15 2 16·15 ]G=P0+P1+…+P 15 , the specified 16 elliptic curve multiple points P0 to P corresponding to the determined random parameter k can be obtained from the pre-calculated table corresponding to w=16. 15 to perform parallel dot addition operations.
[0132] like Figure 2 , shows an online calculation flow chart of fixed base point scalar multiplication in one embodiment of this specification.
[0133] In this specific example 1, since the dot addition operation of 16 points is calculated, in actual execution, an 8-way parallel operation can be performed once, and then three 4-way parallel operations can be performed. In actual application, the first SIMD instruction set can be selected as the AVX-512 instruction set, the first SIMD vector register can be a ZMM register, and 512-bit wide data can be operated; the second SIMD instruction set can be selected as the AVX2 instruction set, and the second SIMD vector register can be a YMM register, which can operate 256-bit wide data.
[0134] When calculating online, you need to look up the table to get the values from P0 to P 15 The value of and calculate P0+P1+…+P 15 =[k]G.
[0135] First, P0, P1, ..., P7 can be stored in the first set of ZMM registers, and P8, P9, ..., P 15 Stored in the second group of ZMM registers; then, the AVX-512 instruction set can be used to perform an 8-way parallel point addition operation, and the point addition results are Q0 = P0 + P8, Q1 = P1 + P9, ..., Q7 = P7 + P 15 And store the point addition results Q0, Q1, ..., Q7 in a set of ZMM registers. 15 For affine coordinates, P0, P1, ..., P7 can be stored in 10 ZMM registers, and P8, P9, ..., P 15 The 8-way parallel point addition operation is specifically a point addition operation between affine coordinates and affine coordinates. Since the point addition results Q0, Q1, ..., Q7 are Jacobian coordinates, the point addition results Q0, Q1, ..., Q7 can be stored in 15 ZMM registers.
[0136] Then, Q0, Q1, ..., Q7 can be extracted from the ZMM register into the YMM register. Specifically, Q0, Q1, Q2, Q3 can be extracted from the ZMM register into the first group of YMM registers, and Q4, Q5, Q6, Q7 can be extracted from the ZMM register into the second group of YMM registers. For example, the AVX512 instruction _mm512_extracti64x4_epi64 can be used to extract the high 256-bit part and the low 256-bit part of the 512-bit register respectively; then, the AVX2 instruction set can be used to perform a 4-way parallel point addition operation, and the point addition results are recorded as R0=Q0+Q4, R1=Q1+Q5, R2=Q2+Q6, R3=Q3+Q7, and the point addition results R0, R1, R2, R3 are stored in a group of YMM registers. Among them, since Q0, Q1, ..., Q7 are Jacobian coordinates, in fact, Q0, Q1, Q2, Q3 can be extracted into 15 YMM registers, and Q4, Q5, Q6, Q7 can be extracted into another 15 YMM registers, and the 4-way parallel point addition operation performed is specifically the point addition operation of Jacobian coordinates and Jacobian coordinates; and since the point addition results R0, R1, R2, R3 are Jacobian coordinates, the point addition results R0, R1, R2, R3 can be stored in 15 YMM registers.
[0137] Then, the permute instruction of the AVX2 instruction set can be used. Optionally, (R0, R1, R2, R3) stored in a set of YMM registers can be rearranged into (R2, R3, R0, R1), and then the AVX2 instruction set is used to perform a 4-way parallel point addition operation. The point addition result is S0 = R0 + R2, S1 = R1 + R3, which is stored in a set of YMM registers. Alternatively, (R0, R1, R2, R3) stored in a set of YMM registers can be rearranged into (R3, R2, R1, R0), and then the AVX2 instruction set is used to perform a 4-way parallel point addition operation. The point addition result is S0 = R0 + R3, S1 = R1 + R2, which is stored in a set of YMM registers. Among them, since R0, R1, R2, and R3 are Jacobian coordinates, the 4-way parallel point addition operation performed is specifically a point addition operation of Jacobian coordinates and Jacobian coordinates; and since the point addition results S0 and S1 are Jacobian coordinates, S0 and S1 can be stored in 15 YMM registers.
[0138] Then, the shuffle instruction of the AVX2 instruction set can be used to replace (S0, S1, S0, S1) stored in a set of YMM registers with (S1, S0, S1, S0), and then the AVX2 instruction set is used to perform a 4-way parallel point addition operation, and the point addition result is [k]G = S0 + S1. Among them, since S0 and S1 are Jacobian coordinates, the 4-way parallel point addition operation performed is specifically a point addition operation of Jacobian coordinates and Jacobian coordinates.
[0139] In the above specific example 1, in the case of P0 to P 15 After performing an 8-way parallel point addition operation to obtain Q0, Q1, ..., Q7, theoretically, in subsequent steps, the 8-way parallel computing strategy can continue to be used. For example, Q = (Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7) can be rearranged to Q' = (Q4, Q5, Q6, Q7, Q0, Q1, Q2, Q3), and the AVX-512 instruction set is called to perform the 8-way parallel point addition operation again to calculate Q+Q' = (Q0+Q4, Q1+Q5, Q2+Q6, Q3+Q7, Q4+Q0, Q5+Q1, Q6+Q2, Q7+Q3). However, in the embodiments of the present specification, after obtaining Q0, Q1, ..., Q7, the subsequent operations are performed by switching to the AVX2 instruction set with a smaller bit width and the corresponding YMM registers, which can reduce repeated operations to a certain extent and has better performance than continuing to use the AVX-512 instruction set.
[0140] In the above specific example 1, P0, P1, ..., P7 and P8, P9, ..., P 15 The process of summing up to obtain Q0, Q1, ..., Q7 is the process of summing up the affine coordinates with the affine coordinates to obtain the Jacobian coordinates, and thereafter, the Jacobian coordinates are used to perform point operations. In the embodiments of this specification, considering that in the operation of affine coordinate points, each time an inversion operation is involved, and the inversion operation will lead to a large computational overhead, therefore, except for the first point addition operation using the sum of the affine coordinates with the affine coordinates, the subsequent summations all use the Jacobian coordinates, which can reduce the computational overhead of the fixed base point scalar multiplication operation process, thereby improving the efficiency of digital signatures.
[0141] In addition, in the calculation process of the fixed base point scalar multiplication in the above specific example 1, in the process of calculating [k]G based on R0, R1, R2, and R3, optionally, shuffle rearrangement and summation may be performed first, and then permute rearrangement and summation may be performed. Specifically, the following solutions are included.
[0142] First, the shuffle instruction of the AVX2 instruction set can be used to replace (R0, R1, R2, R3) stored in a group of YMM registers with (R1, R0, R3, R2), and then the AVX2 instruction set is used to perform a 4-way parallel point addition operation, and the point addition results are recorded as S0 = R0 + R1, S1 = R2 + R3, which are stored in a group of YMM registers. Among them, since R0, R1, R2, R3 are Jacobian coordinates, the 4-way parallel point addition operation performed is specifically a point addition operation of Jacobian coordinates and Jacobian coordinates; and since the point addition results S0 and S1 are recorded as Jacobian coordinates, S0 and S1 can be stored in 15 YMM registers.
[0143] Then, the permute instruction of the AVX2 instruction set can be used to rearrange (S0, S0, S1, S1) stored in a set of YMM registers into (S1, S1, S0, S0), and then the AVX2 instruction set is used to perform a 4-way parallel point addition operation, and the point addition result is [k]G = S0 + S1. Among them, since S0 and S1 are Jacobian coordinates, the 4-way parallel point addition operation performed is specifically a point addition operation of Jacobian coordinates and Jacobian coordinates.
[0144] Specific Example 2
[0145] When calculating the fixed base point scalar multiplication [k]G, taking the base w = 8 as an example, then [k]G=[k0]G+[k1·2 w ]G+…+[k l-1 2 w(l-1) ]G=[k0]G+[k1·2 8 ]G+…+[k 31 2 8·31 ]G=P0+P1+…+P 31 , the specified 32 elliptic curve multiple points P0 to P corresponding to the determined random parameter k can be obtained from the pre-calculated table corresponding to w=8 31 to perform parallel dot addition operations.
[0146] like Figure 3 , shows an online calculation flow chart of fixed base point scalar multiplication in another embodiment of this specification.
[0147] In this specific example 2, due to the calculation of the point addition operation of 32 points, the number of pre-calculated elliptic curve multiple points that can be obtained from the pre-calculation table is 32, and accordingly, the number of intermediate elliptic curve points obtained after a first multi-way parallel point addition operation is 16; in this case, assuming that the preset number is 8, it is necessary to perform the first multi-way parallel point addition operation again, so that the number of intermediate elliptic curve points is reduced to 8. In actual application, the first SIMD instruction set can be selected as the AVX-512 instruction set, the first SIMD vector register is the ZMM register, and 512-bit wide data can be operated; the second SIMD instruction set is the AVX2 instruction set, and the second SIMD vector register is the YMM register, which can operate 256-bit wide data; when calculating the point addition operation of 32 points, two 8-way parallel operations can be performed first, and then three 4-way parallel operations can be performed.
[0148] When calculating online, you can look up the table to get P0 to P 31 The value of and calculate P0+P1+…+P 31 =[k]G.
[0149] First, P0, P1, ..., P7 can be stored in the first set of ZMM registers, and P8, P9, ..., P 15 Stored in the second group of ZMM registers; then, the AVX-512 instruction set can be used to perform an 8-way parallel point addition operation, and the point addition results are Q0 = P0 + P8, Q1 = P1 + P9, ..., Q7 = P7 + P 15 And store the point addition results Q0, Q1, ..., Q7 in a set of ZMM registers. 15 For affine coordinates, P0, P1, ..., P7 can be stored in 10 ZMM registers, and P8, P9, ..., P 15 The 8-way parallel point addition operation is specifically a point addition operation between affine coordinates and affine coordinates. Since the point addition results Q0, Q1, ..., Q7 are Jacobian coordinates, the point addition results Q0, Q1, ..., Q7 can be stored in 15 ZMM registers.
[0150] Similarly, P 16 ,P 17 ,…,P 23 Stored in the third group of ZMM registers, P 24 ,P 25 ,…,P 31 Stored in the fourth group of ZMM registers; then, the AVX-512 instruction set can be used to perform an 8-way parallel point addition operation, and the point addition result is recorded as Q8=P8+P 16 ,Q9=P9+P 17 ,…,Q15 =P 15 +P 23 , and add the points to the result Q8, Q9, ..., Q 15 Stored in a set of ZMM registers. 16 ,P 17 ,…,P 31 As affine coordinates, P can be 16 ,P 17 ,…,P 23 Store in 10 ZMM registers, and 24 ,P 25 ,…,P 31 The 8-way parallel point addition operation is specifically the point addition operation of the affine coordinates and the affine coordinates; and since the point addition results Q8, Q9, ..., Q 15 For Jacobian coordinates, the point addition results Q8, Q9, …, Q15 can be stored in 15 ZMM registers.
[0151] Then, for Q0, Q1, ..., Q7 and Q8, Q9, ..., Q 15 , we can use the AVX-512 instruction set to perform another 8-way parallel point addition operation, and record the point addition results as R0 = Q0 + Q8, R1 = Q1 + Q9, ..., R7 = Q7 + Q 15 The point addition results R0, R1, ..., R7 are stored in a set of ZMM registers. The 8-way parallel point addition operation is specifically a point addition operation of affine coordinates and affine coordinates, and the obtained R0, R1, ..., R7 are Jacobian coordinates, which are stored in 15 ZMM registers.
[0152] Then, R0, R1, ..., R7 can be extracted from the ZMM register to the YMM register. Specifically, R0, R1, R2, R3 can be extracted from the ZMM register to the first group of YMM registers, and R4, R5, R6, R7 can be extracted from the ZMM register to the second group of YMM registers. For example, the AVX512 instruction _mm512_extracti64x4_epi64 can be used to extract the high 256-bit part and the low 256-bit part of the 512-bit register respectively; then, the AVX2 instruction set can be used to perform a 4-way parallel point addition operation, and the point addition results are recorded as S0=R0+R4, S1=R1+R5, S2=R2+R6, S3=R3+R7, and the point addition results S0, S1, S2, S3 are stored in a group of YMM registers. The 4-way parallel point addition operation performed is specifically a point addition operation of Jacobian coordinates and Jacobian coordinates, and the point addition results S0, S1, S2, S3 are Jacobian coordinates, which can be stored in 15 YMM registers.
[0153] Then, the permute instruction of the AVX2 instruction set can be used. Optionally, (S0, S1, S2, S3) stored in a set of YMM registers can be rearranged to (S2, S3, S0, S1), and then the AVX2 instruction set is used to perform a 4-way parallel point addition operation. The point addition results are recorded as T0 = S0 + S2, T1 = S1 + S3, and stored in a set of YMM registers. Or optionally, (S0, S1, S2, S3) stored in a set of YMM registers can be rearranged to (S3, S2, S1, S0), and then the AVX2 instruction set is used to perform a 4-way parallel point addition operation. The point addition results are recorded as T0 = S0 + S3, T1 = S1 + S2, and stored in a set of YMM registers. The 4-way parallel point addition operation performed is specifically a point addition operation of Jacobian coordinates and Jacobian coordinates, and the point addition results T0 and T1 are Jacobian coordinates, which can be stored in 15 YMM registers.
[0154] Then, the shuffle instruction of the AVX2 instruction set can be used to replace (T0, T1, T0, T1) stored in a group of YMM registers with (T1, T0, T1, T0), and then the AVX2 instruction set is used to perform a 4-way parallel point addition operation, and the point addition result is [k]G = T0 + T1. The 4-way parallel point addition operation performed is specifically a point addition operation of Jacobian coordinates and Jacobian coordinates.
[0155] Similar to the above-mentioned specific example 1, in the calculation process of the fixed base point scalar multiplication of specific example 2, in the process of calculating [k]G based on S0, S1, S2, S3, optionally, shuffle rearrangement and summation may be performed first, and then permute rearrangement and summation may be performed. Specifically, the following schemes are included.
[0156] First, the shuffle instruction of the AVX2 instruction set can be used to replace (S0, S1, S2, S3) stored in a group of YMM registers with (S1, S0, S3, S2), and then the AVX2 instruction set is used to perform a 4-way parallel point addition operation, and the point addition results are recorded as T0 = S0 + S1, T1 = S2 + S3, which are stored in a group of YMM registers. Among them, since S0, S1, S2, S3 are Jacobian coordinates, the 4-way parallel point addition operation performed is specifically a point addition operation of Jacobian coordinates and Jacobian coordinates; and since the point addition results T0 and T1 are recorded as Jacobian coordinates, T0 and T1 can be stored in 15 YMM registers.
[0157] Then, the permute instruction of the AVX2 instruction set can be used to rearrange (T0, T0, T1, T1) stored in a group of YMM registers into (T1, T1, T0, T0), and then the AVX2 instruction set is used to perform a 4-way parallel point addition operation, and the point addition result is [k]G = T0 + T1. The 4-way parallel point addition operation performed is specifically a point addition operation of Jacobian coordinates and Jacobian coordinates.
[0158] In the practical application of the scheme of the embodiment of this specification, the base w can not only take the value of 16 or 8, but also take other values. Specifically, other values that can divide 256 can be selected, such as 2, 4, 32, etc. The specific value of the base w is not limited in the embodiment of the present application. When w takes different bases, firstly, the data in the pre-calculation table is different and the size is different from the calculation table; secondly, the number of times the point addition calculation is performed during online calculation is different; thirdly, due to the different number of times the point addition calculation is performed, the number of times the first SIMD instruction set such as AVX-512 is called to perform 8-way parallel point addition operations is different. In practical application, regardless of the value of the base w, after performing one or more 8-way parallel point addition operations, 8 Jacobian coordinate points can be obtained and stored in a second bit-width register such as ZMM. Subsequently, a 4-way parallel operation is performed by calling a second SIMD instruction set such as AVX2 to obtain the calculation result of [k]G.
[0159] Based on the scheme of the embodiment of this specification, in the process of digital signature, for the fixed base point scalar multiplication operation, first, the pre-calculation technology is used to convert the online point multiplication operation into an online point addition operation, and the SIMD multi-way parallel method is used when performing the point addition operation online, and the AVX-512 instruction set and the AVX2 instruction set are used successively to implement it. Specifically, the 8-way operation is implemented based on the AVX-512 instruction set, and then the 4-way operation is implemented based on the AVX2 instruction set, which greatly improves the data processing efficiency. For example, in the case of pre-calculation, when w=16, the calculation of [k]G only requires 15 point additions, and the calculation overhead during actual execution can be only one 8-way parallel point addition operation and three 4-way parallel point addition operations.
[0160] Based on at least some embodiments of the present specification, in the digital signature process based on SM2, for the fixed-base point scalar multiplication operations involved therein, the AVX512-IFMA instruction set is used to implement the underlying prime field basic operations, and the AVX-512 instruction set and the AVX2 instruction set are used to implement the point addition operations between the upper-level elliptic curve points. On the one hand, the number of registers used is reduced, and on the other hand, the FMA multiplication-addition instructions with lower latency are used to further improve the operational efficiency of the fixed-base point scalar multiplication.
[0161] Based on at least some embodiments of the present specification, in the SM2-based digital signature process, for the fixed-base scalar multiplication operation involved therein, the computational overhead of the fixed-base scalar multiplication is only one or more 8-way parallel point addition operations and three 4-way parallel point addition operations by using the pre-calculation method and SIMD parallelization technology. Performance testing was carried out on a Platinum 8369B (2-core, 2.7GHz) processor. The experimental results show that when w=16, the throughput of the fixed-base-point scalar multiplication implemented based on the embodiment of this specification reaches 721412.24 times / second, while the throughput implemented by the OpenSSL open source library is 3102.9 times / second, and the throughput implemented by the ipp-crypto open source library is 19300.9 times / second. It can be seen that the implementation performance based on the embodiment of this specification is 232 times that of OpenSSL and 50 times that of ipp-crypto, respectively.
[0162] The various technical features in the above embodiments can be combined arbitrarily as long as there is no conflict or contradiction between the combinations of features. However, due to space limitations, they are not described one by one. Therefore, any combination of the various technical features in the above embodiments also falls within the scope of this specification.
[0163] According to the above description, the present specification provides a flowchart of a method for generating a digital signature in an actual application scenario, as shown in FIG. Figure 4 shown.
[0164] First, the key generation algorithm generates a public key and a private key for user A, where the private key is d A , the public key is P A =[d A ]G. Then, in the signature generation algorithm, user A uses private key d A Run the signature generation algorithm, input the elliptic curve parameters (including the base point G of the elliptic curve and the order n of the base point), the identifier Z of user A A , message to be signed M, public key P A and private key d A , output message M and its digital signature information (r, s), the process of generating digital signature is as follows Figure 4 shown.
[0165] like Figure 4 As shown, step 1 and step 2: before the digital signature is generated, the user A's identifier Z can be hashed using a cryptographic hashing algorithm. A Compress it with the message M to be signed to get the hash value e.
[0166] Step 3: Generate a random number k∈[1,n-1].
[0167] Step 4: Calculate the target elliptic curve point (x1, y1) = [k] G. Specifically, the pre-calculation technology and SIMD multi-path parallel technology provided in the embodiments of this specification can be used to calculate the result of the fixed base point scalar multiplication [k] G to improve the calculation efficiency of step 4.
[0168] Step 5: Calculate the first signature information r=(e+x1)mod n, and determine whether the first signature information r satisfies r=0 or r+k=n; if so, return to step 3 and regenerate the random number k; if not, execute step 6.
[0169] Step 6: Calculate the second signature information s = (1 + d A ) -1 ·(kr·d A )mod n, and determine whether the second signature information s is 0; if so, return to step 3 and regenerate the random number k; if not, execute step 7.
[0170] Step 7: Determine that the digital signature includes the first signature information r calculated in step 5 and the second signature information s calculated in step 6.
[0171] In this way, the digital signature information (r, s) corresponding to the message M to be signed can be obtained.
[0172] Based on the same idea, the embodiments of this specification also provide a method for verifying a digital signature corresponding to the above-mentioned method for generating a digital signature.
[0173] Figure 5 A flowchart of a method for verifying a digital signature provided in an embodiment of this specification.
[0174] From the program perspective, the execution subject of the process can be a program installed on an application server or an application terminal. It can be understood that the method can be executed by any device, equipment, platform, or device cluster with computing and processing capabilities.
[0175] like Figure 5 As shown, the process may include the following steps:
[0176] Step 502: Obtain a message to be verified, digital signature information corresponding to the message to be verified, elliptic curve parameters used to generate the digital signature information, and a public key corresponding to a private key used to generate the digital signature information; the digital signature information includes first signature information and second signature information; the elliptic curve parameters include coordinate values of a base point of the elliptic curve and the order of the base point.
[0177] In the process of verifying digital signatures based on the elliptic curve algorithm, according to the principle of the elliptic curve algorithm, it is necessary to calculate the point multiplication operation of the second signature information s' in the digital signature information (r', s') and the coordinate value of the elliptic curve base point G in the elliptic curve parameters, that is, it is necessary to calculate [s']G to obtain the coordinate value of a target point Q' on the elliptic curve. In practical applications, the target point calculated based on the random parameter k is actually a random point on the elliptic curve corresponding to the preset elliptic curve parameter. It is recorded as a "target point" only for the convenience of description. The word "target" does not actually limit the point on the elliptic curve.
[0178] Further, in the embodiments of the present specification, corresponding to the method of generating a digital signature above, the method of verifying a digital signature specifically applies the SM2 digital signature algorithm. In the SM2 digital signature algorithm, the base point G of the SM2 elliptic curve is a fixed parameter. Therefore, when the target point of the elliptic curve is calculated according to [s′]G, the calculation process of [s′]G is actually a fixed base point scalar multiplication operation. In the embodiments of the present specification, considering that the consumption of computing resources is large if the scalar multiplication operation is performed in the process of executing the signature online, the scalar multiplication operation of the fixed base point can be converted into a scalar addition operation, and a pre-calculation technique is adopted, that is, the values of each item that may participate in the scalar addition operation are pre-calculated offline and stored in a pre-calculation table. When the operation is performed online, only a few point addition operations need to be performed, which greatly reduces the amount of calculation of the online operation and improves the calculation rate of [s′]G when calculating the coordinate value of the target point, thereby improving the efficiency of verifying the digital signature.
[0179] Step 504: Determine a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve according to the coordinate value of the base point of the elliptic curve and the second signature information.
[0180] Further, in step 504, determining a plurality of elliptic curve multiple points P′ for calculating the coordinate value of the target point Q′ of the elliptic curve according to the coordinate value of the base point G of the elliptic curve and the second signature information s′ may specifically include: obtaining a preset base w; converting the second signature information s′ into a base expression based on the base w. Based on the base expression, the point multiplication operation between the second signature information s′ and the coordinate value of the base point G is converted into a point addition operation between multiple elliptic curve multiple points P′, and multiple elliptic curve multiple points P′ used to calculate the coordinate value of the target point Q′ of the elliptic curve are determined.
[0181] In the embodiments of this specification, the elliptic curve multiple point can be [s′ i 2 wi]G represents; where G represents the coordinate value of the base point of the elliptic curve, w represents the base number, and i ranges from 0 to integer, s′ i The value is 0 to 2 w An integer of -1.
[0182] Specifically, when the base number is w, the second signature information s′ can be expressed as w Represent it in base and get the base expression in, 0≤s′ i ≤2 w -1. On this basis, the calculation logic of [s′]G is the same as the calculation logic of [k]G in the process of generating a digital signature, and reference can be made to the description of the calculation logic of the fixed base point scalar multiplication of [k]G above.
[0183] Step 506: Obtain the coordinate values of the multiple elliptic curve multiple points from the pre-calculated table.
[0184] In an embodiment of the present specification, before obtaining the coordinate values of the multiple elliptic curve multiple points P′ from the pre-calculated table, the method may further include: pre-calculating the coordinate values of the elliptic curve multiple points corresponding to the preset base w; the coordinate values of the elliptic curve multiple points are calculated by the multiple point parameter s′ i 2 wi The coordinate value of the multiple point of the elliptic curve is determined by multiplying the coordinate value of the base point G; the multiple point parameter is determined based on the base w; the coordinate value of the multiple point of the elliptic curve is stored in the pre-calculated table. When calculating offline, the calculation logic of the pre-calculated table is consistent with the calculation logic of the pre-calculated table above, and the relevant description above can be referred to.
[0185] Step 508: Store the coordinate values of the multiple elliptic curve multiple points into a group of SIMD vector registers, and perform point addition operations on the data branches in the multiple data channels of the SIMD vector registers in parallel to obtain a first intermediate value for calculating the coordinate value of the target point; the data branches are obtained by dividing the coordinate values of the multiple points of the elliptic curve according to a preset data division bit width; a SIMD vector register includes multiple data channels, one data branch is stored in one data channel, and data branches of different coordinate values of the multiple points of the elliptic curve are stored in different data channels.
[0186] When step 508 is actually executed, for each coordinate component corresponding to the coordinate point, multiple data branches can be obtained by segmentation according to the preset data segmentation bit width, and the multiple data branches obtained by segmentation are respectively stored in the corresponding data channels of different vector registers in a set of vector registers. The coordinate value in step 508 can specifically include one or more coordinate components of the corresponding coordinate point. The data branches stored in each data channel can actually be used as operands when the SIMD instruction set performs operations on the data in the SIMD vector register.
[0187] In an embodiment of the present specification, each of the coordinate values may include multiple data branches; the i-th data branch of each of the coordinate values may be stored in the i-th SIMD vector register in the set of SIMD vector registers; wherein i may be a positive integer from 1 to M; and M may be the number of data branches determined based on the data segmentation bit width and the data bit length. Each SIMD vector register may include multiple data channels; the data branch of the coordinate value of the j-th elliptic curve multiple point in the multiple elliptic curve multiple points may be stored in the j-th data channel of the corresponding SIMD vector register; wherein j is a positive integer from 1 to N, and N is the number of data channels determined based on the data channel width and the bit width of the SIMD vector register. The explanations of the terms such as data bit length, data segmentation bit width, and number of data branches are consistent with the corresponding concepts in the method for generating a digital signature, and may refer to the above description.
[0188] Step 510: Determine a verification result of the message to be verified based on the first intermediate value, the order of the base point, the digital signature information and the public key.
[0189] When verifying the digital signature, the first intermediate value [s′]G determined in step 508, the order n of the base point, the digital signature information (r′, s′) and the public key P A , determine the verification result of the message M′ to be verified, which may specifically include: according to the order n of the base point, the digital signature information (r′, s′) and the public key P A , obtain the second intermediate value [(r′+s′)mod n]P used to calculate the coordinate value (x1′, y1′) of the target point Q′ A Then, based on the first intermediate value [s′]G and the second intermediate value [(r′+s′) mod n]P A , calculate the coordinate value (x1′, y1′) of the target point Q′; then, determine the verification result of the message M′ to be verified based on the coordinate value x1′ of the target point Q′.
[0190] Further, the determining the verification result of the message M′ to be verified based on the coordinate value x1′ of the target point Q′ may specifically include: calculating the first signature verification information R (i.e., R=(e′+x′1) mod n) based on the message M′ to be verified, the coordinate value x1′ of the target point Q′ and the order n of the base point; then, verifying whether the first signature verification information R is the same as the first signature information r′, to obtain a first verification result; if the first verification result is yes, determining that the verification result of the message M′ to be verified is passed; if the first verification result is no, determining that the verification result of the message M′ to be verified is failed.
[0191] It should be understood that in the methods described in one or more embodiments of this specification, the order of some steps can be adjusted according to actual needs, or some steps can be omitted.
[0192] Figure 5 The method in the paper combines the pre-computation technology with the SIMD parallelization technology in the process of verifying the numerical signature, focusing on the fixed base point scalar multiplication of the elliptic curve target point in the elliptic curve digital signature verification method, thereby reducing the online computing overhead of the fixed base point scalar multiplication, improving the computing efficiency of the elliptic curve target point, and thus improving the digital signature verification efficiency.
[0193] based on Figure 5 The method, the embodiments of this specification also provide some specific implementation methods of the method, which are described below.
[0194] In one or more embodiments of the present specification, before determining the multiple elliptic curve multiple points P′ for calculating the coordinate value of the target point Q′ of the elliptic curve based on the coordinate value of the base point G of the elliptic curve and the second signature information s′, it may also include: verifying whether the first signature information r′ and the second signature information s′ are both positive integers of order n less than the base point, and obtaining a second verification result, for example, verifying whether r′∈[1, n-1] and s′∈[1, n-1] hold; if the second verification result is yes, executing a subsequent verification process, that is, determining the multiple elliptic curve multiple points P′ for calculating the coordinate value of the target point Q′ of the elliptic curve based on the coordinate value of the base point G of the elliptic curve and the second signature information s′; if the second verification result is no, determining the verification result of the message M′ to be verified as verification failure, and no longer executing the subsequent verification process.
[0195] In one or more embodiments of the present specification, after converting the online point multiplication operation used in the process of verifying the digital signature into an online point addition operation based on the pre-computation technology, the point addition operation is further performed using SIMD parallelization technology. Furthermore, in the process of SIMD parallelization calculation, in order to maximize the use of the CPU's computing performance and optimize the computing efficiency, the point addition operation can be implemented in combination with SIMD vector registers of different bit widths and SIMD instruction sets in the SIMD parallelization calculation process.
[0196] Optionally, in step 508, the coordinate values of the multiple elliptic curve multiple points P′ are stored in a group of SIMD vector registers, and point addition operations are performed in parallel on data branches in multiple data channels of the SIMD vector registers to obtain a first intermediate value [s′]G for calculating the coordinate value (x1′, y1′) of the target point Q′, which may specifically include the following steps.
[0197] First, the coordinate values of the multiple elliptic curve multiple points are stored in a first SIMD vector register, and a first SIMD instruction set is used to perform a first multi-way parallel point addition operation corresponding to a first bit width of the first SIMD vector register on the coordinate values stored in the first SIMD vector register to obtain coordinate values of multiple intermediate elliptic curve points; the first SIMD instruction set is used to operate data of the first bit width; and a first parallel operation number of the first multi-way parallel point addition operation is a first data channel number determined based on the data channel width and the first bit width of the first SIMD vector register.
[0198] Then, the coordinate values of the multiple intermediate elliptic curve points are stored in a second SIMD vector register, and a second SIMD instruction set is used to perform a second multi-way parallel point addition operation corresponding to the second bit width of the second SIMD vector register on the coordinate values stored in the second SIMD vector register to obtain the coordinate value of the target point; the second bit width is smaller than the first bit width; the second SIMD instruction set is used to operate data of the second bit width; and the second parallel operation number of the second multi-way parallel point addition operation is the second data channel number determined based on the data channel width and the second bit width of the second SIMD vector register.
[0199] Further, storing the coordinate values of the multiple intermediate elliptic curve points in the second SIMD vector register may specifically include: determining whether the number of the multiple intermediate elliptic curve points is less than or equal to a preset number threshold (wherein the preset number threshold is determined according to the number of the second data channels), and obtaining a determination result; if the determination result is yes, storing the coordinate values of the multiple intermediate elliptic curve points in the second SIMD vector register; if the determination result is no, performing the first multi-way parallel point addition operation again for the coordinate values of the multiple intermediate elliptic curve points, until the number of intermediate elliptic curve points obtained is less than or equal to the preset threshold. Wherein, the preset number threshold may be twice the number of the second data channels.
[0200] Furthermore, in the process of calculating the coordinate value of the target point based on the second multi-way parallel point addition operation, the second SIMD instruction set is used to perform a second multi-way parallel point addition operation corresponding to the second bit width of the second SIMD vector register on the coordinate value stored in the second SIMD vector register to obtain the coordinate value of the target point. Specifically, it may include: using the point addition instruction in the second SIMD instruction set to perform a second multi-way parallel point addition operation on the coordinate value stored in the second SIMD vector register to obtain the coordinate value of the first intermediate elliptic curve point; using the first rearrangement instruction in the second SIMD instruction set to perform a first rearrangement operation on the coordinate value of the first intermediate elliptic curve point to obtain the coordinate value of the first intermediate elliptic curve point after rearrangement; using the point addition instruction in the second SIMD instruction set to perform a second multi-way parallel point addition operation on the coordinate value stored in the second SIMD vector register to obtain the coordinate value of the first intermediate elliptic curve point after rearrangement. The coordinate value of the point and the coordinate value of the first intermediate elliptic curve point after the rearrangement are subjected to a second multi-way parallel point addition operation to obtain the coordinate value of the second intermediate elliptic curve point; the second rearrangement instruction in the second SIMD instruction set is used to perform a second rearrangement operation on the coordinate value of the second intermediate elliptic curve point to obtain the coordinate value of the second intermediate elliptic curve point after the rearrangement; the point addition instruction in the second SIMD instruction set is used to perform a second multi-way parallel point addition operation on the coordinate value of the second intermediate elliptic curve point and the coordinate value of the second intermediate elliptic curve point after the rearrangement to obtain the coordinate value of the target point Q′; wherein the first rearrangement instruction includes a permute instruction, and the second rearrangement instruction includes a shuffle instruction; or, the first rearrangement instruction includes a shuffle instruction, and the second rearrangement instruction includes a permute instruction.
[0201] In the embodiments of the present specification, the concept of performing SIMD multi-way parallel operations in the process of verifying a digital signature is consistent with the concept of performing SIMD multi-way parallel operations in the process of generating a digital signature. Therefore, the calculation method of the fixed base point scalar multiplication [s′]G in the process of verifying the digital signature can refer to the calculation method of [k]G in the above text, and after conversion to the point addition operation, the specific implementation method of the point addition operation can also refer to the relevant description in the above text.
[0202] The various technical features in the above embodiments can be combined arbitrarily as long as there is no conflict or contradiction between the combinations of features. However, due to space limitations, they are not described one by one. Therefore, any combination of the various technical features in the above embodiments also falls within the scope of this specification.
[0203] According to the above description, the present specification provides a flowchart of a method for verifying a digital signature in an actual application scenario, as shown in FIG. Figure 6 shown.
[0204] In order to verify the received message M' and its digital signature information (r', s'), user B, as the verifier, runs the signature verification algorithm and inputs the elliptic curve parameters (including the base point G of the elliptic curve and the order n of the base point), the identifier Z of user A, and the signature of user A. A , the message to be verified M′ and the public key P A , output the result of whether the verification is passed, the process of the method for verifying the digital signature is as follows Figure 6 shown.
[0205] like Figure 6 As shown, step 1: check whether the first signature information r′ satisfies the preset condition. For example, check whether r′∈[1,n-1] is established; if so, execute step 2, if not, the verification fails.
[0206] Step 2: Check whether the second signature information s′ satisfies the preset conditions. For example, check whether s′∈[1,n-1] holds; if so, execute step 3; if not, the verification fails.
[0207] Steps 3 and 4: Use the same cryptographic hashing algorithm as used to generate the digital signature to encrypt user A's identity Z. A It is compressed with the message M′ to be verified to obtain the hash value e′.
[0208] Step 5: Based on the first signature information r′, the second signature information s′ and the order n of the elliptic curve base point, calculate the intermediate parameter t=(r′+s′) mod n, and determine whether the intermediate parameter t is zero; if not, execute step 6; if so, the verification fails.
[0209] Step 6: Calculate the coordinates of the target elliptic curve point Q′ (x′1, y′1) = [s′]G + [t]P A Specifically, the pre-calculation technology and SIMD multi-path parallel technology provided in the embodiments of this specification can be used to calculate the result of the fixed base point scalar multiplication [s′]G to improve the calculation efficiency of step 6.
[0210] Step 7: Calculate the digital signature verification information R = (e′+x′1) mod n, and verify whether the digital signature verification information R is the same as the first signature information r′. If so, the verification succeeds; if not, the verification fails.
[0211] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method.
[0212] Figure 7 The embodiments of this specification provide corresponding to Figure 1 A structural diagram of a device for generating a digital signature.
[0213] like Figure 7 As shown, the device may include:
[0214] The initial parameter acquisition module 702 is used to obtain the message to be signed and the preset elliptic curve parameters; the elliptic curve parameters include the coordinate value of the base point of the elliptic curve and the order of the base point;
[0215] A target point calculation module 704, configured to determine a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve according to the coordinate value of the base point and the order of the base point;
[0216] A pre-calculated value acquisition module 706, configured to acquire coordinate values of the multiple points of the elliptic curve from a pre-calculated table;
[0217] The parallel point addition module 708 is used to store the coordinate values of the multiple elliptic curve multiple points into a group of SIMD vector registers, and perform point addition operations on the data branches in multiple data channels of the SIMD vector registers in parallel to obtain the coordinate value of the target point; the data branches are obtained by dividing the coordinate values of the multiple points of the elliptic curve according to a preset data division bit width; one SIMD vector register includes multiple data channels, one data branch is stored in one data channel, and data branches of different coordinate values of the multiple points of the elliptic curve are stored in different data channels;
[0218] The digital signature information generating module 710 is used to generate first signature information corresponding to the message based on the message and the coordinate value of the target point.
[0219] based on Figure 7The present specification also provides some specific implementation schemes of the method, which are described below.
[0220] Optionally, the target point calculation module 704 is specifically used to: generate a random parameter whose order is smaller than the order of the base point according to the order of the base point; and determine a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve based on the random parameter and the coordinate value of the base point.
[0221] Optionally, determining a plurality of elliptic curve multiple points for calculating the coordinate value of a target point of an elliptic curve based on the random parameter and the coordinate value of the base point may specifically include: obtaining a preset base number; converting the random parameter into a base expression based on the base number; based on the base expression, converting a point multiplication operation between the random parameter and the coordinate value of the base point into a point addition operation between a plurality of elliptic curve multiple points, and determining a plurality of elliptic curve multiple points for calculating the coordinate value of a target point of an elliptic curve.
[0222] Optionally, the device for generating a digital signature is also used to, before obtaining the coordinate values of the multiple elliptic curve multiple points from the pre-calculated table: pre-calculate the coordinate values of the elliptic curve multiple points corresponding to the preset base number; the coordinate values of the elliptic curve multiple points are determined by the dot product of the multiple point parameters and the coordinate value of the base point; the multiple point parameters are determined based on the base number; and the coordinate values of the elliptic curve multiple points are stored in the pre-calculated table.
[0223] Optionally, each of the coordinate values includes multiple data branches; the i-th data branch of each of the coordinate values is stored in the i-th SIMD vector register in the group of SIMD vector registers; i is a positive integer from 1 to M; M is the number of data branches determined based on the data segmentation bit width and the data bit length. Each SIMD vector register includes multiple data channels; the data branch of the coordinate value of the j-th elliptic curve multiple point in the multiple elliptic curve multiple points is stored in the j-th data channel of the corresponding SIMD vector register; j is a positive integer from 1 to N, and N is the number of data channels determined based on the data channel width and the bit width of the SIMD vector register.
[0224] Optionally, the parallel point addition operation module 708 is specifically used to: store the coordinate values of the multiple elliptic curve multiple points in a first SIMD vector register; use a first SIMD instruction set to perform a first multi-way parallel point addition operation corresponding to the first bit width of the first SIMD vector register on the coordinate values stored in the first SIMD vector register to obtain the coordinate values of multiple intermediate elliptic curve points; the first SIMD instruction set is used to operate data of the first bit width; the first parallel operation number of the first multi-way parallel point addition operation is a first data channel number determined based on the data channel width and the first bit width of the first SIMD vector register; store the coordinate values of the multiple intermediate elliptic curve points in a second SIMD vector register; the second bit width is less than the first bit width; use a second SIMD instruction set to perform a second multi-way parallel point addition operation corresponding to the second bit width of the second SIMD vector register on the coordinate values stored in the second SIMD vector register to obtain the coordinate value of the target point; the second SIMD instruction set is used to operate data of the second bit width; the second parallel operation number of the second multi-way parallel point addition operation is a second data channel number determined based on the data channel width and the second bit width of the second SIMD vector register.
[0225] Optionally, storing the coordinate values of the multiple intermediate elliptic curve points in the second SIMD vector register may specifically include: determining whether the number of the multiple intermediate elliptic curve points is less than or equal to a preset number threshold, and obtaining a determination result; if the determination result is yes, storing the coordinate values of the multiple intermediate elliptic curve points in the second SIMD vector register; wherein the preset number threshold is determined based on the number of the second data channels.
[0226] Optionally, the using of the second SIMD instruction set to perform a second multi-way parallel point addition operation corresponding to the second bit width of the second SIMD vector register on the coordinate values stored in the second SIMD vector register to obtain the coordinate value of the target point may specifically include: using the point addition instruction in the second SIMD instruction set to perform a second multi-way parallel point addition operation on the coordinate values stored in the second SIMD vector register to obtain the coordinate value of the first intermediate elliptic curve point; using the first rearrangement instruction in the second SIMD instruction set to perform a first rearrangement operation on the coordinate value of the first intermediate elliptic curve point to obtain the coordinate value of the rearranged first intermediate elliptic curve point; using the point addition instruction in the second SIMD instruction set to perform a first rearrangement operation on the coordinate value of the first intermediate elliptic curve point and the rearranged first intermediate elliptic curve point. The coordinate value of an intermediate elliptic curve point is subjected to a second multi-way parallel point addition operation to obtain the coordinate value of the second intermediate elliptic curve point; the second shuffle instruction in the second SIMD instruction set is used to perform a second shuffle operation on the coordinate value of the second intermediate elliptic curve point to obtain the coordinate value of the rearranged second intermediate elliptic curve point; the point addition instruction in the second SIMD instruction set is used to perform a second multi-way parallel point addition operation on the coordinate value of the second intermediate elliptic curve point and the coordinate value of the rearranged second intermediate elliptic curve point to obtain the coordinate value of the target point; wherein the first shuffle instruction includes a permute instruction and the second shuffle instruction includes a shuffle instruction; or, the first shuffle instruction includes a shuffle instruction and the second shuffle instruction includes a permute instruction.
[0227] Optionally, the digital signature information generation module 710 may be specifically used to: generate a hash value of the message; and generate first signature information corresponding to the message based on the hash value, the coordinate value of the target point and the order of the base point.
[0228] Optionally, the digital signature information generation module 710 can also be specifically used to: generate second signature information corresponding to the message based on a digital signature key, the first signature information, the random parameter and the order of the base point; output the message and the digital signature information corresponding to the message; the digital signature information includes the first signature information and the second signature information.
[0229] It is understood that the above modules refer to computer programs or program segments for executing one or more specific functions. In addition, the distinction between the above modules does not mean that the actual program codes must also be separated.
[0230] The above is a schematic scheme of a device for generating a digital signature of this embodiment. It should be noted that the technical scheme of the device for generating a digital signature and the technical scheme of the method for generating a digital signature are of the same concept, and the details of the technical scheme of the device for generating a digital signature that are not described in detail can be found in the description of the technical scheme of the method for generating a digital signature.
[0231] Figure 8 The embodiments of this specification provide corresponding to Figure 5 A structural diagram of a device for verifying a digital signature.
[0232] like Figure 8 As shown, the device may include:
[0233] The initial information acquisition module 802 is used to acquire a message to be verified, digital signature information corresponding to the message to be verified, elliptic curve parameters used to generate the digital signature information, and a public key corresponding to a private key used to generate the digital signature information; the digital signature information includes first signature information and second signature information; the elliptic curve parameters include coordinate values of a base point of the elliptic curve and an order of the base point;
[0234] A target point calculation module 804, configured to determine a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve according to the coordinate value of the base point of the elliptic curve and the second signature information;
[0235] A pre-calculated value acquisition module 806 is used to acquire the coordinate values of the multiple points of the elliptic curve from a pre-calculated table;
[0236] The parallel point addition module 808 is used to store the coordinate values of the multiple elliptic curve multiple points into a group of SIMD vector registers, and perform point addition operations on the data branches in the multiple data channels of the SIMD vector registers in parallel to obtain a first intermediate value for calculating the coordinate value of the target point; the data branches are obtained by dividing the coordinate values of the multiple elliptic curve points according to a preset data division bit width; a SIMD vector register includes multiple data channels, one data channel stores one data branch, and data branches of different coordinate values of the multiple elliptic curve points are stored in different data channels;
[0237] The verification result determination module 810 is used to determine the verification result of the message to be verified based on the first intermediate value, the order of the base point, the digital signature information and the public key.
[0238] based on Figure 8 The present specification also provides some specific implementation schemes of the method, which are described below.
[0239] Optionally, the target point calculation module 804 is specifically used to: obtain a preset base number; convert the second signature information into a base number expression based on the base number; based on the base number expression, convert the point multiplication operation between the second signature information and the coordinate value of the base point into a point addition operation between multiple elliptic curve multiple points, and determine multiple elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve.
[0240] Optionally, the device for verifying a digital signature is further used to, before obtaining the coordinate values of the multiple elliptic curve multiple points from a pre-calculated table: pre-calculate the coordinate values of the elliptic curve multiple points corresponding to a preset base number; the coordinate values of the elliptic curve multiple points are determined by the dot product of a multiple point parameter and the coordinate value of the base point; the multiple point parameter is determined based on the base number; and the coordinate values of the elliptic curve multiple points are stored in the pre-calculated table.
[0241] Optionally, each of the coordinate values includes multiple data branches; the i-th data branch of each of the coordinate values is stored in the i-th SIMD vector register in the group of SIMD vector registers; i is a positive integer from 1 to M; M is the number of data branches determined based on the data segmentation bit width and the data bit length. Each SIMD vector register includes multiple data channels; the data branch of the coordinate value of the j-th elliptic curve multiple point in the multiple elliptic curve multiple points is stored in the j-th data channel of the corresponding SIMD vector register; j is a positive integer from 1 to N, and N is the number of data channels determined based on the data channel width and the bit width of the SIMD vector register.
[0242] Optionally, the parallel point addition module 808 is specifically used to: store the coordinate values of the multiple elliptic curve points in a first SIMD vector register; use a first SIMD instruction set to perform a first multi-way parallel point addition operation corresponding to the first bit width of the first SIMD vector register on the coordinate values stored in the first SIMD vector register to obtain the coordinate values of multiple intermediate elliptic curve points; the first SIMD instruction set is used to operate data of the first bit width; the first parallel operation number of the first multi-way parallel point addition operation is a first data channel number determined based on the data channel width and the first bit width of the first SIMD vector register; store the coordinate values of the multiple intermediate elliptic curve points in a second SIMD vector register; the second bit width is less than the first bit width; use a second SIMD instruction set to perform a second multi-way parallel point addition operation corresponding to the second bit width of the second SIMD vector register on the coordinate values stored in the second SIMD vector register to obtain the coordinate value of the target point; the second SIMD instruction set is used to operate data of the second bit width; the second parallel operation number of the second multi-way parallel point addition operation is a second data channel number determined based on the data channel width and the second bit width of the second SIMD vector register.
[0243] Optionally, storing the coordinate values of the multiple intermediate elliptic curve points in the second SIMD vector register may specifically include: determining whether the number of the multiple intermediate elliptic curve points is less than or equal to a preset number threshold, and obtaining a determination result; if the determination result is yes, storing the coordinate values of the multiple intermediate elliptic curve points in the second SIMD vector register; wherein the preset number threshold is determined based on the number of the second data channels.
[0244] Optionally, the using of the second SIMD instruction set to perform a second multi-way parallel point addition operation corresponding to the second bit width of the second SIMD vector register on the coordinate values stored in the second SIMD vector register to obtain the coordinate value of the target point may specifically include: using the point addition instruction in the second SIMD instruction set to perform a second multi-way parallel point addition operation on the coordinate values stored in the second SIMD vector register to obtain the coordinate value of the first intermediate elliptic curve point; using the first rearrangement instruction in the second SIMD instruction set to perform a first rearrangement operation on the coordinate value of the first intermediate elliptic curve point to obtain the coordinate value of the rearranged first intermediate elliptic curve point; using the point addition instruction in the second SIMD instruction set to perform a first rearrangement operation on the coordinate value of the first intermediate elliptic curve point and the rearranged first intermediate elliptic curve point. The coordinate value of an intermediate elliptic curve point is subjected to a second multi-way parallel point addition operation to obtain the coordinate value of the second intermediate elliptic curve point; the second shuffle instruction in the second SIMD instruction set is used to perform a second shuffle operation on the coordinate value of the second intermediate elliptic curve point to obtain the coordinate value of the rearranged second intermediate elliptic curve point; the point addition instruction in the second SIMD instruction set is used to perform a second multi-way parallel point addition operation on the coordinate value of the second intermediate elliptic curve point and the coordinate value of the rearranged second intermediate elliptic curve point to obtain the coordinate value of the target point; wherein the first shuffle instruction includes a permute instruction and the second shuffle instruction includes a shuffle instruction; or, the first shuffle instruction includes a shuffle instruction and the second shuffle instruction includes a permute instruction.
[0245] Optionally, the verification result determination module 810 can be specifically used to: obtain a second intermediate value for calculating the coordinate value of the target point according to the order of the base point, the digital signature information and the public key; calculate the coordinate value of the target point based on the first intermediate value and the second intermediate value; and determine the verification result of the message to be verified based on the coordinate value of the target point.
[0246] Optionally, determining the verification result of the message to be verified based on the coordinate value of the target point may specifically include: calculating first signature verification information based on the message to be verified, the coordinate value of the target point and the order of the base point; verifying whether the first signature verification information is the same as the first signature information to obtain a first verification result; if the first verification result is yes, determining that the verification result of the message to be verified is passed.
[0247] Optionally, the device for verifying a digital signature is also used to, before determining a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve according to the coordinate value of the base point of the elliptic curve and the second signature information, further include: verifying whether the first signature information and the second signature information are both positive integers less than the order of the base point to obtain a second verification result. The target point calculation module can be specifically used to: if the second verification result is yes, determine a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve according to the coordinate value of the base point of the elliptic curve and the second signature information.
[0248] It is understood that the above modules refer to computer programs or program segments for executing one or more specific functions. In addition, the distinction between the above modules does not mean that the actual program codes must also be separated.
[0249] The above is a schematic scheme of a device for verifying digital signatures in this embodiment. It should be noted that the technical scheme of the device for verifying digital signatures and the technical scheme of the method for verifying digital signatures described above are of the same concept, and the details of the technical scheme of the device for verifying digital signatures that are not described in detail can be found in the description of the technical scheme of the method for verifying digital signatures described above.
[0250] Fig. 9 The structure block diagram of a computing device 900 provided according to an embodiment of the present application is shown. The components of the computing device 900 include but are not limited to a memory 910 and a processor 920. The processor 920 is connected to the memory 910 via a bus 930, and the database 950 is used to store data.
[0251] The computing device 900 also includes an access device 940 that enables the computing device 900 to communicate via one or more networks 960. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 940 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0252] In one embodiment of the present application, the above components of the computing device 900 and Fig. 9 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig. 9 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.
[0253] The computing device 900 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 900 may also be a mobile or stationary server.
[0254] When the processor 920 executes the computer instructions, the steps of the method for generating a digital signature described in the embodiment of this specification are implemented.
[0255] Alternatively, when the processor 920 executes the computer instructions, the steps of the method for verifying a digital signature described in the embodiments of this specification are implemented.
[0256] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the method for generating a digital signature or the method for verifying a digital signature belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the method for generating a digital signature or the method for verifying a digital signature.
[0257] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the device and equipment embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments. The devices, equipment and methods provided in the embodiments of this specification correspond to each other, so the devices and equipment also have beneficial technical effects similar to the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the corresponding devices and equipment will not be repeated here.
[0258] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0259] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0260] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0261] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0262] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0263] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0264] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0265] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0266] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0267] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0268] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0269] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0270] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0271] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0272] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for generating a digital signature, comprising: Get the message to be signed and the preset elliptic curve parameters; The elliptic curve parameters include coordinate values of a base point of the elliptic curve and the order of the base point; Determine, according to the coordinate value of the base point and the order of the base point, a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve; Obtaining coordinate values of the multiple points of the elliptic curve from a pre-calculated table; The coordinate values of the multiple elliptic curve multiple points are stored in a group of SIMD vector registers, and point addition operations are performed in parallel on data branches in multiple data channels of the SIMD vector registers to obtain the coordinate value of the target point; the data branches are obtained by dividing the coordinate values of the multiple points of the elliptic curve according to a preset data division bit width; a SIMD vector register includes multiple data channels, one data channel stores one data branch, and data branches of different coordinate values of the multiple points of the elliptic curve are stored in different data channels; Based on the message and the coordinate value of the target point, first signature information corresponding to the message is generated.
2. The method according to claim 1, wherein determining a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve according to the coordinate value of the base point and the order of the base point comprises: According to the order of the base point, generating a random parameter with an order smaller than the base point; Based on the random parameter and the coordinate value of the base point, a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve are determined.
3. The method according to claim 2, wherein determining a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve based on the random parameter and the coordinate value of the base point comprises: Get the preset base number; Converting the random parameter into a base expression based on the base number; Based on the base expression, the point multiplication operation between the random parameter and the coordinate value of the base point is converted into a point addition operation between a plurality of elliptic curve multiple points, and a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve are determined.
4. The method according to claim 3, before obtaining the coordinate values of the multiple points of the elliptic curve from the pre-calculated table, further comprising: According to a preset base number, pre-calculate the coordinate values of the multiple points of the elliptic curve corresponding to the base number; The coordinate value of the multiple point of the elliptic curve is determined by the dot product of the multiple point parameter and the coordinate value of the base point; the multiple point parameter is determined based on the base number; The coordinate values of the multiple points of the elliptic curve are stored in a pre-calculated table.
5. The method of claim 1, wherein: Each of the coordinate values comprises a plurality of data branches; the i-th data branch of each of the coordinate values is stored in the i-th SIMD vector register in the set of SIMD vector registers; wherein i is a positive integer from 1 to M; and M is the number of data branches determined based on the data segmentation bit width and the data bit length; Each SIMD vector register includes multiple data channels; the data branch of the coordinate value of the j-th elliptic curve multiple point among the multiple elliptic curve multiple points is stored in the j-th data channel of the corresponding SIMD vector register; wherein j is a positive integer from 1 to N, and N is the number of data channels determined based on the data channel width and the bit width of the SIMD vector register.
6. The method according to claim 1, wherein storing the coordinate values of the multiple elliptic curve multiple points into a set of SIMD vector registers and performing point addition operations on data branches in multiple data channels of the SIMD vector registers in parallel to obtain the coordinate value of the target point comprises: Storing the coordinate values of the multiple points of the elliptic curve into a first SIMD vector register; A first SIMD instruction set is used to perform a first multi-way parallel point addition operation corresponding to a first bit width of the first SIMD vector register on the coordinate values stored in the first SIMD vector register to obtain coordinate values of multiple intermediate elliptic curve points; the first SIMD instruction set is used to operate data of the first bit width; a first parallel operation number of the first multi-way parallel point addition operation is a first data channel number determined based on the data channel width and the first bit width of the first SIMD vector register; storing the coordinate values of the plurality of intermediate elliptic curve points in a second SIMD vector register; wherein the second bit width is smaller than the first bit width; A second SIMD instruction set is used to perform a second multi-way parallel point addition operation corresponding to a second bit width of the second SIMD vector register on the coordinate value stored in the second SIMD vector register to obtain the coordinate value of the target point; the second SIMD instruction set is used to operate data of the second bit width; the second parallel operation number of the second multi-way parallel point addition operation is the second data channel number determined based on the data channel width and the second bit width of the second SIMD vector register.
7. The method according to claim 6, wherein storing the coordinate values of the plurality of intermediate elliptic curve points into the second SIMD vector register comprises: Determine whether the number of the plurality of intermediate elliptic curve points is less than or equal to a preset number threshold, and obtain a determination result; If the judgment result is yes, the coordinate values of the multiple intermediate elliptic curve points are stored in the second SIMD vector register; wherein the preset quantity threshold is determined according to the number of the second data channels.
8. The method according to claim 6, wherein the second SIMD instruction set is used to perform a second multi-way parallel point addition operation corresponding to a second bit width of the second SIMD vector register on the coordinate value stored in the second SIMD vector register to obtain the coordinate value of the target point, specifically comprising: Using a first rearrangement instruction in the second SIMD instruction set, a first rearrangement operation is performed on the coordinate value of the first intermediate elliptic curve point to obtain a rearranged coordinate value of the first intermediate elliptic curve point; the coordinate value of the first intermediate elliptic curve point is obtained by performing a second multi-way parallel point addition operation on the coordinate value stored in the second SIMD vector register; using a second shuffle instruction in the second SIMD instruction set to perform a second shuffle operation on the coordinate value of the second intermediate elliptic curve point to obtain the coordinate value of the second intermediate elliptic curve point after shuffle; the coordinate value of the first intermediate elliptic curve point is obtained by performing a second multi-way parallel point addition operation on the coordinate value of the first intermediate elliptic curve point and the coordinate value of the first intermediate elliptic curve point after shuffle; Using a point addition instruction in the second SIMD instruction set, a second multi-way parallel point addition operation is performed on the coordinate value of the second intermediate elliptic curve point and the coordinate value of the rearranged second intermediate elliptic curve point to obtain the coordinate value of the target point; The first rearrangement instruction includes a permute instruction, and the second rearrangement instruction includes a shuffle instruction; or the first rearrangement instruction includes a shuffle instruction, and the second rearrangement instruction includes a permute instruction.
9. The method according to claim 1, wherein generating first signature information corresponding to the message based on the message and the coordinate value of the target point specifically comprises: generating a hash value of the message; Based on the hash value, the coordinate value of the target point and the order of the base point, first signature information corresponding to the message is generated.
10. The method according to claim 1, wherein the first signature information corresponding to the message is generated based on the message and the coordinate value of the target point, and then further comprises: Generate second signature information corresponding to the message based on the digital signature key, the first signature information, the random parameter and the order of the base point; Output the message and the digital signature information corresponding to the message; the digital signature information includes the first signature information and the second signature information.
11. A method for verifying a digital signature, comprising: Obtaining a message to be verified, digital signature information corresponding to the message to be verified, elliptic curve parameters used to generate the digital signature information, and a public key corresponding to a private key used to generate the digital signature information; The digital signature information includes first signature information and second signature information; the elliptic curve parameters include coordinate values of a base point of the elliptic curve and the order of the base point; Determine, according to the coordinate value of the base point of the elliptic curve and the second signature information, a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve; Obtaining coordinate values of the multiple points of the elliptic curve from a pre-calculated table; The coordinate values of the multiple elliptic curve multiple points are stored in a group of SIMD vector registers, and point addition operations are performed in parallel on data branches in multiple data channels of the SIMD vector registers to obtain a first intermediate value for calculating the coordinate value of the target point; the data branches are obtained by dividing the coordinate values of the multiple points of the elliptic curve according to a preset data division bit width; a SIMD vector register includes multiple data channels, one data branch is stored in one data channel, and data branches of different coordinate values of the multiple points of the elliptic curve are stored in different data channels; A verification result of the message to be verified is determined based on the first intermediate value, the order of the base point, the digital signature information and the public key.
12. The method of claim 11, wherein: The step of determining, according to the coordinate value of the base point of the elliptic curve and the second signature information, a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve specifically includes: Get the preset base number; Converting the second signature information into a base expression based on the base number; Based on the base expression, the point multiplication operation between the second signature information and the coordinate value of the base point is converted into a point addition operation between multiple elliptic curve multiple points, and multiple elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve are determined.
13. The method according to claim 12, before obtaining the coordinate values of the multiple elliptic curve multiple points from the pre-calculated table, further comprising: According to a preset base number, pre-calculate the coordinate values of the multiple points of the elliptic curve corresponding to the base number; The coordinate value of the multiple point of the elliptic curve is determined by the dot product of the multiple point parameter and the coordinate value of the base point; the multiple point parameter is determined based on the base number; The coordinate values of the multiple points of the elliptic curve are stored in a pre-calculated table.
14. The method of claim 11, wherein: Each of the coordinate values comprises a plurality of data branches; the i-th data branch of each of the coordinate values is stored in the i-th SIMD vector register in the set of SIMD vector registers; wherein i is a positive integer from 1 to M; and M is the number of data branches determined based on the data segmentation bit width and the data bit length; Each SIMD vector register includes multiple data channels; the data branch of the coordinate value of the j-th elliptic curve multiple point among the multiple elliptic curve multiple points is stored in the j-th data channel of the corresponding SIMD vector register; wherein j is a positive integer from 1 to N, and N is the number of data channels determined based on the data channel width and the bit width of the SIMD vector register.
15. The method according to claim 11, wherein storing the coordinate values of the multiple elliptic curve multiple points into a set of SIMD vector registers, and performing point addition operations on data branches in multiple data channels of the SIMD vector registers in parallel to obtain a first intermediate value for calculating the coordinate value of the target point, specifically comprises: Storing the coordinate values of the multiple points of the elliptic curve into a first SIMD vector register; A first SIMD instruction set is used to perform a first multi-way parallel point addition operation corresponding to a first bit width of the first SIMD vector register on the coordinate values stored in the first SIMD vector register to obtain coordinate values of multiple intermediate elliptic curve points; the first SIMD instruction set is used to operate data of the first bit width; a first parallel operation number of the first multi-way parallel point addition operation is a first data channel number determined based on the data channel width and the first bit width of the first SIMD vector register; storing the coordinate values of the plurality of intermediate elliptic curve points in a second SIMD vector register; wherein the second bit width is smaller than the first bit width; A second SIMD instruction set is used to perform a second multi-way parallel point addition operation corresponding to a second bit width of the second SIMD vector register on the coordinate value stored in the second SIMD vector register to obtain the coordinate value of the target point; the second SIMD instruction set is used to operate data of the second bit width; the second parallel operation number of the second multi-way parallel point addition operation is the second data channel number determined based on the data channel width and the second bit width of the second SIMD vector register.
16. The method according to claim 15, wherein storing the coordinate values of the plurality of intermediate elliptic curve points into the second SIMD vector register comprises: Determine whether the number of the plurality of intermediate elliptic curve points is less than or equal to a preset number threshold, and obtain a determination result; If the judgment result is yes, the coordinate values of the multiple intermediate elliptic curve points are stored in the second SIMD vector register; wherein the preset quantity threshold is determined according to the number of the second data channels.
17. The method according to claim 15, wherein the step of using a second SIMD instruction set to perform a second multi-way parallel point addition operation corresponding to a second bit width of the second SIMD vector register on the coordinate values stored in the second SIMD vector register to obtain the coordinate value of the target point comprises: Using a first rearrangement instruction in the second SIMD instruction set, a first rearrangement operation is performed on the coordinate value of the first intermediate elliptic curve point to obtain a rearranged coordinate value of the first intermediate elliptic curve point; the coordinate value of the first intermediate elliptic curve point is obtained by performing a second multi-way parallel point addition operation on the coordinate value stored in the second SIMD vector register; Using a second shuffle instruction in the second SIMD instruction set, a second shuffle operation is performed on the coordinate value of the second intermediate elliptic curve point to obtain the coordinate value of the second intermediate elliptic curve point after shuffle; the coordinate value of the second intermediate elliptic curve point is obtained by performing a second multi-way parallel point addition operation on the coordinate value of the first intermediate elliptic curve point and the coordinate value of the first intermediate elliptic curve point after shuffle; Using a point addition instruction in the second SIMD instruction set, a second multi-way parallel point addition operation is performed on the coordinate value of the second intermediate elliptic curve point and the coordinate value of the rearranged second intermediate elliptic curve point to obtain the coordinate value of the target point; The first rearrangement instruction includes a permute instruction, and the second rearrangement instruction includes a shuffle instruction; or the first rearrangement instruction includes a shuffle instruction, and the second rearrangement instruction includes a permute instruction.
18. The method according to claim 11, wherein determining the verification result of the message to be verified based on the first intermediate value, the order of the base point, the digital signature information and the public key comprises: Obtaining a second intermediate value for calculating the coordinate value of the target point according to the order of the base point, the digital signature information and the public key; Calculating the coordinate value of the target point based on the first intermediate value and the second intermediate value; Based on the coordinate value of the target point, a verification result of the message to be verified is determined.
19. The method according to claim 18, wherein determining the verification result of the message to be verified based on the coordinate value of the target point specifically comprises: Calculating first signature verification information based on the message to be verified, the coordinate value of the target point, and the order of the base point; Verifying whether the first signature verification information is the same as the first signature information, and obtaining a first verification result; If the first verification result is yes, then the verification result of the message to be verified is determined to be passed.
20. The method of claim 11, before determining a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve according to the coordinate value of the base point of the elliptic curve and the second signature information, further comprising: Verify whether the first signature information and the second signature information are both positive integers less than the order of the base point, and obtain a second verification result; The step of determining, according to the coordinate value of the base point of the elliptic curve and the second signature information, a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve specifically includes: If the second verification result is yes, a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve are determined according to the coordinate value of the base point of the elliptic curve and the second signature information.
21. A device for generating a digital signature, comprising: An initial parameter acquisition module, used to acquire a message to be signed and preset elliptic curve parameters; the elliptic curve parameters include coordinate values of a base point of the elliptic curve and the order of the base point; A target point calculation module, used for determining a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve according to the coordinate value of the base point and the order of the base point; A pre-calculated value acquisition module, used to obtain the coordinate values of the multiple points of the elliptic curve from the pre-calculated table; A parallel point addition operation module is used to store the coordinate values of the multiple elliptic curve multiple points into a group of SIMD vector registers, and perform point addition operation on the data branches in multiple data channels of the SIMD vector registers in parallel to obtain the coordinate value of the target point; the data branches are obtained by dividing the coordinate values of the multiple points of the elliptic curve according to a preset data division bit width; a SIMD vector register includes multiple data channels, one data branch is stored in one data channel, and data branches of different coordinate values of the multiple points of the elliptic curve are stored in different data channels; The digital signature information generation module is used to generate first signature information corresponding to the message based on the message and the coordinate value of the target point.
22. A device for verifying a digital signature, comprising: An initial information acquisition module, used to acquire a message to be verified, digital signature information corresponding to the message to be verified, elliptic curve parameters used to generate the digital signature information, and a public key corresponding to a private key used to generate the digital signature information; The digital signature information includes first signature information and second signature information; the elliptic curve parameters include coordinate values of a base point of the elliptic curve and the order of the base point; a target point calculation module, used to determine a plurality of elliptic curve multiple points for calculating the coordinate value of the target point of the elliptic curve according to the coordinate value of the base point of the elliptic curve and the second signature information; A pre-calculated value acquisition module, used to obtain the coordinate values of the multiple points of the elliptic curve from the pre-calculated table; A parallel point addition operation module, used for storing the coordinate values of the multiple elliptic curve multiple points into a group of SIMD vector registers, and performing point addition operation on data branches in multiple data channels of the SIMD vector registers in parallel to obtain a first intermediate value for calculating the coordinate value of the target point; the data branches are obtained by dividing the coordinate values of the multiple points of the elliptic curve according to a preset data division bit width; a SIMD vector register includes multiple data channels, one data branch is stored in one data channel, and data branches of different coordinate values of the multiple points of the elliptic curve are stored in different data channels; A verification result determination module is used to determine the verification result of the message to be verified based on the first intermediate value, the order of the base point, the digital signature information and the public key.
23. A computing device, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in any one of claims 1-10 or 11-20 when executing the computer instructions.
Citation Information
Cited By
Elliptic curve digital signature method and system based on fixed point multiplication rapid calculation
CN119483964A
Elliptic Curve Digital Signature Method and System Based on Fast Computation of Fixed-Point Dot Product
CN119483964B
Multiplication device, calculation chip, dot multiplication method, and storage medium
CN120973336A
