A high-performance parallel acceleration method for post-quantum cryptography BIKE based on GPU
By utilizing the multi-threaded parallel computing of GPU and a combination of specific algorithms on the server, the efficiency and security challenges of BIKE algorithm in the field of quantum cryptography are solved, efficient key generation, encryption and decryption operations are achieved, and quantum cryptography is improved. technology application performance.
Patent Information
- Application Number
- CN202410955796.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-17
AI Technical Summary
Existing quantum cryptographic algorithms such as BIKE have challenges in terms of throughput performance, space occupation and security, which are difficult to effectively resist quantum computer attacks, and face time and space efficiency gaps when migrating cryptographic infrastructure.
Using a high-performance parallel acceleration method based on GPU, the thread processing key generation, public key encryption and private key decryption modules are allocated on the server, and combined with SHAKE256 and Karatsuba algorithms, the efficient operation of the BIKE algorithm is realized.
It significantly improves the computing efficiency of the BIKE algorithm, reduces the computing load, meets the real-time data processing needs, ensures the rapid and secure processing of large-scale data, and lowers the technical threshold, achieving a balance between security and performance.
Smart Images

Figure CN118509166B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an acceleration method, in particular to a GPU-based post-quantum cryptography BIKE high-performance parallel acceleration method, belonging to the technical field of GPU post-quantum cryptography. Background Art
[0002] With the rapid progress of quantum computers, the speed of processing high computational complexity problems has been significantly improved. This poses a severe threat and challenge to the currently widely used modern public key cryptography system. Quantum computers have extremely strong computing power and can crack existing public key cryptography algorithms such as RSA and ECC in a very short time. This will lead to huge security risks for existing information systems. However, to ensure the security of networks and information systems in the context of the quantum computer era, it is necessary to focus on the development of cryptography technology. Cryptographers must actively explore new quantum-resistant cryptographic algorithms, such as cryptographic schemes based on lattices, hash functions, and codes. These new cryptographic systems can effectively resist attacks from quantum computers. In addition, efforts should be made to upgrade the existing cryptographic infrastructure and gradually replace algorithms that are vulnerable to quantum computer cracking. On the other hand, the security protection of critical information infrastructure should be improved to reduce the risk of information systems being attacked by quantum computers. Therefore, before welcoming the quantum information era, it is necessary for relevant departments and security practitioners to be prepared to ensure network and information security. This requires close cooperation between the cryptography community and the industry to deploy new quantum-resistant cryptographic technologies as soon as possible.
[0003] In 2022, the National Institute of Standards and Technology (NIST) announced that it would standardize four projects, including CRYSTALS-KYBER, ahead of schedule, and put four candidate algorithms, including BIKE, into the next round of screening. In addition, in 2018, the Chinese Cryptography Society, the Cryptography Industry Standardization Technical Committee, and the Commercial Cryptography Testing Center jointly organized a national cryptographic algorithm design competition, which attracted Chinese cryptographers to independently design quantum-resistant cryptographic algorithm solutions. As the threat of quantum computing to traditional cryptographic systems gradually increases, migrating cryptographic infrastructure to resist this threat has become a top priority. However, compared with currently deployed public key cryptographic algorithms (such as Curve25519 and SM2), mainstream quantum-resistant cryptography has many challenges and problems in terms of throughput performance, space occupancy, and security. How to enhance the computational efficiency of quantum-resistant cryptography to fill the time and space efficiency gap that occurs when migrating cryptographic systems has become a real-world application challenge that needs to be solved urgently.
[0004] BIKE is a code-based key encapsulation mechanism based on QC-MDPC (quasi-cyclic medium-density parity-check) codes. The BIKE cryptosystem consists of three core primitives: key generation (KEYGEN), encapsulation (ENCAPS), and decapsulation (DECAPS). KEYGEN creates a private-public key pair, ENCAPS generates an encrypted version of the shared secret key with the public key, and DECAPS retrieves the shared secret key from the ciphertext using the private key. Both BIKE and HQC are based on structured codes, and either of them can be used as a general key encapsulation mechanism that does not rely on lattices. Performance was a key factor that influenced BIKE in the fourth round of further evaluation compared to lattice-based candidates. Summary of the invention
[0005] The present invention aims to solve the technical application problems existing in the current BIKE algorithm and provides a GPU-based post-quantum cryptography BIKE high-performance parallel acceleration method. This technical solution not only significantly improves the computational efficiency of the BIKE algorithm, but also provides strong technical support for the actual deployment and application of future anti-quantum encryption technology.
[0006] In order to achieve the above purpose, the technical solution of the present invention is as follows: a high-performance parallel acceleration method for post-quantum cryptography BIKE based on GPU. Since the parallel calculations of the three modules of the algorithm are isolated from each other, users can combine any algorithm modules. A server can be responsible for the execution of a single or multiple algorithm modules, but each algorithm module needs to run on the GPU, and the GPU multi-threaded parallel computing capability is used to process a large number of requests, thereby achieving a high throughput effect. In accordance with the conventional steps of the BIKE public key encryption algorithm, the present invention executes the BIKE algorithm running on the GPU in the following steps in sequence:
[0007] S1: The server receives a large number of key generation requests from clients, requesting to generate public and private keys, and distributes them on the GPU threads are used for key generation calculations, where Divisible by 3, Request by The thread calculates and generates the public key and private key After the multi-threaded parallel computing is completed, the server will Requests return public keys and private key To the corresponding client, complete the batch key generation,
[0008] S2: The server receives a large number of public key encryption requests from the client, and the client sends the corresponding public key and Message Sent with the request to the server, the server allocates Threads are used for public key encryption calculations, is divisible by 3, where Request by After the multi-threaded parallel calculation is completed, the server will Requests return shared secret and ciphertext To the corresponding client, complete the batch calculation of public key encryption,
[0009] S3: The server receives a large number of requests for private key decryption from the client. If the server is responsible for the key generation calculation of the client at this time, the client does not need to send the private key to the server. Sent to the server with the request. If the server is not responsible for the client's key generation (the module runs on other servers), the client will send the private key and ciphertext Sent with the request to the server, the server allocates Threads are used for calculation of private key decryption, is divisible by 3, where Request by After the multi-threaded parallel calculation is completed, the server will Requests return shared secret Give the corresponding client to complete the batch calculation of private key decryption.
[0010] Further, in S1, the key generation module generates a private key pair using a pseudo-random number generator based on SHAKE256. , using a pseudo-random number generator based on SHAKE256. Inside the generator, the polynomial is set in parallel based on the results obtained by using the SHAKE256 algorithm in three threads to complete the generation of random polynomials, which is called a hash function. , then calculate the public key The process performs three-thread parallel polynomial multiplication based on the Karatsuba algorithm. The multiplication divides the calculation data into three, and the three threads use their own data for parallel calculation. Finally, the calculation results are merged to get the final result. At the same time, the parallel inversion method is used for calculation .
[0011] The process of polynomial inversion includes the square operation of the polynomial. This process also divides the data into three parts and uses three threads for parallel calculation. At the same time, the inversion algorithm includes polynomial multiplication. The calculation method of polynomial multiplication is the same as described above. Finally, the three threads execute the random string generation process together to extract the random string. As part of the private key. This process is a single-threaded execution effect, and no thread allocation is performed on the calculation data.
[0012] Further, in S2, the public key encryption module first uses the hash function in step 1 , a three-thread parallel positioning method based on SHAKE256 generates an error polynomial pair , then calculate , it will be done by With public key Multiply and add XOR to calculate the first part of the ciphertext , the second part of the ciphertext By sending the message With the first hash function based on SHA3-384 The output is XORed to generate the The parallel multiplication method used is to perform three-thread parallel polynomial multiplication based on the Karatsuba algorithm. This multiplication divides the calculation data into three, and the three threads use their own data for parallel calculation. Finally, the calculation results are merged to obtain the final result. In addition, the calculation data is not assigned to threads in the rest of the parts, and the execution effect is a single-thread effect. Finally, the shared key Through a second hash function based on SHA3-384 The ciphertext and message are hashed by SHA3-384. No threads are allocated to the calculation data during the whole process, and the execution effect is a single-threaded effect.
[0013] Further, in S3, the private key decryption module first calculates The parallel multiplication method used is to perform three-thread parallel polynomial multiplication based on the Karatsuba algorithm. This multiplication divides the calculation data into three, and the three threads use their own data for parallel calculation. Finally, the calculation results are merged to obtain the final result. Then, and private key is input to the decoder to recover the error polynomial The decoder contains two integer domain multiplications, which are calculated in parallel using two threads. The binary domain multiplication method contained in the decoder uses three threads to perform three-thread parallel polynomial multiplication based on the Karatsuba algorithm. The multiplication divides the calculation data into three. The three threads use their own data for parallel calculation, and finally merge the calculation results to obtain the final result. If the decoding is successful, the algorithm is based on the ciphertext. and the error polynomial to calculate the message , , no thread allocation is performed on the calculation data, and the execution effect is a single-thread effect. In order to verify the recovery and the error polynomial Whether it matches the original data when encapsulated, the algorithm applies a sampling hash function arrive and compare the output to the decoder Compare and if this is valid for the data, calculate the shared key Otherwise, it uses the secret string in the private key To calculate ,in The pseudo-random number setting in the function is based on the results obtained by three threads using the SHAKE256 algorithm to set the polynomial in parallel. The rest of the data is not allocated to threads, and the execution effect is a single-threaded effect.
[0014] The present invention also designs a high-throughput single-threaded multi-request solution for the private key decryption module in step S3. After the server receives the request, a single thread is used to process a single request. This design allows a single thread to process a single request, further improving the utilization efficiency of the thread, so that the throughput is improved. However, compared with the three-thread solution, the delay in processing a single request is increased because the steps in the module are not processed in parallel. The designs of these two parallel architectures complement each other and provide flexibility and efficiency for the application of the BIKE algorithm. According to the different requirements of specific application scenarios, users can choose a suitable architecture to deploy the algorithm. For scenarios that pay special attention to high throughput, a single-threaded multi-request solution can be used. For scenarios that pursue balanced performance of delay and throughput, a three-thread solution can be used. Thereby, while ensuring security, the performance and response speed of the algorithm are maximized.
[0015] A GPU-based post-quantum cryptography BIKE high-performance parallel acceleration system, used to implement the GPU-based post-quantum cryptography BIKE high-performance parallel acceleration method, the system comprising:
[0016] A key generation module for key generation, which includes a three-thread parallelized polynomial multiplication based on the Karatsuba algorithm, a parallelized inversion operation module, a SHA3-384 algorithm for hashing, and a parallelized pseudo-random number generator based on SHAKE256. The module is used to generate the public key used by the public key encryption module and the private key used by the private key decryption module.
[0017] A public key encryption module for public key encryption, which includes a parallelized pseudo-random number generator based on SHAKE256, a SHA3-384 algorithm for hashing, and a three-thread parallelized polynomial multiplication based on the Karatsuba algorithm. This module is used to encrypt plaintext messages and generate shared keys. A private key decryption module for private key decryption, which includes a parallelized decoder, including three-thread parallelized polynomial multiplication based on the Karatsuba algorithm, and polynomial multiplication on the integer field of dual-thread parallel calculation. The private key decryption module also includes a parallelized pseudo-random number generator based on SHAKE256 and a SHA3-384 algorithm for hashing. This module is used to decrypt ciphertext messages and recover and obtain shared keys from them; it also includes another design scheme for the private key decryption module for private key decryption, which allows a single thread to process a single request, further improving the utilization efficiency of the thread and improving the throughput. However, the latency of request processing has increased.
[0018] A terminal comprises a processor, a memory and a program of a GPU-based post-quantum cryptography BIKE high-performance parallel acceleration method stored in the memory. When the GPU-based post-quantum cryptography BIKE high-performance parallel acceleration program is executed by the processor, the steps of the GPU-based post-quantum cryptography BIKE high-performance parallel acceleration method are implemented.
[0019] A computer-readable storage medium stores computer instructions, which, when executed by a processor, implement the steps of the GPU-based post-quantum cryptography BIKE high-performance parallel acceleration method.
[0020] Compared with the prior art, the advantages of the present invention are as follows:
[0021] 1. The present invention has successfully overcome a number of technical application problems in the fields of cloud services and IoT communication security by innovatively combining the high parallel processing capabilities of GPUs and the characteristics of the BIKE algorithm. In view of the limited computing resources of IoT devices, the present invention uses the computing power of GPUs to implement efficient encryption and decryption operations of the BIKE algorithm, effectively reducing the computing load of nodes while meeting the needs of real-time data processing. Faced with the surge in data volume caused by the increase in IoT devices, the present invention significantly improves the data throughput of cloud services and ensures the rapid and secure processing of large-scale data. In addition, without sacrificing security, the present invention achieves a balance between security and performance by optimizing the calculation process, providing users with high-performance and secure services;
[0022] 2. In terms of hardware compatibility and integration, the present invention simplifies the deployment process of the BIKE algorithm, lowers the technical threshold, and enables a wide range of systems and devices to adopt this efficient quantum-resistant cryptographic technology. The consistency of cross-platform performance ensures that the security on different computing platforms will not be affected by performance differences. More importantly, the present invention promotes the compatibility of the BIKE algorithm with existing TLS-like protocols, allowing third-party high-performance agents to use GPUs to calculate the public key encryption process, significantly reducing the client's computing load while maintaining the security and efficiency of communications;
[0023] 3. Through the flexible architecture design of three-thread parallelism and single-thread multi-request, the present invention provides users with the possibility of customizing solutions according to specific application scenarios, thereby promoting the practical application of anti-quantum cryptographic algorithms and the development of information security. This deeply optimized parallel computing method not only significantly improves the computational efficiency of the BIKE algorithm, but also provides a practical solution for information security in the era of quantum computing;
[0024] 4. Combining cloud services and IoT communication security, the GPU-based post-quantum cryptography BIKE acceleration technology mainly solves the following problems:
[0025] Computing resource limitations: IoT devices usually have limited computing power, while cloud services need to handle encryption and decryption requests from a large number of IoT devices. The GPU acceleration technology of the BIKE algorithm effectively handles large-scale encryption and decryption tasks by utilizing the high parallelism of desktop-level GPUs in the cloud, while reducing the computing burden of IoT devices.
[0026] Real-time data processing: The data generated by IoT devices requires real-time or near-real-time processing and response. The GPU acceleration technology of the BIKE algorithm can quickly complete data encryption and decryption, ensuring the security of data during transmission while meeting real-time requirements.
[0027] Data throughput: With the increase in IoT devices, the amount of data has increased dramatically, which has put forward higher requirements for the data throughput of cloud services. The GPU-accelerated BIKE algorithm improves the efficiency of encryption and decryption, increases the data processing speed, and thus enhances the data throughput capacity of cloud services.
[0028] Balance between security and performance: In cloud services, it is necessary to provide high-performance services while ensuring data security. The GPU acceleration technology of the BIKE algorithm improves the response speed and overall performance of cloud services by optimizing the calculation process without sacrificing security.
[0029] In addition, from the perspective of quantum-resistant cryptographic algorithms and GPU hardware parallel computing, the present invention has completed an efficient adaptation of quantum-resistant cryptographic algorithms and GPU parallel computing, and solved the following practical application problems of the BIKE cryptographic algorithm: Hardware compatibility and integration: Integrating quantum-resistant cryptographic algorithms with existing hardware and software systems may face compatibility problems. As a widely supported hardware platform, GPU simplifies and unifies the integration and optimization process of the BIKE algorithm through programming models such as CUDA. Through GPU acceleration, the deployment of the BIKE algorithm becomes simpler and more efficient. This simplified deployment process lowers the technical threshold, allowing more systems and devices to adopt efficient quantum-resistant cryptographic technology. Cross-platform performance consistency: Different computing platforms may have different performance characteristics. GPU acceleration technology can achieve consistent performance of the BIKE algorithm on GPUs on multiple platforms, solving the problem that the security of cross-platform applications is affected by performance differences. Protocol compatibility: Users run the GPU-adapted BIKE cryptographic algorithm on an independent server, which allows asymmetric encryption processes similar to TLS protocols to be calculated by third-party high-performance agents, significantly reducing the computing load on the client. The present invention promotes the practical application of post-quantum cryptographic algorithms. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 This is a schematic diagram of the algorithm module organization structure;
[0031] Figure 2 This is a schematic diagram of KEYGEN's three-thread parallel organization scheme;
[0032] Figure 3 This is a schematic diagram of the ENCAPS three-thread parallel organization scheme;
[0033] Figure 4 This is a schematic diagram of the DECAPS three-thread parallel organization scheme;
[0034] Figure 5 Schematic diagram of DECAPS single-threaded parallel architecture. DETAILED DESCRIPTION
[0035] In order to deepen the understanding of the present invention, the present embodiment is described in detail below with reference to the accompanying drawings.
[0036] Example 1: See Figure 1The dark modules in the figure represent the three-thread parallel optimized execution part. The BIKE cryptographic system includes three core primitives: key generation (KEYGEN), public key encryption (ENCAPS), and private key decryption (DECAPS). KEYGEN creates a private key-public key pair, ENCAPS uses the public key to generate an encrypted version of the shared key, and DECAPS uses the private key to retrieve the shared key from the ciphertext. The implementation steps of the three core primitives are as follows:
[0037] Step S1: Key generation KEYGEN:
[0038] Step S1.1: Generate a private key pair using a pseudo-random number generator based on SHAKE256 , which corresponds to the PRNG module in the figure. This module uses a three-thread parallel positioning algorithm to execute .
[0039] Step S1.2: , the public key is obtained by three-thread parallelization of polynomial multiplication and three-thread parallelization of inversion algorithm ; This process corresponds to the polynomial multiplication module on the binary finite field and the parallelized inversion operation module in the figure.
[0040] Step S1.3: Extract a random string As part of the private key; the process is random number generation.
[0041] Step S2: Public key encryption ENCAPS:
[0042] Public key encryption algorithms are first used To generate two error polynomials Then, it passes With public key Multiply and add XOR (bitwise addition) to calculate the first part of the ciphertext The second part of the ciphertext By sending the message With the first hash function based on SHA3-384 Finally, the shared key By using a second hash function based on SHA3-384 Hash the ciphertext and the message.
[0043] Step S2.1: Use To generate two error polynomials This process corresponds to the PRNG module in the figure, and is performed using the three-thread parallel positioning method.
[0044] Step S2.2: , which corresponds to the polynomial multiplication module over the binary finite field and the SHA3-384 module in the figure.
[0045] Step S2.3: , this process corresponds to the SHA3-384 module in the figure.
[0046] Step S3: Private key decrypts DECAPS:
[0047] The private key decryption algorithm is used to decrypt the ciphertext Error recovery polynomial It first calculates , which is the standard procedure for decoding linear codes. Then, and private key is input to the decoder to recover the error polynomial If the decoding is successful, the algorithm is based on the ciphertext and the error polynomial to calculate the message To verify the restored and the error polynomial Whether it matches the original data when encapsulated, the algorithm applies a hash function arrive and compare the output to the decoder Compare. If this is valid for the data, calculate the shared secret Otherwise, it uses the secret string from the private key To calculate .
[0048] Step S3.1: , which corresponds to the decoder part of the figure, which contains parallelized multiplication over a binary finite field and two parallelized polynomial multiplications over integer fields. The parameters The calculation of corresponds to the polynomial multiplication module over the binary finite field in the figure.
[0049] Step S3.2: , which corresponds to the SHA3-384 module in the figure.
[0050] Step S3.3: if
[0051] , which corresponds to the PRNG and SHA3-384 modules in the figure.
[0052] The present invention designs an efficient three-thread parallel computing scheme for the key operations (the operations that take the longest time) in the BIKE algorithm steps, and combines these computing methods with some modules of the original algorithm to form a parallel computing design scheme for the high-performance BIKE algorithm on GPU. Figure 1 It shows the organizational relationship between each module and the upper-level modules in the design.
[0053] The following is an explanation of the parallel computing method of the three modules:
[0054] KEYGEN: Figure 2 For the KEYGEN three-thread parallel organization scheme, here we give the specific implementation process of the three-thread parallel computing method in the KEYGEN module:
[0055] Step S1.1: Generate a private key pair using a pseudo-random number generator based on SHAKE256 ; The details are as follows:
[0056] Step S1.1.1: Three threads use the SHAKE256 algorithm in parallel to generate the index of the "1" position in the polynomial
[0057] Three threads (T1, T2, T3) jointly complete the index generation of their respective parts (P1, P2, P3)
[0058] T1: Completes the generation of the P1 index and stores it in the local memory L1.
[0059] T2: Completes the generation of the P2 index and stores it in the local memory L2.
[0060] T3: Completes P3 index generation and stores it in local memory L3.
[0061] The three threads synchronously copy the contents of L1, L2, and L3 to the global memory G.
[0062] Step S1.1.2: The three threads copy the data in G to their own local memory (L1, L2, L3), and traverse each bit of the polynomial to complete the set operation.
[0063] Assume that the polynomial is Here T1 is responsible for the front T2 is responsible for the setting operation. , T3 is responsible .
[0064] T1: traverse each bit of the responsible part, and for each bit, traverse the content in L1 to determine whether to set it. If the bit index exists in L1, set the bit to 1, otherwise, set it to 0;
[0065] T2: traverse each bit of the responsible part, and for each bit, traverse the content in L2 to determine whether to set it. If the bit index exists in L2, set the bit to 1, otherwise, set it to 0;
[0066] T3: traverse each bit of the responsible part, and for each bit, traverse the content in L3 to determine whether to set it. If the bit index exists in L3, set the bit to 1, otherwise, set it to 0.
[0067] Step S1.1.3: Copy the local memory that has completed the setting to the global memory. T1, T2, and T3 then copy the two polynomials in the global memory. Copy it to the local memory for later use. This completes the operation of S1.1.
[0068] Step S1.2: The polynomial multiplication here uses the three-thread parallel Karatsuba algorithm. The present invention optimizes the Karatsuba algorithm by using parallel computing and memory access optimization.
[0069] Parallel computing: M: This will result in three multiplications
[0070] ,
[0071] Use T1, T2, and T3 to perform parallel calculations on these three multiplications.
[0072] Step S1.2.1: Complete the respective multiplication calculations,
[0073] T1: Calculate M1, store the result R1 in local memory L1, and copy R1 to global memory G.
[0074] T2: Calculate M2, store the result R2 in local memory L2, and copy R2 to global memory G.
[0075] T3: Calculate M3 and store the result R3 in local memory L3;
[0076] Step S1.2.2: Complete the reorganization of intermediate calculation results
[0077] T1: No operation,
[0078] T2: No operation,
[0079] T3: Use G and L3 to reorganize the intermediate calculation results of the multiplication, and finally obtain the result R of M.
[0080] Step S1.2.3: T1, T2, and T3 copy the final result R in G to their own local memory for subsequent use.
[0081] Memory optimization: The original multiplication stores A0A1 and B0B1 in two blocks of memory. When performing M1, M2, and M3, the two isolated memory blocks will be accessed successively, resulting in discontinuous memory access and reducing algorithm efficiency. The present invention innovatively adopts the method of merging two isolated memories into one continuous memory to improve algorithm efficiency.
[0082] First, organize the memory into a block ,
[0083] Next, when calculating the operands of M3, the newly calculated operands are organized into a block ,
[0084] Finally, when calculating M1, M2, and M3, adjacent memory locations are accessed instead of isolated memory areas, which improves the efficiency of memory access.
[0085] The polynomial inversion process in S1.2 includes polynomial multiplication. The present invention uses the optimized polynomial multiplication to replace the polynomial multiplication in the inversion process. The polynomial square operation does not use the Karatsuba algorithm, but simply uses the 64-bit ordinary polynomial multiplication algorithm, and uses T1, T2, and T3 to calculate different 64-bit multiplications in parallel. The 16384-bit multiplication in BIKE has a total of 256 64-bit ordinary multiplications.
[0086] T1: Calculates the first 0~256 / 3 64-bit multiplications and stores the results in local memory L1.
[0087] T2: Calculation 64-bit multiplications and store the results in local memory L2.
[0088] T3: Calculate the final 64-bit multiplications and store the results in local memory L3.
[0089] T1, T2, and T3 synchronously copy the contents of L1, L2, and L3 to the global memory G, and then copy the contents of the global memory G to the local memory for subsequent use.
[0090] At this point, all operations of S1.2 including multiplication and inversion are completed.
[0091] Step S1.3: Since this part takes a relatively small proportion of time, it is executed in a single-threaded manner (three threads perform the same operation).
[0092] After the KEYGEN calculation is completed, the thread writes the result in the local memory back to the global memory. The CPU copies the result from the global memory in the GPU to the host memory and then returns the result to the client.
[0093] ENCAPS:
[0094] Figure 3 The organizational scheme of the ENCAPS three-thread parallel computing method is given. The specific process is as follows:
[0095] Step S2.1: Generate two error polynomials according to the parallel setup step (PRNG) of S1.1 ,
[0096] Step S2.2: Use the optimized Karatsuba algorithm in S1.2 to perform the multiplication operation in this step. The remaining steps are executed in a single-threaded manner (three threads perform the same operation) because they are time-consuming and account for a small proportion of the total.
[0097] Step S2.3: Since this part takes a relatively small proportion of time, it is executed in a single-threaded manner (three threads perform the same operation).
[0098] Similar to the KEYGEN three-thread architecture, a PRNG pseudo-random number generator with parallelization is used, and the three-thread parallelized Karatsuba algorithm is applied to the multiplication in ENCAPS. SHA3-384 supports and Function, due to its small time consumption, is implemented in a single-threaded manner. Since multiplication accounts for the main performance overhead of the ENCAPS module, Karatsuba, which uses three-thread parallelization, can speed up multiplication while also improving the performance of the entire ENCAPS module. Unlike the KEYGEN module, the KEYGEN module has no input, while the input of the ENCAPS module is the output public key of the KEYGEN module. The public key After being received by the server, it is first stored in the host memory. When performing GPU calculations, the public key is copied to the global memory of the GPU. The three threads first read the public key from the global memory to the local register, and then perform calculations. The calculation of the entire ENCAPS module is the same as that of the KEYGEN module, and is executed in the local register to improve the calculation efficiency. Only when there is data combination and exchange between the three threads will the data be read in or written back from the global memory to improve the efficiency of the three-thread calculation. The final calculation result will be copied to the global memory, and then copied into the memory of the Host.
[0099] DECAPS: Figure 4It is a three-thread parallel organization scheme for DECAPS; the specific process of implementation is as follows:
[0100] Step S3.1: Passed to the decoder function The parameters are calculated using the parallel optimized polynomial multiplication described in S1.2. The decoder function contains two polynomial multiplications on the integer field, while the Karatsuba algorithm only supports polynomial multiplications on binary finite fields. Therefore, for these two polynomial multiplications on the integer field, the present invention uses T1 and T2 to jointly complete the first multiplication (single-thread effect), and T3 to complete the second multiplication, and the two multiplications are calculated in parallel. The Karatsuba polynomial multiplication in the decoder function is calculated using the calculation method described in S1.2. These parallel processings together constitute an efficient parallel decoder function.
[0101] Step S3.2: Since this part takes a relatively small proportion of time, it is executed in a single-threaded manner (three threads perform the same operation).
[0102] Step S3.3: Follow the parallel setup steps (PRNG) described in S1.1 to support The remaining steps are executed in a single-threaded manner (three threads perform the same operation) because they take less time.
[0103] Similar to the previous two modules, this module uses the method of parallelized bit setting and parallelized multiplication. Compared with the ENCAPS module, the performance overhead of multiplication in the DECAPS module is relatively small. Therefore, although the three-thread parallelization scheme meets the performance improvement requirements for multiplication, the performance improvement of the entire module is not more obvious than ENCAPS. Therefore, the decoder function with a relatively large overhead is also parallelized, and the low-latency DECAPS three-thread parallel architecture is obtained. Similar to the ENCAPS module, this module reads parameters from the host memory to the global memory, and the thread reads the number in the global memory to the local register for calculation. Data communication between threads is carried out through the global memory. Finally, the calculation result is returned to the global memory, the CPU fetches the data from the global memory to the host memory, and returns the result to the client.
[0104] In addition, considering the problem that two threads are not sufficiently parallel to the decoder function, the present invention provides a single-threaded multi-request DECAPS parallel architecture, such as Figure 5As shown, the present invention uses a single thread to process a single request for calculation. Since a single request is calculated by a single thread, the calculation steps in the request, such as multiplication, inversion, etc., cannot be parallelized using multiple threads. Although this single-thread solution has a high calculation delay for a single request, the overall throughput is improved for multiple requests because the thread utilization rate is improved. Users can choose a specific solution based on the different requirements of the DECAPS module deployment scenario on the GPU.
[0105] This invention clearly proposes a high-performance parallel BIKE acceleration method based on the CUDA architecture, and designs the algorithm's interaction process between the server and the client, successfully breaking through a number of technical application problems of quantum-resistant cryptography in the fields of cloud services and IoT communication security. The technical contribution and protection focus of this technical solution are reflected in the following three aspects of innovation:
[0106] 1. Design and optimization of three-thread parallel architecture: One of the most significant technical contributions of the present invention is the three-thread parallel processing method designed for the BIKE algorithm. This architecture makes full use of the single instruction multiple threads (SIMT) feature of the CUDA architecture, and significantly improves the processing speed and efficiency of the algorithm by assigning the most time-consuming polynomial multiplication operations in the BIKE algorithm to three parallel threads for execution. This design not only optimizes the allocation of computing resources, but also reduces the time complexity of algorithm execution, making it possible to apply the BIKE algorithm in a high-performance computing environment. Experimental measurements show that through this parallelization, the throughput of the three modules KEYGEN, ENCAPS, and DECAPS has increased by approximately 88, 74, and 23 times that of the original version, respectively, effectively meeting the needs of real-time data processing and large-scale data security processing;
[0107] 2. Flexible thread parallel architecture of DECAPS module: In order to solve the problem of low thread utilization in DECAPS module, the present invention innovatively designs a parallel architecture that uses multiple single threads to process multiple single requests. This design effectively improves thread utilization and overall algorithm performance by allowing a single thread to handle a single decryption request, thereby achieving high throughput. A three-thread optimized calculation DECAPS module is also designed to support application scenarios with balanced delay and throughput. The present invention provides a flexible solution for efficient data processing in encrypted communication systems;
[0108] 3. Targeted algorithm optimization and parallel strategy adjustment: This invention focuses on the specific characteristics of the BIKE algorithm and performs in-depth algorithm optimization and parallel strategy adjustment. This innovation is mainly reflected in the in-depth analysis and optimization of key calculation steps in the BIKE algorithm, such as the parallel processing of multiplication operations and specific optimization of each module (such as the setting method of three-thread parallelization). Through these targeted optimization measures, this solution can achieve more efficient and stable computing performance in different hardware and software environments;
[0109] In addition, the present invention has achieved remarkable results in hardware compatibility and integration, simplified the deployment process of the BIKE algorithm, lowered the technical threshold, and enabled a wide range of systems and devices to adopt this efficient quantum-resistant cryptographic technology. The consistency of cross-platform performance is guaranteed to ensure that the security on different computing platforms will not be affected by performance differences. More importantly, the present invention promotes the compatibility of the BIKE algorithm with existing TLS-like protocols, allowing third-party high-performance agents to use GPUs to calculate asymmetric encryption processes, significantly reducing the client's computing load while maintaining the security and efficiency of communications. Through the above innovations, the present invention not only improves the computational efficiency of the BIKE algorithm, but also provides a practical solution for information security in the era of quantum computing, significantly enhancing the practical value and scope of application of the present invention.
[0110] It should be noted that the above embodiments are not intended to limit the protection scope of the present invention, and equivalent changes or substitutions made on the basis of the above technical solutions all fall within the protection scope of the claims of the present invention.
Claims
1. A high-performance parallel acceleration method for post-quantum cryptography BIKE based on GPU, characterized in that: The method comprises the following steps: Step 1: The server receives a large number of key generation requests from clients, requesting the generation of public and private keys. N threads are allocated on the GPU for key generation calculations, where N is divisible by 3. The kth request is calculated by the 3(k-1)th to 3kth threads to generate public key h and private key (h0, h1, σ). After the multi-threaded parallel calculation is completed, the server returns the public key h and private key (h0, h1, σ) corresponding to the kth request to the corresponding client, completing batch key generation. Step 2: The server receives a large number of public key encryption requests from the client. The client sends the corresponding public key h and message m to the server along with the request. The server allocates N threads on the GPU for public key encryption calculations, where N is divisible by 3. The kth request is calculated by the second 3(k-1) to 3k threads. After the multi-threaded parallel calculation is completed, the server returns the shared key K and ciphertext c corresponding to the kth request to the corresponding client, completing the batch calculation of public key encryption. Step 3: The server receives a large number of private key decryption requests from the client. If the server is responsible for the key generation calculation of the client at this time, the client does not need to send the private key to the server and sends the ciphertext c with the request to the server. If the server is not responsible for the key generation of the client, the client sends the private key (h0, h1, σ) and the ciphertext c with the request to the server. The server allocates N threads on the GPU for the calculation of private key decryption, where N is divisible by 3. The kth request is calculated by the 3rd (k-1)th to 3kth threads. After the multi-threaded parallel calculation is completed, the server returns the shared key K corresponding to the kth request to the corresponding client to complete the batch calculation of private key decryption. The specific implementation process of step 1 is as follows: The key generation module generates a private key pair (h0, h1) through a pseudo-random number generator based on SHAKE256. Inside the generator, the polynomial is set in parallel based on the results obtained by using the SHAKE256 algorithm in three threads to complete the generation of the random polynomial, called hash function H0, and then the public key is calculated. This process performs three-thread parallel polynomial multiplication based on the Karatsuba algorithm. The multiplication divides the calculation data into three, and the three threads use their own data for parallel calculation. Finally, the calculation results are merged to obtain the final result. At the same time, the parallelized inversion method is used for calculation The specific implementation process of step 2 is as follows: The public key encryption module first uses the hash function H0 in step 1 to generate an error polynomial pair (e0, e1) based on the three-thread parallel positioning method of SHAKE256, and then calculates It calculates the first part c0 of the ciphertext by multiplying e1 with the public key h and XORing it with e0. The second part c1 of the ciphertext is generated by XORing the message m with the output of the first hash function H1 based on SHA3-384. The parallel multiplication method used in calculating C0 is a polynomial multiplication based on the Karatsuba algorithm that executes three threads in parallel. The multiplication divides the calculation data into three. The three threads use their own data for parallel calculation, and finally merge the calculation results to obtain the final result. In addition, the calculation data is not thread-assigned for the rest of the parts, and the execution effect is a single-thread effect. Finally, the shared key K is obtained by performing SHA3-384 hashing of the ciphertext and the message through the second hash function H2 based on SHA3-384. The calculation data is not thread-assigned for the entire process, and the execution effect is a single-thread effect. The specific implementation process of step 3 is as follows: The private key decryption module first calculates c0h0. The parallel multiplication method used is to perform three-thread parallel polynomial multiplication based on the Karatsuba algorithm. This multiplication divides the calculation data into three. The three threads use their own data for parallel calculation, and finally merge the calculation results to obtain the final result. Then, C0h0 and the private key (h0, h1) are input into the decoder to recover the error polynomial (e′0, e′1). The decoder contains two multiplications on the integer field. Two multiplications on the integer field are calculated in parallel using two threads. The multiplication calculation method on the binary field contained in the decoder uses three threads to perform three-thread parallel polynomial multiplication based on the Karatsuba algorithm. This multiplication divides the calculation data into three. The three threads use their own data for parallel calculation, and finally merge the calculation results to obtain the final result. If the decoding is successful, the algorithm calculates the message m' based on the ciphertext C and the error polynomial. No threads are assigned to the calculation data, and the execution effect is a single-threaded effect. In order to verify whether the recovered m' and the error polynomial (e′0, e′1) match the original data during encapsulation, the algorithm applies the hash function H0 to m′ and compares the output with (e′0, e′1) in the decoder. If this is valid for the data, it calculates the shared key K=H2(m′, C), otherwise, it uses the secret string σ in the private key to calculate K, where the pseudo-random number in the H0 function is set to the polynomial in parallel based on the result obtained by three threads using the SHAKE256 algorithm. For the rest, no threads are assigned to the data, and the execution effect is a single-threaded effect.
2. A GPU-based post-quantum cryptography BIKE high-performance parallel acceleration system, used to implement the GPU-based post-quantum cryptography BIKE high-performance parallel acceleration method according to claim 1, characterized in that: The system comprises: A key generation module for key generation, which includes a three-thread parallelized polynomial multiplication based on the Karatsuba algorithm, a parallelized inversion operation module, a SHA3-384 algorithm for hashing, and a parallelized pseudo-random number generator based on SHAKE256. The module is used to generate the public key used by the public key encryption module and the private key used by the private key decryption module. A public key encryption module for public key encryption, which includes a parallelized pseudo-random number generator based on SHAKE256, a SHA3-384 algorithm for hashing, a three-threaded parallelized polynomial multiplication based on the Karatsuba algorithm, which is used to encrypt plaintext messages and generate a shared key. A private key decryption module for private key decryption, which includes a parallelized decoder, including three-thread parallelized polynomial multiplication based on the Karatsuba algorithm, and polynomial multiplication on the integer field of dual-thread parallel calculation. The private key decryption module also includes a parallelized pseudo-random number generator based on SHAKE256 and a SHA3-384 algorithm for hashing. The module is used to decrypt ciphertext messages and recover and obtain shared keys therefrom.
3. A terminal, characterized in that: The invention comprises a processor, a memory and a program of a GPU-based post-quantum cryptography BIKE high-performance parallel acceleration method stored in the memory. When the GPU-based post-quantum cryptography BIKE high-performance parallel acceleration program is executed by the processor, the steps of the GPU-based post-quantum cryptography BIKE high-performance parallel acceleration method as claimed in claim 1 are implemented.
4. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the computer instructions are executed by the processor, the steps of the GPU-based post-quantum cryptography BIKE high-performance parallel acceleration method as claimed in claim 1 are implemented.
