Efficient storage architecture based on anti-quantum encryption algorithm

By designing an efficient storage architecture, we solve the problems of inefficiency and resource waste in the hardware design of the NTT algorithm storage architecture, achieve efficient hardware implementation of the Dilithium and Kyber algorithms, and improve computing speed and resource utilization efficiency.

CN118798376APending Publication Date: 2024-10-18HARBIN ENG UNIV

Patent Information

Application Number
CN202410927973.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

There are read and write conflicts, storage leap access, algorithm design issues, large storage overhead, and waste of storage resources in the existing NTT algorithm storage architecture hardware design. In addition, most hardware implementations are only suitable for one algorithm, making it difficult to efficiently implement lattice-based post-processing. Quantum encryption algorithms such as Dilithium and Kyber.

Method used

An efficient storage architecture based on anti-quantum encryption algorithm is designed, including NTT module, BRAM storage module, Keccak module, sampling module and pre-processing module, using dual-port BRAM, segmented pipeline processing and multi-core parallel processing, supporting four channels Parallel point multiplication and bidirectional data transfer for polynomial multiplication and hash operations.

Benefits of technology

It significantly improves the calculation speed of polynomial multiplication, reduces BRAM consumption, improves storage resource utilization efficiency, enhances the versatility and flexibility of the system, and realizes efficient hardware implementation of Dilithium and Kyber algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118798376A_ABST
    Figure CN118798376A_ABST
Patent Text Reader

Abstract

The invention discloses an efficient storage architecture based on an anti-quantum encryption algorithm, and relates to the field of post-quantum information security. In order to solve the technical problems that in the prior art, read-write conflicts, storage leap-over access and algorithm design problems exist in current NTT algorithm storage architecture hardware design, storage overhead is large, storage resources are wasted, and most of hardware implementation is only suitable for one algorithm, the invention provides an NTT algorithm storage architecture. According to the technical scheme, the efficient storage architecture based on the anti-quantum encryption algorithm comprises an NTT module used for executing continuous NTT / INTT and four-way parallel point multiplication; the BRAM storage module is used for storing polynomials of keys, signatures and intermediate results; the Keccak module is used for generating random numbers which are applied to the Kyber and the Diithium; the sampling module is used for generating a polynomial ring matrix, a polynomial ring vector and a ternary polynomial ring; and the preprocessing module is used for processing the operation after the NTT and INTT calculation and reducing the read-write frequency of the BRAM. The method can be applied to post-quantum information security storage work.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] It involves the field of post-quantum information security, and specifically involves the design of post-quantum information security storage based on dilithium and kyber storage architecture. Background Art

[0002] On July 5, 2022, the National Institute of Standards and Technology (NIST) announced the algorithms that will be standardized and decided to start the fourth round for follow-up research. Among them, the standardized algorithm for the key encapsulation scheme is CRYSTALS-Kyber (hereinafter referred to as Kyber), and the standardized algorithms for the digital signature scheme are CRYSTALS-Dilithium (hereinafter referred to as Dilithium), FALCON, and SPHINCS+, and the implementation of the Dilithium algorithm is particularly recommended. Of these four algorithms, only SPHINCS+ is hash-based, and the other three algorithms are lattice-based cryptographic schemes. Lattice-based cryptography shows great potential due to its ability to resist quantum attacks. Due to the security requirements of high-precision Gaussian sampling and complex polynomial multiplication on the ring, as well as the storage of large public keys, it is extremely challenging but also important to implement lattice-based schemes on resource-constrained devices.

[0003] Kyber and Dilithium are part of the Algebraic Lattice Cryptography Suite (CRYSTALS), which was selected for standardization by the National Institute of Standards and Technology (NIST). Kyber’s security relies on the difficulty of solving the Modular Lattices Learning with Errors (MLWE) problem, while Dilithium’s security is based on MLWE and the Shortest Integer Solution (SIS) problem.

[0004] Deepraj Soni et al. implemented the hardware design based on High-Level Synthesis (HLS) for the second round of Dilithium, and used optimizations such as loop unrolling and loop pipelining to improve the latency of the algorithm implementation and thus accelerate the algorithm. However, due to its HLS-based implementation method, it is impossible to optimize the hardware structure for Dilithium. In addition, a common design framework and a common target FPGA platform were used to implement multiple post-quantum encryption algorithms and digital signature algorithms, and a comparative analysis was made in terms of resources and performance. Ni Z et al. proposed an ultra-lightweight BRAM-free iterative NTT based on a CRYSTAL-Kyber compatible polynomial multiplication architecture. The architecture uses three FIFOs (First Input First Output) with different storage orders to eliminate the BRAM required for traditional iterative NTT designs, saving a lot of on-chip storage resources, and is suitable for area-constrained applications such as IoT edge nodes.

[0005] Chen Tao and others designed a 32-way parallel overall computing architecture based on the Kyber algorithm. On this basis, they designed a unified computing unit that matches the architecture and a storage unit with no conflicts in data reading and writing and optimal address allocation. However, this architecture has some limitations on parallel design.

[0006] There are a large number of polynomial multiplication operations in lattice cryptography, which leads to long processing time and large storage requirements. In addition, compared with traditional public key encryption algorithms, lattice cryptography is more complex and contains some abnormal functions, which makes it very difficult to efficiently implement Dilithium and Kyber on hardware. In the current hardware design of NTT algorithm storage architecture, there are mainly problems such as read-write conflict, storage leap access, algorithm design problems, high storage overhead, and waste of storage resources. At the same time, when studying the ultra-low power memory architecture design of lattice cryptography chips, most hardware implementations are only suitable for one algorithm. Summary of the invention

[0007] In order to solve the technical problems in the prior art, the current NTT algorithm storage architecture hardware design has read-write conflicts, storage leap access, algorithm design problems, large storage overhead, storage resource waste, and most hardware implementations are only suitable for one algorithm. The technical solution provided by the present invention is:

[0008] An efficient storage architecture based on a quantum-resistant encryption algorithm, the architecture comprising:

[0009] NTT module, used to perform continuous NTT / INTT and four-way parallel point multiplication;

[0010] BRAM storage module, used to store polynomials of keys, signatures and intermediate results;

[0011] Keccak module, used to generate random numbers for Kyber and Dilithium;

[0012] A sampling module for generating polynomial ring matrices, polynomial ring vectors and three-valued polynomial rings;

[0013] The preprocessing module is used to process the operations after NTT and INTT calculations to reduce the number of BRAM reads and writes.

[0014] Furthermore, a preferred implementation is provided, in which a dual-port BRAM is used to implement a BRAM storage module, and the storage method is a segmented pipeline processing method.

[0015] Furthermore, a preferred embodiment is provided, wherein the Keccak module includes three Keccak-f

[1600] core modules.

[0016] Furthermore, a preferred embodiment is provided, wherein the sampling module comprises 6 submodules, which are respectively used for different sampling requirements of Kyber and Dilithium.

[0017] Furthermore, a preferred implementation is provided, wherein the preprocessing module supports bidirectional data transmission, thereby improving system efficiency.

[0018] Based on the same inventive concept, the present invention also provides an efficient storage method based on a quantum-resistant encryption algorithm, which is implemented based on the architecture, including:

[0019] Dilithium algorithm:

[0020] Steps to generate public and private keys;

[0021] A step of generating a polynomial matrix and a mask vector according to the private key;

[0022] A step of generating a polynomial matrix according to the private key;

[0023] Kyber Algorithm:

[0024] Steps to generate public and private keys;

[0025] According to the public key, a matrix and a vector are obtained to generate a ciphertext;

[0026] The step of obtaining a decryption result according to the private key and the ciphertext.

[0027] Based on the same inventive concept, the present invention also provides an efficient storage device based on a quantum-resistant encryption algorithm, which is implemented based on the architecture and includes:

[0028] Dilithium Module:

[0029] Submodule for generating public and private keys;

[0030] A submodule for generating a polynomial matrix and a mask vector according to the private key;

[0031] A submodule for generating a polynomial matrix according to the private key;

[0032] Kyber Modules:

[0033] Submodule for generating public and private keys;

[0034] According to the public key, a matrix and a vector are obtained to generate a submodule of ciphertext;

[0035] A submodule for obtaining a decryption result is obtained according to the private key and the ciphertext.

[0036] Based on the same inventive concept, the present invention also provides a computer storage medium for storing a computer program. When the computer program is read by a computer, the computer executes the method described.

[0037] Based on the same inventive concept, the present invention also provides a computer, including a processor and a storage medium. When the processor reads a computer program stored in the storage medium, the computer executes the method described.

[0038] Based on the same inventive concept, the present invention also provides a computer program product, which is a computer program. When the computer program is read, the method described above is implemented.

[0039] Compared with the prior art, the technical solution provided by the present invention is beneficial in that:

[0040] The efficient storage architecture based on quantum-resistant encryption algorithm provided by the present invention is designed to accelerate polynomial multiplication, and includes four butterfly units that can perform continuous NTT / INTT and four-way parallel point multiplication. The calculation speed of polynomial multiplication is greatly improved, making the entire encryption and decryption process more efficient. Compared with other studies that only use a single NTT unit, this design significantly reduces the operation time through parallel processing.

[0041] The invention provides an efficient storage architecture based on a quantum-resistant encryption algorithm, using a dual-port BRAM array, a segmented pipeline processing method, and a dynamic matrix calculation strategy. The BRAM consumption is effectively reduced and the utilization efficiency of storage resources is improved. In existing research, the high consumption of BRAM is often a performance bottleneck, and the method reduces the demand for hardware resources by optimizing the storage structure.

[0042] The invention provides an efficient storage architecture based on a quantum-resistant encryption algorithm, comprising three Keccak-f

[1600] core modules for constructing SHA3-256, SHA3-512, SHAKE-128 and SHAKE-256 modules. The hash operations required by different algorithms can be processed in parallel, thereby improving the efficiency of generating random numbers. Compared with the design of a single Keccak core module, the scheme reduces the computing time through multi-core parallel processing.

[0043] The efficient storage architecture based on the quantum-resistant encryption algorithm provided by the present invention is composed of 6 submodules, which are used to generate different polynomial ring matrices, polynomial ring vectors and ternary polynomial rings in Kyber and Dilithium algorithms. The versatility and flexibility of the system are enhanced, and the sampling method can be dynamically adjusted according to the requirements of different algorithms. In existing research, a dedicated sampling module is usually designed for each algorithm, and this scheme realizes efficient reuse of resources through a unified sampling module design.

[0044] The efficient storage architecture based on quantum-resistant encryption algorithm provided by the present invention processes various operations after NTT and INTT calculations and supports bidirectional data transmission. The number of BRAM reads and writes is reduced, and the overall running time and hardware resource consumption of the system are reduced. Compared with the unidirectional data transmission method used in other studies, this design improves the efficiency of data processing.

[0045] The efficient storage architecture based on the quantum-resistant encryption algorithm provided by the present invention has achieved significant improvements in the hardware implementation efficiency and resource utilization of the quantum-resistant encryption algorithm, and has broad application prospects.

[0046] The efficient storage architecture based on the quantum-resistant encryption algorithm provided by the present invention can be applied to the work of post-quantum information security storage. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a schematic diagram of the system architecture and data flow;

[0048] Figure 2 This is the data path diagram of the Dilithium key generation phase;

[0049] Figure 3 This is the data path diagram of the Dilithium signature phase;

[0050] Figure 4 This is the data path diagram of the Dilithium verification phase;

[0051] Figure 5 This is the data path diagram of the Kyber.CPA key generation phase;

[0052] Figure 6This is the data path diagram of the Kyber.CPA encryption phase;

[0053] Figure 7 This is the data path diagram of the Kyber.CPA decryption phase. DETAILED DESCRIPTION

[0054] In order to make the advantages and benefits of the technical solution provided by the present invention more clearly reflected, the technical solution provided by the present invention is now further described in detail with reference to the accompanying drawings, specifically:

[0055] Implementation method 1: This implementation method provides an efficient storage architecture based on a quantum-resistant encryption algorithm, and the architecture includes:

[0056] NTT module, used to perform continuous NTT / INTT and four-way parallel point multiplication;

[0057] BRAM storage module, used to store polynomials of keys, signatures and intermediate results;

[0058] Keccak module, used to generate random numbers for Kyber and Dilithium;

[0059] A sampling module for generating polynomial ring matrices, polynomial ring vectors and three-valued polynomial rings;

[0060] The preprocessing module is used to process the operations after NTT and INTT calculations to reduce the number of BRAM reads and writes.

[0061] Specific:

[0062] This implementation proposes an efficient storage architecture design method based on quantum-resistant encryption algorithms, aiming to improve the execution efficiency of Kyber and Dilithium algorithms by optimizing storage and computing resources. The system architecture includes NTT module, BRAM storage module, Keccak module, sampling module and preprocessing module.

[0063] like Figure 1 As shown, the system architecture is as follows:

[0064] NTT Module:

[0065] Speed ​​up polynomial multiplication.

[0066] Contains four butterfly units that can perform continuous NTT / INTT and four-way parallel point multiplication.

[0067] BRAM memory module:

[0068] Use a dual-port BRAM array.

[0069] Polynomials that store keys, signatures, and intermediate results.

[0070] A segmented pipeline processing method is used to reduce BRAM consumption.

[0071] Keccak Module:

[0072] Generates random numbers for use with Kyber and Dilithium.

[0073] Contains three Keccak-f

[1600] core modules, which can be instantiated into SHA3-256, SHA3-512, SHAKE-128 and SHAKE-256 modules.

[0074] Sampling module:

[0075] Generates polynomial ring matrices, polynomial ring vectors, and ternary polynomial rings.

[0076] Contains 6 submodules, each for different sampling needs of Kyber and Dilithium.

[0077] Preprocessing module:

[0078] Process the operations after NTT and INTT calculations to reduce the number of BRAM reads and writes.

[0079] Supports two-way data transmission to improve system efficiency.

[0080] Implementation method 2: This implementation method further limits the efficient storage architecture based on the quantum-resistant encryption algorithm provided in implementation method 1. A dual-port BRAM is used to implement a BRAM storage module, and the storage method is a segmented pipeline processing method.

[0081] Implementation method three: This implementation method further limits the efficient storage architecture based on the quantum-resistant encryption algorithm provided in implementation method one, and the Keccak module includes three Keccak-f

[1600] core modules.

[0082] Implementation method 4: This implementation method further limits the efficient storage architecture based on the quantum-resistant encryption algorithm provided in implementation method 1. The sampling module includes 6 sub-modules, which are used for different sampling requirements of Kyber and Dilithium respectively.

[0083] Implementation method five: This implementation method further limits the efficient storage architecture based on the quantum-resistant encryption algorithm provided in implementation method one. The preprocessing module supports bidirectional data transmission to improve system efficiency.

[0084] Implementation 6: This implementation provides an efficient storage method based on a quantum-resistant encryption algorithm, which is implemented based on the architecture provided in Implementation 1 and includes:

[0085] Dilithium algorithm:

[0086] Key generation phase ( Figure 2 )

[0087] Step 1: The Keccak module generates a random seed using SHAKE256.

[0088] Output: Random seed.

[0089] Step 2: The sampling module generates the polynomial matrix and the secret polynomial using the random seed.

[0090] Input: Random seed.

[0091] Output: polynomial matrix and secret polynomial.

[0092] Step 3: The NTT module converts the polynomial into the NTT domain, performs point multiplication and INTT transformation, and generates public and private keys.

[0093] Input: polynomial matrix and secret polynomial.

[0094] Output: public key and private key.

[0095] Signature generation phase ( Figure 3 )

[0096] Step 4: After the private key is unpacked, it is hashed with the message to generate a signature.

[0097] Input: private key and message.

[0098] Output: hash value.

[0099] Step 5: Generate the polynomial matrix and mask vector through the NTT module and sampling module.

[0100] Input: Hash value.

[0101] Output: polynomial matrix and mask vector.

[0102] Step 6: Generate signature and verify.

[0103] Input: polynomial matrix and mask vector.

[0104] Output: Signature.

[0105] Signature verification phase ( Figure 4 )

[0106] Step 7: Unpack the public key and perform hash verification.

[0107] Input: public key and signature.

[0108] Output: Verification result.

[0109] Step 8: Generate the polynomial matrix and perform dot multiplication and INTT operations. Input: Verify the results.

[0110] Output: polynomial matrix calculation results.

[0111] Step 9: Verify the signature result.

[0112] Input: Polynomial matrix calculation results.

[0113] Output: Final verification result.

[0114] Kyber Algorithm:

[0115] Key generation phase ( Figure 5 )

[0116] Step 1: Generate a random byte array and hash it via SHA3-512. Output: hash value.

[0117] Step 2: The sampling module uses the hash value to generate the matrix and polynomial vector. Input: hash value.

[0118] Output: Matrix and polynomial vector.

[0119] Step 3: The NTT module calculates and generates the public key and private key.

[0120] Input: Matrix and polynomial vector.

[0121] Output: public key and private key.

[0122] Encryption phase( Figure 6 )

[0123] Step 4: Public key, message and seed as input.

[0124] Input: public key, message and seed.

[0125] Output: Initial data.

[0126] Step 5: The sampling module generates matrices and vectors using the initial data. Input: Initial data.

[0127] Output: matrix and vector.

[0128] Step 6: The NTT module performs calculations and generates ciphertext.

[0129] Input: matrices and vectors.

[0130] Output: ciphertext.

[0131] Decryption phase ( Figure 7 )

[0132] Step 7: Decode the ciphertext and decompress it.

[0133] Input: ciphertext.

[0134] Output: decoded data.

[0135] Step 8: The NTT module is generated and calculated, and multiplied with the private key and INTT operation is performed.

[0136] Input: decoded data and private key.

[0137] Output: decryption result.

[0138] Step 9: Output the decrypted message.

[0139] Input: Decryption result.

[0140] Output: Decrypted message.

[0141] Embodiment 8: This embodiment provides a computer storage medium for storing a computer program. When the computer program is read by a computer, the computer executes the method provided in embodiment 6.

[0142] Embodiment 9: This embodiment provides a computer, including a processor and a storage medium. When the processor reads a computer program stored in the storage medium, the computer executes the method provided in embodiment 6.

[0143] Embodiment 10: This embodiment provides a computer program product, which is a computer program. When the computer program is read, the method provided in embodiment 6 is implemented.

[0144] Implementation Method XI: Combination Figure 1-7 This embodiment is described in detail by using specific examples to further describe the technical solution provided above. Specifically:

[0145] This implementation aims to solve the problems of low efficiency, large storage space usage, and large intermediate result storage requirements in existing post-quantum cryptographic algorithms, especially algorithms such as CRYSTALS-Dilithium and CRYSTALS-Kyber, when performing operations such as key generation, encapsulation, decapsulation, signature generation, and signature verification.

[0146] Kyber and Dilithium are part of the Algebraic Lattice Cryptography Suite (CRYSTALS), which was selected for standardization by the National Institute of Standards and Technology (NIST). Kyber's security relies on the difficulty of solving the modular lattice learning with errors (MLWE) problem, while Dilithium's security is based on MLWE and the shortest integer solution (SIS) problem. We perform data dependency analysis on each stage of the Dilithium signature scheme and the Kyber key encapsulation scheme, considering the possibility that each functional module can be run in parallel during instruction execution. The data flow path optimization is mainly aimed at reducing storage space. Multiple pipelines are used in parallel to process the operations in the algorithm in a parallel pipeline manner. The pipeline can reduce the storage requirements of intermediate results and reduce memory access.

[0147] Dilithium has three main algorithms: key generation (KeyGen), signature generation (Sign), and signature verification (Verify). The sender uses the key generation algorithm to generate a public key and a secret key. He then signs the message using his private key and the signature generation algorithm. The receiver can verify the signature using the sender's public key and the signature verification algorithm. The signature generation algorithm continuously generates signatures until a valid signature is generated. In order for the signature to be valid, a set of constraints must be met to ensure that the signature does not have any similarities to the message. The Dilithium algorithm is composed of the following building blocks: polynomial generation (ExpandMask(), SampleInBall()), polynomial arithmetic operations (NTT), hash functions (SHAKE-256), Power2Round(), decomposition and other related functions (Decompress(), HighBits() / LoweBits(), MakeHint() / Usehint(), Pack() / Unpack()).

[0148] Kyber is an IND-CCA2 secure key wrapping scheme. There are three main algorithms for Kyber.CCA: key generation (Kyber.CCA.KeyGen), encapsulation (Kyber.CCA.Enc), and decapsulation (Kyber.CCA.Dec). The receiver generates a public key and a secret key using the key generation algorithm and broadcasts the public key. When the sender wishes to send a message, the message can be wrapped with the receiver’s public key using the wrapping algorithm. The receiver can then decapsulate it using his secret key using the decapsulation scheme. The implementation of Kyber.CCA is built on Kyber.CPA using the Fujisaki-Okamoto transform. Kyber.CPA consists of three parts: key generation (Kyber.CPA.KeyGen), encryption (Kyber.CPA.Enc), and decryption (Kyber.CPA.Dec). The Kyber algorithm is composed of the following building blocks: pseudo-random functions (SHAKE-256, SHAKE-128), hash functions (SHA3-256, SHA3-512), key derivation functions (SHAKE-256), polynomial arithmetic operations (NTT), samplers (Parse, CBD), Encode() / Decode(), Compress() / Decompress().

[0149] The embodiments of the present invention are further described in detail below with reference to the accompanying drawings.

[0150] like Figure 1 The system architecture designed by the present invention is demonstrated, which is applicable to both Dilithium and Kyber algorithms, including NTT module, BRAM storage module, Keccak module, sampling module and some modules for specific processing of different algorithms.

[0151] Among them, the NTT module is designed to accelerate polynomial multiplication. It contains four butterfly units that can be used to calculate NTT / INTT / four-way parallel point multiplication. It can perform continuous NTT / INTT on multiple polynomials. When calculating multiplication, the four butterfly units are reused, and four modular multiplications and four modular additions are performed in each cycle.

[0152] The BRAM storage module uses a dual-port BRAM array to store polynomials of keys, signatures and intermediate results. In the present invention, a segmented pipeline processing method, a dynamic matrix calculation strategy and effective use of the BRAM array are used, and the consumption of BRAM in our design is very low.

[0153] The Keccak-f

[1600] core module can be used to construct SHA3-256, SHA3-512, SHAKE-128 and SHAKE-256 modules for generating random numbers in Kyber and Dilithium. Three Keccak-f

[1600] core modules are generated in our circuit. These three modules can be instantiated into the required SHA3 modules according to the different algorithms they are in. For example, in Dilithium's sign, two Keccak-f

[1600] core modules are instantiated as SHAKE-128 to generate the NTT domain value A of the polynomial ring matrix, and another Keccak-f

[1600] core module is instantiated as SHAKE-256 to generate the polynomial ring vector y. This can realize parallel processing of the sign process, thereby improving the algorithm efficiency.

[0154] The SAMPLE module is used to generate different polynomial ring matrices, polynomial ring vectors, and ternary polynomial rings in the Kyber and Dilithium algorithms. It consists of 6 sub-sampling modules. Parse and CBD are used in the Kyber algorithm, and SampleA, SampleS, SampleC, and ExpandMask are used in the Dilithium algorithm. SampleA, SampleS, Parse, and ExpandMask use uniform sampling, and except for ExpandMask, the other three have additional rejection modules; CBD is central binomial sampling; SampleC is used to generate the "inside-out" version of the Fisher-Yates shuffle of the polynomial B_{\tau}.

[0155] The module for specific processing of different algorithms is called Pre-processing module. It is designed to be placed after the NTT module. It is used to process various operations after NTT and INTT calculations and modular addition and modular multiplication operations in the NTT domain before INTT. This allows the data to be sent to the next module that needs the output result immediately after the NTT or INTT budget is completed, rather than being sent to the BRAM for writing and then read out in the next stage; similarly, in the stationary multiplication in the NTT domain, both the modular addition and modular multiplication modules are also pre-operations for the INTT operation. After the modular addition and modular multiplication operations are completed, sending the data to the NTT module for INTT operations will reduce the number of BRAM reads and writes, and reduce the overall system runtime and hardware resources consumed. Therefore, the data transmission between the NTT module and the Pre-processing module is bidirectional.

[0156] like Figure 2The data path diagram of the Dilithium scheme when executing the Key Gen stage is shown in Figure 1. First, SHAKE256 is used in the Keccak module to perform a hash operation on the random seed to generate 256-bit ρ, 512-bit ρ′, and 256-bit K, which are cached in registers. Then two Keccak cores are used to execute SHAKE128 and SHAKE256 respectively, and their outputs are sent to the sampling module to generate the polynomial matrix A and the secret polynomial s. 1 , the secret polynomial s 1 Generate and immediately enter the packing module for compression (polynomial s 2 The same is true after generation). Whenever the secret polynomial s 1 After an element (i.e. a polynomial) is generated, it is fed to the NTT module and converted into the NTT domain. It is then dot-multiplied with the elements in A. The omitted part in the figure is the calculation process of the polynomial matrix and the polynomial vector. The result is INTT transformed and stored back in the position in A. 1 After the generation is completed, SHAKE256 is called, and binomial sampling generates the secret polynomial s 2 The result is directly added to the corresponding element in A. Then the result t (the element in position A) is sent to the Power2Round module via the bus to decompose the coefficient into t 1 and t 0 , t 1 The hash is connected with ρ to get tr, and t 1 and ρ are also packaged to generate a public key for storage, ρ,K,tr,s 1 ,s 2 ,t 0 Package and generate the private key for storage.

[0157] like Figure 3 The data path diagram of the Dilithium signature phase is shown in the figure. The input of this phase is the key sk and the message m. The generation and multiplication process of the polynomial matrix and vector are similar to the previous process. The function modules used include HighBits / LowBits, SampleInBall, MakeHint, and unpack / pack.

[0158] First, unpack the private key to get s 1 ,s 2 ,t 0 ,tr,K, respectively 1 ,s 2 ,t 0 Input into the NTT module and converted into At the same time, the unpacked tr is connected to the incoming message M for hashing to obtain 512-bit μ, which is stored in the register. Then K is connected to μ for hashing to obtain ρ′, which is temporarily stored in the register. Then, different Keccak cores are used to execute SHAKE128 and SHAKE256 simultaneously, and the output is sent to the sampling module to generate the polynomial matrix A and the mask vector y. After the vector y is generated, it enters the NTT module and is converted into the NTT domain. It is dot-multiplied with the elements in A, and the result w obtained after INTT is stored in the memory. In the process of generating the polynomial matrix A, the polynomial vector s can be processed simultaneously. 1 ,s 2 ,t 0 and y to the NTT domain, and then perform point-to-point multiplication and point-to-point addition of polynomials in the NTT domain. Then w is input into the coefficient decomposition module to obtain w, w 1 μ and w 1 The connection is hashed to get a 256-bit Then it is input into the SampleInBall module to get c, and then input into the NTT module to convert Add to the regenerated y to get z, and compare the infinite norm of z with γ 1 -The size of β, if it is smaller than β, proceed to the next step. The result is subtracted from w, and the result is input to the coefficient decomposition module to get the low bit, and then r is obtained. 0 , similarly, it is also relatively r 0 The infinite norm and γ 2 -β. The result is that its infinite norm is equal to γ 2 Compare and judge. If the conditions are not met, the algorithm will return to generating w, stop signing and uninstall the signature. If all conditions are met, the output

[0159] like Figure 4 The data path diagram of the final verification phase of Dilithium is shown. First, the public key pk is unpacked to obtain ρ,t 1 , put ρ into the register and compare ρ with t 1 Concatenate and hash, then concatenate the result with the message M to get the 512-bit μ. Unpack the signature σ to get z,h. Input to the SampleInBall module to generate c, and then send to the NTT module to convert it into Put t 1 Transmitted to NTT module and converted into and Dot product Determine the infinite norm of z and γ 1 -β. z is also sent to the NTT module to convert Then use ρ to generate the polynomial matrix A through SHAKE128, execute SampleInBall(c) and NTT(z) in parallel, and send A to the NTT module to obtain and Dot multiplication gives By operation Get w. Send w to the UseHint module to get w 1 ′. μ and w 1 'Connect the hash result and Compare, if they are the same then accept, otherwise reject, and complete the result verification.

[0160] like Figure 5 The data path diagram of the Kyber key generation phase is shown. First, a 32-bit byte array d is generated, which is then fed into the hash module to generate ρ and σ using the SHA3-512 function. Then, the sampling module generates the matrix uniformly by using the SHAKE128 function. At the same time, two polynomial vectors s and e are generated through binomial sampling of SHAKE256 function. s and e are sent to NTT module to start calculation and generation. When s finishes computing, it starts and The dot multiplication operation can be performed simultaneously with the calculation of e. After these two operations are completed, and Additive Generation Finally, the public key pk and private key sk are generated through the encoding function.

[0161] like Figure 6 The data path diagram of the Kyber encryption phase is shown. The input of this phase is the public key pk, the information m and the seed r. First, the sampling module generates the matrix A in the NTT domain through uniform sampling T , other vectors r, e1 and polynomial e2 are generated by seed r and parameter N. At the same time, the public key pk is decoded and generated in the encoding module And complete the calculation of ρ. After r is generated, it is immediately sent to the NTT module for calculation and generation In the generation The second half of the The dot product of is calculated, followed by the INTT operation. Then, the decoding operation of m is performed, and then the decoded m and 1 are decompressed by the Decompress function. Decompress(m,1), t T r、e 2 Add together to get the polynomial v. In the generator matrix A T At the same time, The dot multiplication operation is performed while generating and calculating, which can save storage space. Perform an INTT operation, and the result is the same as e 1 Add them together to get vector u. Finally, compress u and v and perform encoding operations to get c 1 、c 2 , output ciphertext c = (c 1 ||c 2 ).

[0162] like Figure 7 The data path diagram of Kyber decryption phase is shown. First, c is decoded according to different parameters, and then decompressed by Decompress function to obtain vector u and polynomial v. u is sent to NTT module to generate Decode the key sk to get Then and First do the dot multiplication and then the INTT operation, and then subtract the result from v. Then execute Compress(vs T u,1) operation and encoding to get the message m output.

[0163] Kyber.CCA.KeyGen calls the Kyber.CPA.KeyGen function to generate public keys pk and sk′. The key sk is generated by sk = (sk′||pk||H(pk)||z), where H represents SHA3-256. Kyber.CCA.Enc receives the public key pk and calls the Kyber.CPA.Enc(pk,m,r) function to generate the ciphertext c, which is then passed through SHAKE-256 to generate the shared key ss. The output includes the ciphertext c and the shared key ss. Kyber.CCA.Dec takes the ciphertext c and the key sk as input. First, the Kyber.CPA.Enc(sk,c) function is called to recover the message m, and then the Kyber.CPA.Dec(pk,m′,r′) is called to calculate the new ciphertext c′. If the comparison of c and c′ returns success, it means that the encryption is successful.

[0164] This implementation proposes a unified architecture that can perform key generation, encapsulation, decapsulation, signature generation, and signature verification for all security levels of CRYSTALS-Dilithium and CRYSTALS-Kyber, improving the versatility and efficiency of the algorithm.

[0165] During the algorithm execution process, this embodiment adopts a dynamic generation method to perform the multiplication operation of the polynomial matrix and the vector, avoiding waiting for the entire matrix to be generated before performing the operation, thereby saving storage space and improving operation efficiency.

[0166] This implementation introduces segmented pipeline processing to divide the algorithm operation into multiple segments and process them in a pipeline manner, which not only reduces the storage requirements of intermediate results, but also hides the execution time of the operation, thereby improving the overall execution efficiency of the algorithm.

[0167] The reuse of the core modules of the system architecture of this implementation in different segments not only improves the efficiency of the design, but also enhances the flexibility and maintainability of the algorithm.

[0168] The technical solution provided by the present invention is further described in detail above through several specific implementation modes in order to highlight the advantages and benefits of the technical solution provided by the present invention. However, the several specific implementation modes described above are not intended to be used as limitations on the present invention. Any reasonable modification and improvement of the present invention, combination of implementation modes and equivalent substitution within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. An efficient storage architecture based on quantum-resistant encryption algorithms, characterized by: The architecture includes: NTT module, used to perform continuous NTT / INTT and four-way parallel point multiplication; BRAM storage module, used to store polynomials of keys, signatures and intermediate results; Keccak module, used to generate random numbers for Kyber and Dilithium; A sampling module for generating polynomial ring matrices, polynomial ring vectors and three-valued polynomial rings; The preprocessing module is used to process the operations after NTT and INTT calculations to reduce the number of BRAM reads and writes.

2. The efficient storage architecture based on quantum-resistant encryption algorithm according to claim 1, characterized in that: The BRAM storage module is implemented using a dual-port BRAM, and the storage method is a segmented pipeline processing method.

3. The efficient storage architecture based on quantum-resistant encryption algorithm according to claim 1, characterized in that: The Keccak module includes three Keccak-f[1600] core modules.

4. The efficient storage architecture based on quantum-resistant encryption algorithm according to claim 1, characterized in that: The sampling module contains 6 sub-modules, which are used for different sampling requirements of Kyber and Dilithium respectively.

5. The efficient storage architecture based on quantum-resistant encryption algorithm according to claim 1, characterized in that: It is characterized in that The pre-processing module supports bidirectional data transmission and improves system efficiency.

6. An efficient storage method based on a quantum-resistant encryption algorithm, characterized in that: The architecture according to claim 1 is implemented as follows: Dilithium algorithm: Steps to generate public and private keys; A step of generating a polynomial matrix and a mask vector according to the private key; A step of generating a polynomial matrix according to the private key; Kyber Algorithm: Steps to generate public and private keys; According to the public key, a matrix and a vector are obtained to generate a ciphertext; The step of obtaining a decryption result according to the private key and the ciphertext.

7. An efficient storage device based on a quantum-resistant encryption algorithm, characterized in that: The architecture according to claim 1 is implemented as follows: Dilithium Module: Submodule for generating public and private keys; A submodule for generating a polynomial matrix and a mask vector according to the private key; A submodule for generating a polynomial matrix according to the private key; Kyber Modules: Submodule for generating public and private keys; According to the public key, a matrix and a vector are obtained to generate a submodule of ciphertext; A submodule for obtaining a decryption result is obtained according to the private key and the ciphertext.

8. A computer storage medium for storing a computer program, characterized in that: When the computer program is read by a computer, the computer executes the method according to claim 6.

9. A computer, comprising a processor and a storage medium, characterized in that: When the processor reads the computer program stored in the storage medium, the computer executes the method of claim 6 .

10. A computer program product, being a computer program, characterized in that When the computer program is read, the method according to claim 6 is implemented.

Citation Information

Patent Citations

  • Efficient lightweight NTT multiplier circuit based on lattice cipher

    CN115756386A

  • Iterative NTT system based on FIFO storage

    CN116893797A

  • Module-LWE based Crypto-Processor System and Method for Post-Quantum Cryptography

    KR102462395B1

  • An area efficient architecture for lattice based key encapsulation and digital signature generation

    US20230126984A1

Cited By

  • Post-quantum digital signature key generation method based on AVX2 acceleration and matrix multiplication optimization

    CN119561684A

  • Anti-quantum cryptography signature algorithm execution optimization method and system and electronic equipment

    CN119766429A

  • Anti-quantum cryptography signature algorithm execution optimization system and communication device

    CN119814330A

  • Polynomial matrix acquisition method and device, electronic equipment and storage medium

    CN121485939A

  • Polynomial matrix acquisition method and device, electronic equipment and storage medium

    CN121485939B