Processor for implementing the Saber algorithm for post-quantum cryptography
By adopting a customized simplified instruction set and functional module division in the processor of the post-quantum cryptography Saber algorithm, the problems of efficiency and resource consumption in hardware implementation are solved, efficient key generation and key operations are achieved, and resource consumption is reduced. overhead.
Patent Information
- Application Number
- CN202111410431.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-25
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-11-25
AI Technical Summary
In the hardware implementation of the post-quantum cryptography Saber algorithm, there is little research on how to balance efficiency and resource consumption in the existing technology.
A processor for implementing the post-quantum cryptography Saber algorithm is designed, using a customized simplified instruction set and functional module division, including SHA3 sub-module, binary sampling sub-module, polynomial multiplier, encryption and decryption sub-module, and verification sub-module And the data bit width conversion sub-module works together through the control module to realize key generation, key encapsulation and key decapsulation.
It achieves efficient post-quantum cryptographic Saber algorithm execution and reduces resource consumption, which not only ensures the efficiency of the algorithm, but also saves hardware resource overhead.
Smart Images

Figure CN114154640B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology, and in particular to a processor for implementing a post-quantum cryptography Saber algorithm. Background Art
[0002] In the field of information security technology, in order to ensure the security of information, the sender needs to encrypt the information before sending it, and the receiver needs to use the corresponding key to decrypt the information after receiving it.
[0003] With the development of technology, cryptographic technology is developing from traditional public key-based cryptographic technology to PQC (Post-Quantum Cryptography) technology. The so-called PQC technology refers to cryptographic technology that can resist quantum computer attacks, so it is also called "anti-quantum cryptographic technology". The "post" here means that after the emergence of large-scale stable quantum computers, most of the existing public key cryptographic algorithms (such as RSA, Diffie-Hellman, elliptic curves, etc.) will be broken. Only cryptographic algorithms that can resist such attacks can survive in the era of quantum computing.
[0004] In PQC technology, the post-quantum cryptography Saber algorithm is one of them, which has the advantages of short public key length and easy implementation. The algorithm is a cryptographic primitive based on the MLWR (Machine Learning with Rounding) problem proposed by Jan-Pieter et al., which includes two schemes: public key encryption (Saber.PKE) and key encapsulation (Saber.KEM). Among them, Saber.PKE is a public key encryption scheme with indistinguishability under chosen plaintext attack (IND-CPA). Saber.KEM is a key exchange mechanism with indistinguishability under chosen ciphertext attack (IND-CCA). Among them, the conversion from Saber.PKE to Saber.KEM can be completed through Fujisaki-Okamoto transformation.
[0005] In the research on the post-quantum cryptography Saber algorithm, how to improve the efficiency of the post-quantum cryptography Saber algorithm, that is, high efficiency, is the current main research direction, that is, the current research mainly focuses on the problem of high efficiency. However, when the post-quantum cryptography Saber algorithm is implemented in hardware, resource consumption will also become an important issue, and there is little research on this. Summary of the invention
[0006] In view of this, an object of the present invention is to provide a processor for implementing the post-quantum cryptography Saber algorithm, which can take into account both the high efficiency and resource consumption issues in the solution of implementing the post-quantum cryptography Saber algorithm using hardware.
[0007] In order to achieve the above-mentioned invention object, an embodiment of the present invention provides a processor for implementing a post-quantum cryptography Saber algorithm, wherein the processor is implemented by hardware, and the processor includes: a storage module for storing data and instructions, wherein the processor uses a custom reduced instruction set, and the instructions stored in the storage module are instructions in the instruction set; a functional module for executing operations involved in the post-quantum cryptography Saber algorithm, and the functional module includes the following sub-modules: a third-generation secure hash algorithm SHA3 sub-module, a binary sampling sub-module, a polynomial multiplier, an encryption and decryption sub-module, a verification sub-module, and a data bit width conversion sub-module; and a control module for controlling each sub-module in the functional module to perform corresponding operations according to the instructions stored in the storage module, so as to implement at least one of key generation, key encapsulation, and key decapsulation in the post-quantum cryptography Saber algorithm.
[0008] In one embodiment, the length and format of each instruction in the customized reduced instruction set are the same, and each instruction includes: a control part, used to indicate the sub-module to be started and the working mode of the sub-module; a read address part, used to indicate the storage address of input data; and a write address part, used to indicate the storage address of output data.
[0009] In one embodiment, the SHA3 submodule and the polynomial multiplier both have multiple operating modes, and the control part includes: 7 bits, wherein 2 of the 7 bits are used as start flag bits for the SHA3 submodule and the polynomial multiplier, and the remaining 5 bits are used as start flag bits for the remaining submodules and mode control bits for the SHA3 submodule and the polynomial multiplier.
[0010] In one implementation, the read address portion includes: a first read address portion for indicating a storage address of the first input data; and a second read address portion for indicating a storage address of the second input data.
[0011] In one embodiment, the length of each instruction is 37 bits, and the control part is implemented by bits 0 to 6, the first read address part is implemented by bits 7 to 16, the second read address part is implemented by bits 17 to 26, and the write address part is implemented by bits 27 to 36.
[0012] In one implementation, the SHA3 submodule only supports the implementation of the SHA3-256 function, the SHA3-512 function, and the SHAKE128 function.
[0013] In one implementation, the SHA3-256 function, the SHA3-512 function, and the SHAKE128 function are all implemented based on a round function, and the SHA3 submodule implements the round function by using an expansion coefficient of 1 without inserting a pipeline.
[0014] In one embodiment, the instruction set is composed of the following 17 instructions: an instruction for program termination; an instruction for starting a binary sampling submodule; an instruction for starting an encryption submodule; an instruction for starting a decryption submodule; an instruction for starting a verification submodule; an instruction for starting a data bit width conversion submodule; an instruction for starting a polynomial multiplier and instructing to execute an A T ·s; an instruction for starting the polynomial multiplier and instructing to perform a polynomial vector multiplication in A·s′; an instruction for starting the polynomial multiplier and instructing to perform a polynomial vector multiplication in b·s; an instruction for starting the SHA3 submodule and instructing to execute the SHAKE128 function and output a 256-bit message; an instruction for starting the SHA3 submodule and instructing to execute the SHAKE128 function and output a 29925-bit message; an instruction for starting the SHA3 submodule and instructing to execute the SHAKE128 function and output a 6144-bit message The present invention provides an instruction for starting the SHA3 submodule and indicating the execution of the SHA3-256 function and absorbing an 8704-bit message; an instruction for starting the SHA3 submodule and indicating the execution of the SHA3-256 function and absorbing a 512-bit message; an instruction for starting the SHA3 submodule and indicating the execution of the SHA3-256 function and absorbing a 256-bit message; an instruction for starting the SHA3 submodule and indicating the execution of the SHA3-256 function and absorbing a 7936-bit message; and an instruction for starting the SHA3 submodule and indicating the execution of the SHA3-512 function.
[0015] In one embodiment, the storage module includes: a program memory, an instruction modification interface connected to the processor, and the processor receives the modified instructions through the instruction modification interface and saves them in the program memory.
[0016] In one embodiment, the storage module includes: a program memory and a data memory; the control module includes: an instruction reading unit for reading instructions from the program memory; and an instruction parsing and bus management unit for parsing the read instructions and controlling the operation of the corresponding sub-modules based on the results of the parsing, and controlling only the currently operating sub-module to use the data memory.
[0017] The beneficial effects of the present invention are:
[0018] The processor of the embodiment of the present invention is implemented based on hardware (hardware is more efficient than software), so it is naturally efficient. At the same time, the processor uses a custom reduced instruction set. Since the custom reduced instruction is developed for the post-quantum cryptography Saber algorithm, it is efficient on the one hand, and can reduce the control logic on the other hand, thereby saving resource overhead, so it can take into account both efficiency and resource saving. In addition, by analyzing the operations involved in the post-quantum cryptography Saber algorithm, the functional modules that mainly execute the post-quantum cryptography Saber algorithm are reasonably divided into SHA3 submodules, binary sampling submodules, polynomial multipliers, encryption and decryption submodules, verification submodules, and data bit width conversion submodules, and these functional modules are controlled separately; on the one hand, these submodules can be fully reused to reduce resource consumption when implementing the post-quantum cryptography Saber algorithm, and on the other hand, when developing instructions, it is only necessary to design instructions mainly for the above 6 submodules, so as to ensure that the number of instructions will not be too many and the length will not be too long. In summary, the processor for executing the post-quantum cryptography Saber algorithm implemented in hardware in an embodiment of the present invention can reduce resource consumption while being highly efficient, that is, it can take into account both high efficiency and resource consumption. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a structural schematic diagram of an embodiment of a processor for implementing a post-quantum cryptography Saber algorithm of the present invention;
[0020] Figure 2 It is a structural schematic diagram of another embodiment of a processor for implementing a post-quantum cryptography Saber algorithm of the present invention;
[0021] Figure 3 is a schematic diagram of the structure of another embodiment of a processor for implementing a post-quantum cryptography Saber algorithm of the present invention; and
[0022] Figure 4 It is a schematic diagram of the structure of the instruction of the embodiment of the present invention. DETAILED DESCRIPTION
[0023] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention clearer and more understandable, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining the present invention and are not intended to limit the present invention.
[0024] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present invention, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0025] The embodiment of the present invention provides a processor for implementing the post-quantum cryptography Saber algorithm. In view of the problem that in the prior art, when the post-quantum cryptography Saber algorithm is implemented in a pure hardware manner, high efficiency and resource overhead are not taken into account, the reasonable division of functional modules in the processor and the use of a customized reduced instruction set are used to ensure high efficiency during algorithm execution while reducing resource overhead (such as hardware circuit lookup tables, triggers, and transistor circuits). The structure and function of the processor of the embodiment of the present invention are described below in conjunction with the accompanying drawings.
[0026] like Figure 1 , which is a schematic diagram of the structure of an embodiment of a processor for implementing the post-quantum cryptography Saber algorithm of the present invention. The processor 1 can be used as a dedicated processor for implementing the post-quantum cryptography Saber algorithm, such as a co-processor / auxiliary processor dedicated to implementing the post-quantum cryptography Saber algorithm; of course, in addition to being able to implement the post-quantum cryptography Saber algorithm, the processor 1 can also implement other algorithms, such as Figure 1 The processor 1 of the structure shown can be simply expanded to support the Kyber algorithm. When implementing the post-quantum cryptography Saber algorithm, the processor 1 can implement at least one of key generation, key encapsulation and key decapsulation based on the post-quantum cryptography Saber algorithm; in the background technology, the post-quantum cryptography Saber algorithm has been briefly introduced, and the following is combined with the following algorithm 1 to illustrate how the post-quantum cryptography Saber algorithm implements key generation; how the post-quantum cryptography Saber algorithm implements key encapsulation and key decapsulation is not repeated here.
[0027] Algorithm 1: Saber.PKE.KeyGen
[0028]
[0029]
[0030]
[0031]
[0032]
[0033] 6 return(pk:=(seed A , b) , s)
[0034] In Algorithm 1, seed A is a uniformly distributed 256-bit random number seed. A is an l×l polynomial matrix, and the value of l varies according to the security level of the algorithm. The elements of A in the polynomial matrix are 256-order polynomials with 13-bit coefficients. The algorithm defines the generation method of matrix A: the output scalable function SHAKE128 defined by the SHA3 standard is used to generate all the coefficients of the polynomial matrix A. r and seed A Similarly, it is a random number seed, and the algorithm does not strictly define how it is generated. s is a polynomial vector of length 1, and the coefficients of its polynomial elements need to satisfy the binomial distribution. The coefficients of the binomial distribution can be obtained by simply sampling a uniformly distributed pseudo-random number sequence. b is a polynomial vector, which is the main component of the public key. After all calculations are completed, the random number seed seed A It is bit-concatenated with vector b and sent to the client as the public key.
[0035] On the basis of the above, continue to Figure 1 The structure of Figure 1 As shown, the processor 1 includes: a storage module 10, a functional module 11 and a control module 12, wherein the storage module 10 is used to store data and instructions, the functional module 11 is used to execute operations involved in the post-quantum cryptography Saber algorithm, and the control module 12 is between the storage module 10 and the control module 12, and is used to control the functional module 11 to perform corresponding operations according to the instructions in the storage module 10, and at the same time manage the data reading and writing of the storage module 10 by the functional module 11 to implement the post-quantum cryptography Saber algorithm.
[0036] Specifically, the storage module 10 may store a program (composed of instructions) for executing the post-quantum cryptography Saber algorithm, as well as random number seeds and intermediate data and result data generated by the algorithm operation required for executing the post-quantum cryptography Saber algorithm. In this embodiment, the processor 1 uses a customized reduced instruction set, so the instructions stored in the storage module 10 are customized reduced instructions. The so-called "customization" means that the instructions of this embodiment are designed according to the post-quantum cryptography Saber algorithm, and the length of the instruction and the role of each bit (bit, also called bit) are set by this scheme. The use of a customized method can make the instructions targeted so as to improve efficiency and save resources. The so-called "streamlining" is relative to complexity. In the streamlined instruction set, the number of instructions and the addressing mode are streamlined to make it easier to implement, and the degree of parallel execution of instructions is better, and the compilation efficiency is also higher. By using a streamlined instruction set, the operating efficiency of the post-quantum cryptography Saber algorithm can be improved.
[0037] Among them, the functional module 11 is used to perform various operations involved in the post-quantum cryptography Saber algorithm, such as polynomial multiplication, binary sampling and verification, etc. Specifically, the inventor of the present application divides the functional module 11 into 6 sub-modules by analyzing the operations involved in the post-quantum cryptography Saber algorithm and the frequency of occurrence of each operation, such as Figure 1 It should be noted that different technicians may have different divisions of the functional module 11, but the inventor of this application believes that Figure 1 The division method would be a better method because such division is considered from the perspective of saving resource overhead. Such a division method can fully reuse each sub-module to save resource overhead when processor 1 implements the post-quantum cryptography Saber algorithm.
[0038] Specifically, Figure 1 As shown, the functional module 11 includes: a SHA3 (Secure Hash Algorithm 3, third generation secure hash algorithm) submodule 111, a binary sampling submodule 112, a polynomial multiplier 113, an encryption and decryption submodule 114, a verification submodule 115 and a data bit width conversion submodule 116. Among them, the above submodules are independent of each other and realize their respective functions under the control of the control module 12. For example, the SHA3 submodule 11 can generate a Hash hash, the binary sampling submodule 112 can generate a polynomial that satisfies the binomial distribution, the polynomial multiplier 113 (for example, a polynomial multiplier implemented based on the Karatsuba algorithm) can realize polynomial matrix multiplication, the encryption and decryption submodule 114 can realize encryption or decryption of information, the verification submodule 115 can verify whether the post-quantum cryptography Saber algorithm is correct, and the data bit width conversion submodule 116 can adjust the bit width of the data. It should be noted that the operations performed by the above submodules are all operations involved in the post-quantum cryptography Saber algorithm. Since the post-quantum cryptography Saber algorithm is a known algorithm, how the above modules perform the above operations is familiar to those skilled in the art and will not be described in detail here. In addition, the encryption and decryption submodule 114 may further include: an encryption unit and a decryption unit that perform encryption and decryption operations respectively.
[0039] Among them, the control module 12 is used to control each submodule (i.e., 111 to 116) in the function module 11 to perform corresponding operations according to the instructions stored in the storage module 10, so as to realize at least one of key generation, key encapsulation, and key decapsulation in the post-quantum cryptography Saber algorithm. For example, the storage module 10 stores the running program (composed of multiple instructions) of the post-quantum cryptography Saber algorithm, and the control module 12 first takes out the first instruction (for example, the first instruction is used to instruct to execute the SHA3 submodule 11 once) from the storage module 10 in the order of the storage address of the instructions from low to high, and then the control module 101 parses the instruction, and based on the result of the parsing, controls the SHA3 submodule 11 to execute once; after SHA3 is executed once, it outputs a completion indication to the control module 12, and then the control module 12 takes out the second instruction, and so on, to complete the execution of all instructions, thereby realizing the post-quantum cryptography Saber algorithm.
[0040] The processor of this embodiment is implemented based on hardware (hardware is more efficient than software), so it is naturally efficient. At the same time, the processor uses a custom reduced instruction set. Since the custom reduced instruction is developed for the post-quantum cryptography Saber algorithm, it is efficient on the one hand, and can reduce the control logic on the other hand, thereby saving resource overhead, so it can take into account both efficiency and resource saving. In addition, by analyzing the operations involved in the post-quantum cryptography Saber algorithm, the functional modules that mainly execute the post-quantum cryptography Saber algorithm are reasonably divided into SHA3 submodules, binary sampling submodules, polynomial multipliers, encryption and decryption submodules, verification submodules, and data bit width conversion submodules, and these functional modules are controlled separately; on the one hand, these submodules can be fully reused to reduce resource consumption when implementing the post-quantum cryptography Saber algorithm, and on the other hand, when developing instructions, it is only necessary to design instructions mainly for the above 6 submodules, so as to ensure that the number of instructions will not be too many and the length will not be too long. In summary of the above aspects, the processor for executing the post-quantum cryptography Saber algorithm implemented in hardware in the embodiment of the present invention can reduce resource consumption while being efficient, that is, taking into account the problems of efficiency and resource consumption at the same time.
[0041] like Figure 2 and 3 FIG. 1 is a schematic diagram of the structure of another embodiment of the processor of the present invention. Figure 2 In Figure 1 The storage module 10 and the control module 12 are further illustrated. Figure 2As shown, the storage module 10 may include: a program memory 101 and a data memory 102. Among them, the program memory 101 is used to store programs (composed of instructions), such as programs that implement the post-quantum cryptography Saber algorithm; the data memory 102 is used to store data, such as random number seeds, intermediate data and result data of the post-quantum cryptography Saber algorithm during operation, etc. In one embodiment, the program memory 101 is connected to the instruction modification interface (not shown) of the processor 1, and the program (i.e., instruction) stored in the program memory can be modified through the instruction modification interface to increase the scalability of the processor 1.
[0042] Continue as Figure 2 As shown, the control module 12 includes: an instruction reading unit 121 and an instruction parsing and bus management unit 122. Among them, the instruction reading unit 121 is used to read instructions from the program memory 101, for example, reading in order from low to high addresses. The instruction parsing and bus management unit 122 is used to parse the instructions read by the instruction reading unit 121, and based on the results of the parsing, start the corresponding sub-modules (i.e., 111 to 116) to perform related operations; at the same time, the instruction parsing and bus management unit 122 controls only the started sub-modules to use the data memory, such as reading data from the data memory or writing data to the data memory. In one embodiment, the instruction parsing and bus management unit 122 can be further decomposed into an instruction parsing sub-unit and a bus management sub-unit, which are not repeated here.
[0043] like Figure 3 As shown, it not only shows the main modules of the processor 1, but also shows the main external interfaces of the processor 1, wherein DI is the above-mentioned instruction modification interface, which is used to receive input instructions and store them in the program memory 101. CTR is a control signal interface, which is used to receive external control signals to the processor. DIO is a data input / output interface. RST is a reset interface, which is used to receive a reset signal. CLK is a clock interface. FLAG is a status signal interface, which is used to output a processor status signal.
[0044] Through the above Figures 1 to 3 The specific structure of the processor in the embodiment of the present invention has been described in detail. The following is a further description of the above-mentioned custom reduced instruction set.
[0045] like Figure 4 As shown, it is a schematic diagram of the format of a customized simplified instruction of an embodiment of the present invention. As shown in the figure, the length of the simplified instruction of the embodiment of the present invention is fixed, and each instruction includes:
[0046] The control part 41 is used to indicate the submodule to be started (i.e. Figure 1111~116) and their working modes. In this embodiment, only the SHA3 submodule and the polynomial multiplier have multiple working modes, so these two modules need to specifically indicate their working modes. For example, the M0 bit is used as the SHA3 submodule startup flag bit, which can be used to indicate whether the SHA3 submodule is started. For example, when it is "1", it indicates that the SHA3 submodule is started, and when it is "0", it indicates that the SHA3 submodule is not started. The M1 bit is used as the startup flag bit of the polynomial multiplier to indicate whether the polynomial multiplier is started. For example, when it is "1", it indicates that the polynomial multiplier is started, and when it is "0", it indicates that the polynomial multiplier is not started. The remaining M2~M6 are the remaining submodule startup flag bits and mode control bits, which are used to indicate which of the remaining submodules is started or the working mode of the SHA3 submodule and the polynomial multiplier. For example, when M1 and M0 are both 0, and M6~M2 are "00001", it means that the binary sampling submodule is started; for another example, when M1 is "0", M0 is "1", and M6~M2 are "00001", it can mean that the SHA3 submodule is started, and the SHA3 submodule works in the mode of "executing SHAKE128 function and outputting 256-bit message".
[0047] In this embodiment, the working modes of the SHA3 submodule may include: a mode of executing the SHAKE128 function and outputting a 256-bit message, a mode of executing the SHAKE128 function and outputting a 29925-bit message, a mode of executing the SHAKE128 function and outputting a 6144-bit message, a mode of executing the SHA3-256 function and absorbing an 8704-bit message, a mode of executing the SHA3-256 function and absorbing a 512-bit message, a mode of executing the SHA3-256 function and absorbing a 256-bit message, a mode of executing the SHA3-256 function and absorbing a 7936-bit message, and a mode of executing the SHA3-512 function. The working modes of the polynomial multiplier may include: executing once A T ·s, a mode of performing the polynomial-vector multiplication in A·s′ once, and a mode of performing the polynomial-vector multiplication in b·s once.
[0048] Wherein, the read address part 42 is used to indicate the storage address of the input data. In the figure, the read address part 42 includes a first read address part 421 and a second read address part 422, which are respectively used to indicate the storage addresses of two input data. Specifically, the read address part 42 is implemented by the 7th to 26th bits of the instruction, namely A0 to A9 and B0 to B9; wherein A0 to A9 are used to implement the first read address part 421, which stores the storage address of the first input data, such as the starting address of the first input data; B0 to B9 are used to implement the second read address part 422, which stores the storage address of the second input data, such as the starting address of the second input data. In this embodiment, since the read address part 42 includes: the storage address of two input data, it helps to speed up the working efficiency of the polynomial multiplier, because it can obtain two input data through one instruction. However, in actual applications, it is also possible for the read address part 42 to include only the storage address of one input data, but this will affect the working efficiency of the polynomial multiplier. When the read address part 42 includes only the storage address of one input data, the instruction of this embodiment consists of 27 bits.
[0049] The write address part 43 is used to indicate the storage address where the output data will be written. In the figure, it is implemented by R0 to R9; it should be noted that the output data here is not necessarily the final output data of the post-quantum cryptography Saber algorithm, but can also be the data generated when executing the above submodules.
[0050] In summary, the embodiment of the present invention can indicate the following through one instruction: the submodule to be started; if the submodule to be started has multiple working modes, also indicate its working mode; where to get the input data; where to store the output data obtained after the operation. It can be seen that the above instruction format is simple and the number of bits is reasonable (37 bits), so at runtime, it can efficiently control the work of each submodule, thereby realizing the post-quantum cryptography Saber algorithm.
[0051] exist Figure 4 In the embodiment of the present invention, the format of the customized simplified instruction is described. The instruction set of the embodiment of the present invention is described below. In the embodiment of the present invention, in order to implement the post-quantum cryptography Saber algorithm, based on the division method of the functional modules, the instructions of the embodiment of the present invention may include 17 items, for example: an instruction for program termination; an instruction for starting the binary sampling submodule; an instruction for starting the encryption submodule; an instruction for starting the decryption submodule; an instruction for starting the verification submodule; an instruction for starting the data bit width conversion submodule; an instruction for starting the polynomial multiplier and indicating the execution of an A T·s; an instruction for starting the polynomial multiplier and instructing to perform a polynomial vector multiplication in A·s′; an instruction for starting the polynomial multiplier and instructing to perform a polynomial vector multiplication in b·s; an instruction for starting the SHA3 submodule and instructing to execute the SHAKE128 function and output a 256-bit message; an instruction for starting the SHA3 submodule and instructing to execute the SHAKE128 function and output a 29925-bit message; an instruction for starting the SHA3 submodule and instructing to execute the SHAKE128 function and output a 6144-bit message Instructions for starting the SHA3 submodule and instructing to execute the SHA3-256 function and absorb (input) 8704-bit messages; instructions for starting the SHA3 submodule and instructing to execute the SHA3-256 function and absorb (input) 512-bit messages; instructions for starting the SHA3 submodule and instructing to execute the SHA3-256 function and absorb 256-bit messages; instructions for starting the SHA3 submodule and instructing to execute the SHA3-256 function and absorb 7936-bit messages; and instructions for starting the SHA3 submodule and instructing to execute the SHA3-512 function. Using the combination of these 17 instructions, the embodiment of the present invention can implement the post-quantum cryptography Saber algorithm.
[0052] It should be noted that, as can be seen from the above instructions, the SHA3 submodule implements the SHA3-256 function, the SHA3-512 function, and the SHAKE128 function. Generally speaking, the SHA3 algorithm involves a total of 6 functions, and the embodiment of the present invention is based on the post-quantum cryptography Saber algorithm and actually only uses three of them. Therefore, the SHA3 submodule is designed to only support the SHA3-256 function, the SHA3-512 function, and the SHAKE128 function, so that the structure of the SHA3 submodule can be simplified. In addition, the SHA3-256 function, the SHA3-512 function, and the SHAKE128 function are all implemented based on the round function. In the SHA3 submodule of the embodiment of the present invention, the expansion coefficient is 1, and the round function is implemented without inserting the pipeline, so that resource overhead can be saved. Generally speaking, the higher the expansion coefficient, the better the performance of the SHA3 submodule, that is, the more efficient; however, it is not the module with the highest performance that determines the overall performance of the system, but the module with the lowest performance. The high efficiency of the SHA3 algorithm hardware implementation means that even without special optimization, it will not become a bottleneck restricting the performance of the key exchange system in theory. In the post-quantum cryptographic system, most of the modules that restrict system performance are polynomial multipliers. Therefore, when designing the SHA3 submodule, this scheme mainly determines the design scheme from the perspective of saving resource overhead, that is, using an expansion coefficient of 1 and not inserting a pipeline to implement the round function.
[0053] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A processor for implementing the post-quantum cryptography Saber algorithm, the processor being implemented by hardware, characterized in that: The processor comprises: A storage module, used for storing data and instructions, wherein the processor uses a user-defined reduced instruction set, and the instructions stored in the storage module are instructions in the instruction set; A functional module, used to perform operations involved in the post-quantum cryptography Saber algorithm, and the functional module includes the following submodules: a third-generation secure hash algorithm SHA3 submodule, a binary sampling submodule, a polynomial multiplier, an encryption and decryption submodule, a verification submodule, and a data bit width conversion submodule; and A control module is used to control each sub-module in the functional module to perform corresponding operations according to the instructions stored in the storage module, so as to realize at least one of key generation, key encapsulation and key decapsulation in the post-quantum cryptography Saber algorithm.
2. The processor according to claim 1, characterized in that The length and format of each instruction in the custom reduced instruction set are the same, and each instruction includes: The control part is used to indicate the submodule to be started and the working mode of the submodule; A read address portion, used to indicate a storage address of input data; and The write address part is used to indicate the storage address of the output data.
3. The processor according to claim 2, characterized in that The SHA3 submodule and the polynomial multiplier both have multiple operating modes, and the control part includes: 7 bits, wherein 2 of the 7 bits are used as start flag bits for the SHA3 submodule and the polynomial multiplier, and the remaining 5 bits are used as start flag bits for the remaining submodules and mode control bits for the SHA3 submodule and the polynomial multiplier.
4. The processor according to claim 2, characterized in that The read address part includes: a first read address part for indicating a storage address of first input data; and a second read address part for indicating a storage address of second input data.
5. The processor according to claim 4, characterized in that The length of each instruction is 37 bits, and the control part is implemented by bits 0 to 6, the first read address part is implemented by bits 7 to 16, the second read address part is implemented by bits 17 to 26, and the write address part is implemented by bits 27 to 36.
6. The processor according to claim 1, wherein: The SHA3 submodule only supports the implementation of SHA3-256 function, SHA3-512 function and SHAKE128 function.
7. The processor according to claim 6, characterized in that The SHA3-256 function, SHA3-512 function and SHAKE128 function are all implemented based on the round function, and the SHA3 submodule uses an expansion coefficient of 1 and does not insert a pipeline to implement the round function.
8. The processor according to any one of claims 1 to 7, characterized in that: The instruction set consists of the following 17 instructions: Instructions for program termination; Instructions for starting the binary sampling submodule; Instructions for starting the encryption submodule; Instructions for starting the decryption submodule; Instructions for starting the verification submodule; Instructions for starting the data width conversion submodule; Used to start the polynomial multiplier and indicate the execution of A T Instructions for polynomial-vector multiplication in s; An instruction for starting a polynomial multiplier and instructing to perform a polynomial vector multiplication in A·s′; An instruction for starting a polynomial multiplier and instructing to perform a polynomial vector multiplication in b·s; Instructions for starting the SHA3 submodule and instructing to execute the SHAKE128 function and output a 256-bit message; Instructions for starting the SHA3 submodule and instructing to execute the SHAKE128 function and output a 29925-bit message; Instructions for starting the SHA3 submodule and instructing to execute the SHAKE128 function and output a 6144-bit message; Instructions for starting the SHA3 submodule and instructing to execute the SHA3-256 function and absorb an 8704-bit message; Instructions for starting the SHA3 submodule and instructing to execute the SHA3-256 function and absorb a 512-bit message; Instructions for starting the SHA3 submodule and instructing to execute the SHA3-256 function and absorb a 256-bit message; Instructions for starting the SHA3 submodule and instructing to execute the SHA3-256 function and absorb a 7936-bit message; and Instructions for starting the SHA3 submodule and instructing execution of the SHA3-512 function.
9. The processor according to claim 1, wherein: The storage module includes: a program memory connected to an instruction modification interface of the processor, and the processor receives modified instructions through the instruction modification interface and saves the modified instructions into the program memory.
10. The processor according to claim 1, wherein: The storage module includes: a program memory and a data memory; the control module includes: an instruction reading unit, configured to read instructions from the program memory; and The instruction parsing and bus management unit is used to parse the read instruction, and control the corresponding submodule to work based on the parsing result, and control only the currently working submodule to use the data memory.
