A dynamically configurable NTT hardware implementation method and system
Through dynamic configurable NTT hardware, the system is implemented using the design of memory units and parallel disk calculators, the problem of insufficient reusability and efficiency of NTT system is solved, and the efficient operation of post-quantum cryptography algorithms and the resistance of quantum attacks is realized. .
Patent Information
- Application Number
- CN202411018345.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-29
AI Technical Summary
The existing NTT systems have shortcomings in reusability and efficiency, and it is difficult to meet the efficient needs of post-quantum cryptography algorithms.
A dynamic configurable NTT hardware implementation system was designed to optimize the disk calculator through memory units A, B and C and four parallel disc calculators. structure and operational process to improve system reusability and efficiency.
It realizes the efficient reusability of the NTT system, improves the efficiency of the post-quantum cryptographic algorithm, can effectively resist quantum attacks, and is suitable for cryptographic products such as gateways, password cards, and password machines.
Smart Images

Figure CN118551857B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information communication technology, and more specifically to a dynamically configurable NTT hardware implementation method and system. Background Art
[0002] Post-quantum cryptography is a new generation of cryptographic algorithms that can resist attacks by quantum computers on existing cryptographic algorithms. It has the advantages of small parameters and excellent practicality. One of the key modules of post-quantum cryptographic algorithms is number theory transformation NTT. However, one of the characteristics of the NTT system is that it has high-intensity and complex data scheduling, including three layers of nested loop logic. The data scheduling rules of each layer are different. According to different parameters, the number of times of the three layers of nested loop logic is also different. Therefore, the efficient and reusable NTT system can improve the efficiency of post-quantum cryptography.
[0003] Therefore, how to improve the reusability of the NTT system is an urgent problem that technical personnel in this field need to solve. Summary of the invention
[0004] In view of this, the present invention provides a dynamically configurable NTT hardware implementation method and system, which has high efficiency and reusability, can improve the efficiency of post-quantum cryptographic algorithms, and can be used in cryptographic products such as gateways, cryptographic cards, cryptographic machines, CA, key management systems, etc. to resist the threat of quantum attacks.
[0005] In order to achieve the above object, the present invention adopts the following technical solution:
[0006] A dynamically configurable NTT hardware implementation system comprises a storage unit A, a storage unit B, a storage unit C and four disc-shaped calculators; the storage unit C uses an address register MUX to connect the storage unit A and the storage unit B through four parallel disc-shaped calculators.
[0007] The technical effect of the above technical solution is that different NTTs can be dynamically configured by updating the information stored in the storage unit B.
[0008] Preferably, each address of storage unit A, storage unit B and storage unit C stores 4 units of data; storage unit C reads data once to meet the input of 4 butterfly calculators, and can also write the output of 4 butterfly calculators once.
[0009] Preferably, the butterfly calculator includes 3 multipliers, 1 adder and 2 subtractors; each multiplier is implemented in one cycle, and 1 adder and 2 subtractors are implemented in one cycle at the same time. The butterfly calculator is implemented in the Montgomery domain, and each butterfly calculation is completed in 4 cycles.
[0010] Preferably, the disc-shaped calculator is provided with three input registers, which are respectively used to store the polynomial coefficient data_u read from the address register with the address line read_addr_u in the storage unit C, the polynomial coefficient data_v read from the address register with the address line read_addr_v, and the data_w read from the address register with the address line read_addr_w in the storage unit A; two output registers are also provided, which write the stored data_out_u into the address register with the address line write_addr_u in the storage unit C, and write the data_out_v into the address register with the address line write_addr_v in the storage unit C; and two configurable parameter registers QINV and Q are also provided.
[0011] A dynamically configurable NTT hardware implementation method comprises the following steps:
[0012] Step 1: The rotation factors data_w of different algorithms are stored in the storage unit A;
[0013] Step 2: Configurable parameters of different algorithms are stored in storage unit B;
[0014] Step 3: A plurality of polynomial coefficients data_u and data_v are stored in the storage unit C, where each group of four polynomial coefficients data_u is stored in one address line, and each group of four polynomial coefficients data_v is stored in one address line;
[0015] Step 4: 4 parallel disc-shaped calculators read the polynomial coefficients data_u and data_v from the storage unit C, read the rotation factor data_w from the storage unit A, read the configurable parameters from the storage unit B and store them in the configurable parameter registers QINV and Q;
[0016] Step 5: The disc calculator runs calculations based on the read data and simultaneously reads and writes data to storage unit C;
[0017] Step 6: If the preset number of calculation runs is reached, the calculation ends; otherwise, return to step 5.
[0018] Preferably, the specific process of step 5 is:
[0019] Step 51: The polynomial coefficient data_v and the rotation factor data_w are passed through the first multiplier to obtain a first multiplication result; the disc calculator reads the polynomial coefficient data_v for the next operation calculation from the storage unit C according to the address line read_addr_v, and reads the rotation factor data_w for the next operation calculation from the storage unit A according to the address line read_addr_w;
[0020] Step 52: The first multiplication result and the configurable parameter stored in the configurable parameter register QINV are passed through a second multiplier to obtain a second multiplication result; the disc calculator reads the polynomial coefficient data_u from the storage unit C according to the address line read_addr_u;
[0021] Step 53: The second multiplication result and the configurable parameter stored in the configurable parameter register Q are passed through the third multiplier to obtain the third multiplication result; the first multiplication result and the third multiplication result are passed through the first subtractor to obtain the first subtraction result; the first subtraction result and the polynomial coefficient data_u are passed through the second subtractor to obtain the output data_out_u; the disc calculator writes data_out_u into the storage unit C according to the address line write_addr_u;
[0022] Step 54: The first subtraction result and the polynomial coefficient data_v are passed through the adder to obtain the output data_out_v; the disc calculator writes data_out_v into the storage unit C according to the address line write_addr_v.
[0023] It can be seen from the above technical solutions that, compared with the prior art, the present invention discloses a dynamically configurable NTT hardware implementation method and system, which is applicable to the post-quantum cryptographic algorithm NTT. The post-quantum cryptographic algorithm calls different NTTs according to different selected parameters. The system implements NTT by the polynomial coefficients in the storage unit C, the rotation factors in the storage unit A, and the configurable parameters in the storage unit B, which can realize NTT in different post-quantum cryptography. The implementation of the configurable NTT designed by this system can realize the maximum reuse of NTT, thereby improving resource utilization and reducing system latency by using parallelism. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0025] Figure 1 A schematic diagram of the structure of a dynamically configurable NTT hardware implementation system provided by the present invention;
[0026] Figure 2 This is a schematic diagram of the structure of a butterfly calculator provided by the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] The embodiment of the present invention discloses a dynamically configurable NTT hardware implementation system, such as Figure 1 As shown, it includes three storage units: storage unit A, storage unit B and storage unit C, and four parallel butterfly calculators; storage unit C uses registers to connect storage unit A and storage unit B through four parallel butterfly calculators; each address of each storage unit stores 4 units of data, so reading data from storage unit C once can satisfy the input of four butterfly calculators, and the output of four butterfly calculators can be written to storage unit C at one time, realizing the butterfly calculator in the Montgomery domain.
[0029] Furthermore, each butterfly calculator includes 3 multipliers, 1 adder and 2 subtractors; each multiplier is implemented in one cycle, and the fourth cycle can simultaneously implement 1 adder and 2 subtractors, so each butterfly calculator is completed in 4 cycles; the input register of each butterfly calculator is set to store data_u, data_v and data_w respectively, and the corresponding address lines of the read address register are read_addr_u, read_addr_v of storage unit C and read_addr_w of storage unit A respectively; the output register of each butterfly calculator writes the stored data_out_u and data_out_v into storage unit C respectively, and the corresponding address lines of the address register written are write_addr_u and write_addr_v respectively; the parameter registers QINV and Q are configurable.
[0030] On the other hand, in a specific embodiment, a dynamically configurable NTT hardware implementation method based on the above system includes the following steps:
[0031] Step 1: Initialize storage unit A. Since the butterfly calculator is implemented in the Montgomery domain, the Montgomery domain value of the rotation factor data_w to be calculated is stored in storage unit A. The corresponding value can be stored according to different algorithms.
[0032] Step 2: Initialize storage unit B, which mainly stores configurable parameters Q value and QINV value of different algorithms; corresponding values can be stored according to different algorithms;
[0033] Step 3: Initialize storage unit C to store polynomial coefficients data_u and data_v; every 4 coefficients of the same type are stored in the same address line, that is, every four polynomial coefficients data_u are stored as a group in one address line, and every four polynomial coefficients data_v are stored in one address line;
[0034] Step 4: Initialize 4 parallel butterfly calculators;
[0035] Read the input polynomial coefficient data_u and the polynomial coefficient data_v of each butterfly calculator from the storage unit C according to the address lines read_addr_u and read_addr_v;
[0036] Read the rotation factor data_w from storage unit A according to read_addr_w;
[0037] Read the configurable parameters from the storage unit B and store them in register QINV and register Q respectively;
[0038] Step 5: Initialize the counter to control the number of inner loops, set count = 0;
[0039] Step 6: In order to reduce the delay of reading and writing input, the storage unit C is read and written while the butterfly calculator is running;
[0040] After the butterfly calculator is started:
[0041] The first cycle polynomial coefficient data_v and the rotation factor data_w enter the first multiplier of the butterfly calculator; at the same time, the polynomial coefficient data_v required by the butterfly calculator for the next time is read from the storage unit C according to the address line read_addr_v; at the same time, the rotation factor data_w required by the butterfly calculator for the next time is read from the storage unit A according to the address line read_addr_w;
[0042] In the second cycle, the multiplication result of the previous cycle and the configurable parameters stored in the configurable parameter register QINV enter the second multiplier of the butterfly calculator; at the same time, the polynomial coefficient data_u required for the next cycle is read from the storage unit C according to the address line read_addr_u;
[0043] In the third cycle, the multiplication result of the previous cycle and the configurable parameters stored in the configurable parameter register Q enter the third multiplier of the butterfly calculator; at the same time, the multiplication result of the first cycle and the multiplication result of this cycle enter the first subtractor, and the high-order 16-bit data of the first subtractor result and the polynomial coefficient data_u read in the second cycle enter the second subtractor and obtain data_out_u; the output data_out_u of each butterfly calculator is written into the storage unit C according to the address line write_addr_u;
[0044] In the fourth cycle, the high 16-bit data of the first subtractor result obtained in the third cycle and the polynomial coefficient data_v read in the first cycle enter the adder to obtain data_out_v, and the output data_out_v of each butterfly calculator is written into the storage unit C according to the address line write_addr_v;
[0045] Step 7: Update the counter; in the fifth cycle after the butterfly calculator is started, the counter is incremented by 1, and the next butterfly calculator is started at the same time; if the counter = NTT cycle number / 4, the loop ends, otherwise proceed to step 6.
[0046] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0047] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A dynamically configurable NTT hardware implementation system, characterized in that: It includes storage unit A, storage unit B, storage unit C and 4 disc-shaped calculators; storage unit C uses registers to connect storage unit A and storage unit B through 4 parallel disc-shaped calculators; The disc-shaped calculator is provided with three input registers, which are respectively used to store the polynomial coefficient data_u read from the address register with the address line read_addr_u in the storage unit C, the polynomial coefficient data_v read from the address register with the address line read_addr_v, and the rotation factor data_w read from the address register with the address line read_addr_w in the storage unit A; two output registers are also provided, which respectively write the stored data_out_u into the address register with the address line write_addr_u in the storage unit C, and write the stored data_out_v into the address register with the address line write_addr_v in the storage unit C; two configurable parameter registers QINV and Q are also provided.
2. A dynamically configurable NTT hardware implementation system according to claim 1, characterized in that: Each address of storage unit A, storage unit B and storage unit C stores 4 units of data; storage unit C reads data once to satisfy the input of 4 butterfly calculators and writes the output of 4 butterfly calculators once.
3. A dynamically configurable NTT hardware implementation system according to claim 1, characterized in that: The disc-shaped calculator includes three multipliers, one adder and two subtractors; each multiplier is implemented in one cycle, and one adder and two subtractors are simultaneously implemented in one cycle.
4. A dynamically configurable NTT hardware implementation method, characterized in that: A dynamically configurable NTT hardware implementation system according to any one of claims 1 to 3, comprising the following steps: Step 1: The rotation factors data_w of different algorithms are stored in the storage unit A; Step 2: Configurable parameters of different algorithms are stored in storage unit B; Step 3: Several polynomial coefficients data_u and data_v are stored in the storage unit C, and each group of four polynomial coefficients of the same type is stored in one address line; Step 4: 4 parallel disc-shaped calculators read the polynomial coefficients data_u and data_v from the storage unit C, read the rotation factor data_w from the storage unit A, read the configurable parameters from the storage unit B and store them in the configurable parameter registers QINV and Q; Step 5: The disc calculator runs calculations based on the read data and simultaneously reads and writes data to storage unit C; Step 6: If the preset number of calculation runs is reached, the calculation ends; otherwise, return to step 5.
5. A dynamically configurable NTT hardware implementation method according to claim 4, characterized in that: The specific process of step 5 is: Step 51: The polynomial coefficient data_v and the rotation factor data_w are passed through the first multiplier to obtain a first multiplication result; the disc calculator reads the polynomial coefficient data_v for the next operation calculation from the storage unit C according to the address line read_addr_v, and reads the rotation factor data_w for the next operation calculation from the storage unit A according to the address line read_addr_w; Step 52: The first multiplication result and the configurable parameter stored in the configurable parameter register QINV are passed through a second multiplier to obtain a second multiplication result; the disc calculator reads the polynomial coefficient data_u from the storage unit C according to the address line read_addr_u; Step 53: The second multiplication result and the configurable parameter stored in the configurable parameter register Q are passed through the third multiplier to obtain a third multiplication result; the first multiplication result and the third multiplication result are passed through the first subtractor to obtain a first subtraction result; the first subtraction result and the polynomial coefficient data_u are passed through the second subtractor to obtain the output data_out_u; the disc calculator writes data_out_u into the storage unit C according to the address line write_addr_u; Step 54: The first subtraction result and the polynomial coefficient data_v are passed through the adder to obtain the output data_out_v; the disc calculator writes data_out_v into the storage unit C according to the address line write_addr_v.
