A cryptographic system based on the ClassicMcEliece cryptographic system
By designing the syndrome module on the FPGA platform to complete the multiplication operation of public keys and vectors, the problem of excessive public key size in the Classic McEliece cryptosystem is solved, efficient storage and encryption processes are achieved, and the security and operating speed of the system are improved. .
Patent Information
- Application Number
- CN202210356154.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-06
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-04-06
AI Technical Summary
The public key size of the Classic McEliece cryptosystem is too large, resulting in inconvenient storage and transmission. Existing alternatives reduce the security factor and have few hardware implementation solutions.
Design a cryptosystem based on the Classic McEliece cryptosystem, using the syndrome module on the FPGA platform to complete the multiplication operation of public keys and vectors, making full use of parallelism and hardware resources, accelerating the running speed of the cryptosystem, and supporting different security factors. Structural transformation.
It achieves efficient public key storage and encryption processes, reduces storage dispersion and data transmission volume, supports flexible parallelism adjustment, and improves system security and operating speed.
Smart Images

Figure CN114866231B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of post-quantum cryptography technology, and in particular to a hardware solution for implementing a Classic McEliece cryptographic system by using a Field Programmable Gate Array (FPGA), and more particularly to a cryptographic system based on the Classic McEliece cryptographic system. Background Art
[0002] Among the coding-based quantum-resistant cryptographic systems, the Classic McEliece cryptographic system has become a strong competitor for the quantum-resistant cryptographic system standard with its efficient encryption and decryption process and high security factor. The security of this system is based on the decoding problem of arbitrary linear codes. The application of the Classic McEliece cryptographic system in the field of communication encryption is disclosed in the U.S. invention application with a publication date of 2021.12.30 and publication number of US20210409214A1: Subscription Hidden Identifier (SUCI) Supporting Post-Quantum Cryptography. In this cryptographic system, there are mainly three processes, namely the key generation process, the encryption process, and the decryption process. At the same time, since the notable feature of this cryptographic system is that its public key size is large, its calculation process and storage process are both key points that need to be considered.
[0003] The Classic McEliece cryptographic system is an encryption scheme based on Goppa codes. Due to the large size of the public key and the inconvenience of transmission, most current research focuses on using other code types (such as LDPC codes, Polar codes, etc.) to replace Goppa codes to reduce the size of the public key. However, the currently known alternatives will lead to a reduction in security. The classic McEliece scheme based on Goppa codes has a high security guarantee, but there is still little research on hardware implementation schemes based on this system.
[0004] In the encryption process of the Classic McEliece cryptographic system, the main operation involved is to multiply the public key matrix with the vector e to obtain the ciphertext c; the traditional approach is to extract the public key by row, extract at least 2720 bits at a time, perform bitwise AND with the vector e, and perform bitwise XOR on the result of the AND of the two vectors to obtain the final result c. This is not friendly to the storage of public keys. For Xilinx's storage unit BRAM, the size of BRAM is generally 18kB or 36kB, and the maximum bit width supported by a single BRAM for reading and writing is generally 32 bits. If 2720 bits are read at a time, it means that a row of data in the public key needs to be stored in multiple BRAMs, the data storage is scattered, and the amount of single data transmission is too large, which is not conducive to structural transformation and expansion according to different degrees of parallelism. Summary of the invention
[0005] In view of the limitations of the prior art, the present invention proposes a cryptographic system based on the Classic McEliece cryptographic system. The technical solution adopted by the present invention is:
[0006] A cryptographic system based on the Classic McEliece cryptographic system, comprising a key generation device, an encryption device, a decryption device, a public key storage module and a private key storage module; the key generation device is connected to the public key storage module and the private key storage module; the public key storage module is connected to the encryption device; the private key storage module is connected to the decryption device; wherein:
[0007] The key generation device is used to generate a public key pk according to the input random array r1 and store it in the public key storage module, and a private key sk is stored in the private key storage module;
[0008] The encryption device is used to generate a ciphertext c according to the input random array r2 and the public key pk read from the public key storage module; the encryption device includes a data screening module, an error vector generation module and a syndrome module;
[0009] The data screening module is used to screen the random array r2; the error vector generation module is used to generate a vector e according to the random array r2 and the screening result of the random array r2 by the data screening module; the syndrome module is used to generate a ciphertext c according to the vector e and the public key pk read from the public key storage module;
[0010] The syndrome module includes a control unit and N computing units; the control unit is used to read the vector e several times, and read the public key pk in a row unit, with each row being read several times;
[0011] The computing unit includes an AND operator A, an XOR operator B, a register C1, and a register C2; the AND operator A is connected to the XOR operator B, and the XOR operator B is connected to the register C2; the register C1 is used to transfer the vector e to the AND operator A and the register C1 in the next level computing unit;
[0012] The decryption device is used to decrypt the input ciphertext c according to the private key sk read from the private key storage module to obtain a decryption result.
[0013] Compared with the prior art, the cryptographic system based on the Classic McEliece cryptographic system of the present invention can be deployed on FPGA. By providing a syndrome module to complete the multiplication of the public key and the vector e, it can make full use of the parallelism in the algorithm operation process and the rich logic resources of the hardware, thereby accelerating the operation speed of the Classic McEliece cryptographic system; it can support structural transformations under different security factors and adjust the parallelism according to needs.
[0014] As a preferred solution, a FIFO unit is used for buffering between the data screening module and the error vector generating module.
[0015] As a preferred solution, the public key storage module stores the public key pk composed of a public key matrix with a rows and b columns in the following manner: the matrix data of the public key matrix is stored in n BRAMs in units of rows, and each BRAM stores a maximum of d rows of matrix data and at least (n-1) padding data.
[0016] Furthermore, the number of rows a of the public key matrix, the number n of BRAMs storing the public key matrix, and the number d of matrix data rows respectively stored in each BRAM satisfy n*d≥a.
[0017] Furthermore, if n*d=a, the data distribution of each BRAM is as follows: in BRAMi (1≤i≤n), the head stores (i-1) padding data, the middle stores d rows of matrix data, and the tail stores (ni) padding data.
[0018] Furthermore, if n*d>a, the data distribution of each BRAM is as follows: in BRAMi (1 ≤i≤n-1), the head stores (i-1) padding data, the middle stores d rows of matrix data, and the tail stores (ni) padding data; in BRAMn, the head stores (n-1) padding data, the middle stores (n*da) rows of matrix data, and the tail stores (a+dn*d) padding data.
[0019] Furthermore, the same computing unit accesses the same internal address when reading data in each BRAMi.
[0020] As a preferred solution, the key generation device includes a sorting module, a first evaluation module, a Gaussian elimination module and a minimum polynomial generation module; the sorting module is used to convert the first P elements of the random array r1 input into the key generation device into a finite field sequence array L, and store it in the private key storage device as a part of the private key sk; the minimum polynomial generation module is used to convert the last Q elements of the random array r1 into another part of the private key sk and store it in the private key storage device;
[0021] The first evaluation module and the Gaussian elimination module are used to transform the finite field sequence array L to generate a public key pk and store it in the public key storage device.
[0022] Furthermore, the random array r1 is divided into the first P elements and the last Q elements in the following manner:
[0023] P=2b; Q=4t; wherein b represents a preset code length, and t represents a preset number of error corrections.
[0024] As a preferred solution, the decryption device includes a first synd module, a second synd module, a BM module, a second evaluation module and a comparison module; wherein, the input end of the first synd module receives the ciphertext c and the private key sk, and the output end is connected to the input end of the BM module and the comparison module; the input end of the second synd module receives the private key sk, and the output end is connected to the input end of the comparison module; the output end of the BM module is connected to the input end of the second evaluation module; and the output end of the second evaluation module is connected to the input end of the second synd module. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A schematic diagram of a cryptographic system based on the Classic McEliece cryptographic system provided in an embodiment of the present invention;
[0026] Figure 2 An example of a public key storage method in a cryptographic system based on the Classic McEliece cryptographic system provided in an embodiment of the present invention;
[0027] Figure 3 An example of the operation of the syndrome module in a cryptographic system based on the Classic McEliece cryptographic system provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0028] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;
[0029] It should be clear that the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the embodiments of the present application.
[0030] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present application. The singular forms of "a", "said" and "the" used in the 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 herein refers to and includes any or all possible combinations of one or more associated listed items.
[0031] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims. In the description of the present application, it should be understood that the terms "first", "second", "third", etc. are only used to distinguish similar objects, and do not have to be used to describe a specific order or sequence, nor can they be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances.
[0032] In addition, in the description of this application, unless otherwise specified, "multiple" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0033] In order to solve the limitations of the prior art, this embodiment provides a technical solution, and the technical solution of the present invention is further described below in conjunction with the drawings and embodiments.
[0034] Example 1
[0035] Please refer to Figure 1 and Figure 3 , a cryptographic system based on the Classic McEliece cryptographic system, comprising a key generation device 1, an encryption device 2, a decryption device 3, a public key storage module 4 and a private key storage module 5; the key generation device 1 is connected to the public key storage module 4 and the private key storage module 5; the public key storage module 4 is connected to the encryption device 2; the private key storage module 5 is connected to the decryption device 3; wherein:
[0036] The key generation device 1 is used to generate a public key pk according to the input random array r1 and store it in the public key storage module 4 and a private key sk and store it in the private key storage module 5;
[0037] The encryption device 2 is used to generate a ciphertext c according to the input random array r2 and the public key pk read from the public key storage module 4; the encryption device 2 includes a data screening module 21, an error vector generation module 22 and a syndrome module 23;
[0038] The data screening module 21 is used to screen the random array r2; the error vector generation module 22 is used to generate a vector e according to the random array r2 and the screening result of the random array r2 by the data screening module 21; the syndrome module 23 is used to generate a ciphertext c according to the vector e and the public key pk read from the public key storage module 4;
[0039] The syndrome module 23 includes a control unit and N computing units 232; the control unit is used to read the vector e several times, and read the public key pk in a row unit, with each row being read several times;
[0040] The computing unit 232 includes an AND operator A, an XOR operator B, a register C1, and a register C2; the AND operator A is connected to the XOR operator B, and the XOR operator B is connected to the register C2; the register C1 is used to transfer the vector e to the AND operator A and the register C1 in the next level computing unit 232;
[0041] The decryption device 3 is used to decrypt the input ciphertext c according to the private key sk read from the private key storage module 5 to obtain a decryption result.
[0042] Compared with the prior art, the cryptographic system based on the Classic McEliece cryptographic system of the present invention can be deployed on FPGA. By providing a syndrome module to complete the multiplication of the public key and the vector e, it can make full use of the parallelism in the algorithm operation process and the rich logic resources of the hardware, thereby accelerating the operation speed of the Classic McEliece cryptographic system; it can support structural transformations under different security factors and adjust the parallelism according to needs.
[0043] Specifically, the syndrome module needs to complete the multiplication operation of the matrix pk of size a*b and the vector e of length b, and finally obtain a vector of length b as the final result. In a binary matrix, the multiplication operation is simplified to an AND operation, and the addition operation is simplified to an XOR operation. During the calculation process, the vector multiplication of length b needs to be performed p times.
[0044] For a syndrome module with a parallelism of N, N corresponding computing units are used. The inputs of the computing units are the first N rows in the matrix and the vector e respectively. Therefore, when the N units work simultaneously, the results of the N rows of data in the matrix and the vector e can be calculated simultaneously. For the repeatedly used vector e, in order to minimize the number of accesses to the memory, the N computing units do not start the calculation of valid data simultaneously. The vector e is read out in multiple times and flows sequentially among the N computing units. When the vector e starts to flow to the corresponding computing unit (i.e., the moment when the computing unit starts the calculation of valid data), this unit starts the operation of valid data. When the vector e flows to the Nth computing unit, at this time all the computing units calculate the corresponding valid data. When a row of data is completely read out, the first output result can be obtained. In the next N cycles, N result data outputs can be obtained.
[0045] The Classic McEliece cryptosystem is a cryptosystem based on error-correcting codes. In this cryptosystem, the parameter of the correctable codeword is t. In the encryption process, first, a vector e with a weight of t needs to be generated. The length of the vector e is the code length b (t < b). The vector e is multiplied by the public key matrix pk to obtain the ciphertext vector c. The encryption module receives the input random array r2 and filters the data in the array. If the array contains t non-repeating data within the specified range, the position distribution of the non-zero elements in the vector e can be determined, and thus the complete vector e can be generated. Subsequently, the public key pk is taken out from the storage unit row by row and the vector multiplication operation is performed to obtain the ciphertext c. Among them, according to the submitted security coefficients, the size of the public key under each security coefficient can be determined. As shown in the following table:
[0046]
[0047]
[0048] Among them, m is the number of bits in the finite field, b is the code length, and t is the number of error corrections; it can be seen that the size of the public key is very large.
[0049] At the same time, in the FPGA platform, the storage is mainly implemented by two types of resources, namely distributed storage and block storage (Block RAM). Block storage is also called BRAM and is a storage resource for storing batch data. Since the traditional encryption scheme does not mention the public key storage scheme, the data transmission volume caused by taking out one row of the public key each time is large. For BRAM storage, the storage of data is scattered and difficult to manage.
[0050] In addition, for the traditional encryption scheme, due to taking out the entire row of data at one time, there are limitations in expanding the parallelism.
[0051] Therefore, as a preferred embodiment, the public key storage module 4 stores the public key pk composed of a row and b column public key matrix in the following manner: the matrix data of the public key matrix is stored in n BRAMs in units of rows, and each BRAM stores a maximum of d rows of matrix data and at least (n-1) padding data.
[0052] Specifically, the larger the data bit width, the lower the supported clock operating frequency may be. Considering various factors, the data bit width of each BRAM can be specified to be 32 bits each time it is read. Then, a row of data in the public key matrix needs to be divided into Read out again.
[0053] Furthermore, the number of rows a of the public key matrix, the number n of BRAMs storing the public key matrix, and the number d of matrix data rows respectively stored in each BRAM satisfy n*d≥a.
[0054] Furthermore, if n*d=a, the data distribution of each BRAM is as follows: in BRAMi (1≤i≤n), the head stores (i-1) padding data, the middle stores d rows of matrix data, and the tail stores (ni) padding data.
[0055] Furthermore, if n*d>a, the data distribution of each BRAM is as follows: in BRAMi (1 ≤i≤n-1), the head stores (i-1) padding data, the middle stores d rows of matrix data, and the tail stores (ni) padding data; in BRAMn, the head stores (n-1) padding data, the middle stores (n*da) rows of matrix data, and the tail stores (a+dn*d) padding data.
[0056] Furthermore, since the N computing units do not start the operation of valid data at the same time but start following the flow of vector e, in order to simplify the address access logic, the same computing unit 232 accesses the same internal address when reading data in each BRAMi.
[0057] Take the 768*2720 size public key matrix as an example, please refer to Figure 2 , P is the filling data, the matrix has a total of 768 rows, which are stored in 192 BRAMs. Each BRAM stores 4 rows of matrix data and n-1 filling data; the distribution of the filling data is as follows: n-1 data is filled at the tail of BRAM1, 1 data is filled at the head of BRAM2, and n-2 data is filled at the tail, and so on. The head of BRAM192 is filled with n-1 data, thereby completing the public key storage.
[0058] The above-mentioned public key storage method can better cooperate with the parallelism adopted in the encryption process, so that the system can flexibly adjust the storage strategy according to the parallelism.
[0059] Next, we take the multiplication of a binary matrix of size 6*96 and a vector of length 96 bits as an example, and set the parallelism of the syndrome module N=3, that is, the syndrome module contains 3 computing units, as shown in Figure 3, and the labels ①②③ represent the 3 internal computing units. In each computing unit, the symbol A represents the logical AND unit, the symbol B represents the logical XOR unit, and the symbol C represents the use of registers for data storage. The length of the vector is 96 bits, and the bit width of each read data is 32 bits. Therefore, each vector needs to be read out three times. e0, e1, and e2 are the results of the same vector e being read out three times. x(0,0), x(0,1), and x(0,2) are the results of the 0th row of the public key matrix being read out three times, and the rest of the variables are similar. Padding represents the padding data, which has no effect on the calculation results.
[0060] Based on the above definition, the specific calculation steps are as follows: at T = 0, e0, x(0, 0) and two padding data are sent to the module. At this time, unit ① works, completes the AND operation of vector e0 and x(0, 0) and stores the result. At T = 1, e1, x(0, 1) and a padding data are sent to the module. Unit ① completes the AND operation of e1 and x(0, 1) and XORs it with the result of the previous cycle of this unit. Unit ② completes the AND operation of e0 and x(1, 0) and stores the result. At T = 2, unit ① completes the AND operation of e2 and x(0, 2) and XORs it with the result of the previous cycle of the previous unit. Unit ② completes the AND operation of e1 and x(1, 1) and XORs it with the result of the previous cycle. Unit ③ completes the AND operation of e0 and x(2, 0). The subsequent cycles are similar to the third cycle, and the three units all start calculating valid data. Starting from T=3, the output results y0, y1, y2, etc. can be obtained from units ①, ②, and ③ in turn. Finally, when the last data at the input end of e flows to unit ③, all data operations can be completed to obtain the final result. Taking N=3 as an example, the calculation units labeled ①-③ receive the matrix vectors of the 1st to 3rd rows as input respectively. The calculation unit numbered i starts to calculate the valid data in the i-th clock cycle. For the data in the first row, it is not necessary to fill in the header. For the data in the second row, since the operation in the first cycle is not valid, 1 data needs to be filled in the header. Similarly, the Nth row of data needs to be filled with N-1 data in the header to ensure that the data obtained by the calculation unit is valid. Assume that a BRAM stores 4 rows of public key data. In order to maintain the consistency of the total length of the data (valid data + padding data), the BRAM contains four rows of valid public key data and n-1 additional padding data. The padding rules are as follows: Figure 2 As shown, P represents padding data. The padding data does not affect the calculation results in the process, but is only used to simplify the control logic of using addresses to access multiple storages.
[0061] Since the throughput of operations between the front and rear modules is different, as a preferred embodiment, a FIFO unit is used for buffering between the data screening module 21 and the error vector generating module 22. If the output result of the data screening module 21 is invalid, the data in the FIFO will not be read by the error vector generating module 22, and if the output result of the data screening module 21 is valid, the data in the FIFO will be read by the error vector generating module 22.
[0062] Example 2
[0063] This embodiment can be regarded as a result derived, improved or supplemented on the basis of Embodiment 1. The specific scheme is: a cryptographic system based on the Classic McEliece cryptographic system, comprising a key generation device 1, an encryption device 2, a decryption device 3, a public key storage module 4 and a private key storage module 5; the key generation device 1 is connected to the public key storage module 4 and the private key storage module 5; the public key storage module 4 is connected to the encryption device 2; the private key storage module 5 is connected to the decryption device 3; wherein:
[0064] The key generation device 1 is used to generate a public key pk according to the input random array r1 and store it in the public key storage module 4 and a private key sk and store it in the private key storage module 5;
[0065] The key generation device 1 comprises a sorting module 11, a first evaluation module 12, a Gaussian elimination module 13 and a minimum polynomial generation module 14; the sorting module 11 is used to convert the first P elements of the random array r1 input into the key generation device 1 into a finite field sequence array L, and store the finite field sequence array L into the private key storage device 5 as a part of the private key sk; the minimum polynomial generation module 14 is used to convert the last Q elements of the random array r1 into another part of the private key sk and store the finite field sequence array L into the private key storage device 5;
[0066] The first evaluation module 12 and the Gaussian elimination module 13 are used to transform the finite field sequence array L to generate a public key pk and store it in the public key storage device 4;
[0067] The encryption device 2 is used to generate a ciphertext c according to the input random array r2 and the public key pk read from the public key storage module 4; the encryption device 2 includes a data screening module 21, an error vector generation module 22 and a syndrome module 23;
[0068] The data screening module 21 is used to screen the random array r2; the error vector generation module 22 is used to generate a vector e according to the random array r2 and the screening result of the random array r2 by the data screening module 21; the syndrome module 23 is used to generate a ciphertext c according to the vector e and the public key pk read from the public key storage module 4;
[0069] The syndrome module 23 includes a control unit and N computing units 232; the control unit is used to read the vector e several times, and read the public key pk in a row unit, with each row being read several times;
[0070] The computing unit 232 includes an AND operator A, an XOR operator B, a register C1, and a register C2; the AND operator A is connected to the XOR operator B, and the XOR operator B is connected to the register C2; the register C1 is used to transfer the vector e to the AND operator A and the register C1 in the next level computing unit 232;
[0071] The decryption device 3 is used to decrypt the input ciphertext c according to the private key sk read from the private key storage module 5 to obtain a decryption result.
[0072] As a preferred embodiment, the random array r1 is divided into the first P elements and the last Q elements in the following manner:
[0073] P=2b; Q=4t; wherein b represents a preset code length, and t represents a preset number of error corrections.
[0074] Example 3
[0075] This embodiment can be regarded as a result derived, improved or supplemented on the basis of Embodiment 1 or 2. The specific scheme is: a cryptographic system based on the Classic McEliece cryptographic system, comprising a key generation device 1, an encryption device 2, a decryption device 3, a public key storage module 4 and a private key storage module 5; the key generation device 1 is connected to the public key storage module 4 and the private key storage module 5; the public key storage module 4 is connected to the encryption device 2; the private key storage module 5 is connected to the decryption device 3; wherein:
[0076] The key generation device 1 is used to generate a public key pk according to the input random array r1 and store it in the public key storage module 4 and a private key sk and store it in the private key storage module 5;
[0077] The encryption device 2 is used to generate a ciphertext c according to the input random array r2 and the public key pk read from the public key storage module 4; the encryption device 2 includes a data screening module 21, an error vector generation module 22 and a syndrome module 23;
[0078] The data screening module 21 is used to screen the random array r2; the error vector generation module 22 is used to generate a vector e according to the random array r2 and the screening result of the random array r2 by the data screening module 21; the syndrome module 23 is used to generate a ciphertext c according to the vector e and the public key pk read from the public key storage module 4;
[0079] The syndrome module 23 includes a control unit and N computing units 232; the control unit is used to read the vector e several times, and read the public key pk in a row unit, with each row being read several times;
[0080] The computing unit 232 includes an AND operator A, an XOR operator B, a register C1, and a register C2; the AND operator A is connected to the XOR operator B, and the XOR operator B is connected to the register C2; the register C1 is used to transfer the vector e to the AND operator A and the register C1 in the next level computing unit 232;
[0081] The decryption device 3 is used to decrypt the input ciphertext c according to the private key sk read from the private key storage module 5 to obtain a decryption result;
[0082] The decryption device 3 includes a first synd module 31, a second synd module 32, a BM module 33, a second evaluation module 34 and a comparison module 35; wherein, the input end of the first synd module 31 receives the ciphertext c and the private key sk, and the output end is connected to the input end of the BM module 33 and the comparison module 35; the input end of the second synd module 32 receives the private key sk, and the output end is connected to the input end of the comparison module 35; the output end of the BM module 33 is connected to the input end of the second evaluation module 34; the output end of the second evaluation module 34 is connected to the input end of the second synd module 32.
[0083] Specifically, the synd algorithm uses an internal private key to perform calculations based on the value of an input vector, and finally outputs an array containing 2t elements; more specifically, the input vector of the first synd module is ciphertext, and the output result is s1, which serves as one of the inputs of the comparison module; the input vector of the second synd module is the output result of the second evaluation module, and the output result of the second synd module is s2, which serves as another input of the comparison module; finally, s1 and s2 are compared through the comparison module, and if the results are the same, the decryption result is successful.
[0084] The BM module 33 implements the Berlekamp-Massey algorithm. The BM module takes the output sequence s1 of the first synd module as input, and after traversing the elements in s1, obtains the minimum polynomial c of the sequence through 2t rounds of calculation. The sequence c contains t elements.
[0085] As a preferred embodiment, the decryption device 3 may also use a FIFO unit for buffering.
[0086] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A cryptographic system based on the Classic McEliece cryptographic system, It is characterized in that The invention comprises a key generation device (1), an encryption device (2), a decryption device (3), a public key storage module (4) and a private key storage module (5); the key generation device (1) is connected to the public key storage module (4) and the private key storage module (5); the public key storage module (4) is connected to the encryption device (2); the private key storage module (5) is connected to the decryption device (3); wherein: The key generation device (1) is used to generate a public key pk according to an input random array r1 and store it in the public key storage module (4) and a private key sk and store it in the private key storage module (5); The encryption device (2) is used to generate a ciphertext c according to an input random array r2 and a public key pk read from the public key storage module (4); the encryption device (2) comprises a data screening module (21), an error vector generation module (22) and a syndrome module (23); The data screening module (21) is used to screen the random array r2; the error vector generation module (22) is used to generate a vector e according to the random array r2 and the screening result of the random array r2 by the data screening module (21); the syndrome module (23) is used to generate a ciphertext c according to the vector e and the public key pk read from the public key storage module (4); The syndrome module (23) comprises a control unit and N computing units (232); the control unit is used to read the vector e several times, and read the public key pk in a row unit, with each row being read several times; The computing unit (232) comprises an AND operator A, an XOR operator B, a register C1, and a register C2; the AND operator A is connected to the XOR operator B, and the XOR operator B is connected to the register C2; the register C1 is used to transfer the vector e to the AND operator A and the register C1 in the computing unit (232) of the next level; The decryption device (3) is used to decrypt the input ciphertext c according to the private key sk read from the private key storage module (5) to obtain a decryption result.
2. The cryptographic system based on the Classic McEliece cryptographic system according to claim 1, It is characterized in that A FIFO unit is used for buffering between the data screening module (21) and the error vector generating module (22).
3. The cryptographic system based on the Classic McEliece cryptographic system according to claim 1, It is characterized in that The public key storage module (4) stores the public key pk composed of a public key matrix with a rows and b columns in the following manner: the matrix data of the public key matrix is stored in n BRAMs in units of rows, and each BRAM stores at most d rows of matrix data and at least (n-1) padding data.
4. The cryptographic system based on the Classic McEliece cryptographic system according to claim 3, It is characterized in that The number of rows a of the public key matrix, the number n of BRAMs storing the public key matrix, and the number d of matrix data rows respectively stored in each BRAM satisfy n*d≥a.
5. The cryptographic system based on the Classic McEliece cryptographic system according to claim 4, It is characterized in that If n*d=a, the data distribution of each BRAM is as follows: in BRAMi (1≤i≤n), the head stores (i-1) padding data, the middle stores d rows of matrix data, and the tail stores (ni) padding data.
6. The cryptographic system based on the Classic McEliece cryptographic system according to claim 4, It is characterized in that If n*d>a, the data distribution of each BRAM is as follows: in BRAMi (1≤i≤n-1), the head stores (i-1) padding data, the middle stores d rows of matrix data, and the tail stores (ni) padding data; in BRAMn, the head stores (n-1) padding data, the middle stores (n*da) rows of matrix data, and the tail stores (a+dn*d) padding data.
7. A cryptographic system based on the Classic McEliece cryptographic system according to any one of claims 3 to 6, It is characterized in that The same computing unit (232) accesses the same internal address when reading data in each BRAMi.
8. The cryptographic system based on the Classic McEliece cryptographic system according to claim 1, It is characterized in that The key generation device (1) comprises a sorting module (11), a first evaluation module (12), a Gaussian elimination module (13) and a minimum polynomial generation module (14); the sorting module (11) is used to convert the first P elements of the random array r1 input into the key generation device (1) into a finite field sequence array L, and store the array L as a part of the private key sk in the private key storage device (5); the minimum polynomial generation module (14) is used to convert the last Q elements of the random array r1 into another part of the generated private key sk and store the converted part in the private key storage device (5); The first evaluation module (12) and the Gaussian elimination module (13) are used to transform the finite field sequence array L to generate a public key pk and store it in the public key storage device (4).
9. The cryptographic system based on the Classic McEliece cryptographic system according to claim 8, It is characterized in that The random array r1 is divided into the first P elements and the last Q elements in the following manner: P=2b; Q=4t; wherein b represents a preset code length, and t represents a preset number of error corrections.
10. The cryptographic system based on the Classic McEliece cryptographic system according to claim 1, It is characterized in that The decryption device (3) comprises a first synd module (31), a second synd module (32), a BM module (33), a second evaluation module (34) and a comparison module (35); wherein the input end of the first synd module (31) receives the ciphertext c and the private key sk, and the output end is connected to the input end of the BM module (33) and the comparison module (35); the input end of the second synd module (32) receives the private key sk, and the output end is connected to the input end of the comparison module (35); the output end of the BM module (33) is connected to the input end of the second evaluation module (34); the output end of the second evaluation module (34) is connected to the input end of the second synd module (32); wherein the BM module (33) implements the Berlekamp-Massey algorithm.
Citation Information
Patent Citations
Subscription Concealed Identifier (SUCI) Supporting Post-Quantum Cryptography
US20210409214A1
Secure lightweight McEliece public key mask encryption method
CN106911461A
Signature authentication system and method based on SM2 encryption and decryption algorithm
CN107147488A
Low-memory-occupancy implementation technology based on post quantum cryptography Saber algorithm
CN113472525A
Conversion schemes for public key cryptosystems
US10061636B1
