High-performance polynomial multiplication hardware acceleration architecture for lattice cryptographic chip

By using the base 2 & base 4 hybrid NTT hardware module in the grid cryptographic chip, a high-performance polynomial multiplication hardware acceleration architecture is realized, which solves the problem of high complexity of polynomial multiplication in the grid-based post-quantum cryptographic algorithm, and improves the computing efficiency It also reduces resource consumption and is suitable for IoT terminal devices.

CN118963703AActive Publication Date: 2024-11-15HARBIN ENG UNIV

Patent Information

Application Number
CN202410972259.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-11-15
Estimated Expiration
2044-07-19

AI Technical Summary

Technical Problem

In the prior art, the computational complexity of polynomial multiplication in the lattice-based post-quantum cryptography algorithm is too high, resulting in low computing efficiency, especially in the lattice-cryptography chip, which is difficult to achieve a high performance and low resource consumption polynomial multiplication hardware architecture.

Method used

Using the basis 2 & base 4 hybrid NTT hardware module, the control logic unit and operation logic unit, including butterfly unit, rotation factor module and address generator, realize the NTT, INTT, point multiplication and addition and subtraction operations of polynomial vectors, reducing the hardware Resource consumption and improve computing efficiency.

Benefits of technology

It realizes high-performance polynomial multiplication operations, reduces hardware resource consumption, supports NTT, INTT and point multiplication operations under different cardinalities, simplifies the read and write control of stored data, improves computing efficiency, and is suitable for IoT terminal devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118963703A_ABST
    Figure CN118963703A_ABST
Patent Text Reader

Abstract

The invention relates to a high-performance polynomial multiplication hardware acceleration architecture for a lattice cryptographic chip. The invention relates to the technical field of encryption computing, and designs a lightweight polynomial hardware acceleration architecture which can support NTT, INTT, dot multiplication and other operations under different cardinal numbers in polynomial multiplication, a core unit is a lightweight butterfly unit formed by four groups of small butterfly structures, and the number of the small butterfly structures in each operation in the polynomial multiplication is larger than that in the prior art. And scheduling modes in different modes are designed. And finally, according to the polynomial multiplication module designed by the invention, a corresponding conflict-free memory mapping scheme and a data storage scheme are provided, and the scheme simplifies read-write control of stored data and solves the problems that address conversion is too complex and data conflicts due to interaction of a large amount of data in a polynomial operation process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of encryption computing, and is a high-performance polynomial multiplication hardware acceleration architecture for a lattice cryptographic chip. Background Art

[0002] Cryptographic algorithms are the cornerstone of information security. Whether they are safe and reliable determines the authenticity and validity of information. In real life, symmetric encryption algorithms are used in the field of data encryption, while public key cryptographic algorithms are often used in the field of digital signatures. The two together constitute the existing cryptographic algorithm system. However, the rapid development of quantum decryption algorithms such as Shor and Grover in recent years has brought a huge security impact on the existing cryptographic system. Quantum computers use quantum bits 0 and 1 to replace the bits of traditional computers. They achieve efficient parallel computing by sharing states with other quantum bits that are independent of each other in space. Most existing public key cryptographic algorithms such as RSA can be cracked by sufficiently large and stable quantum computers. Faced with this challenge, an emerging cryptographic research field, Post-quantum Cryptography (PQC), came into being. It mainly studies cryptographic algorithm schemes that can resist quantum computing attacks when executed on classical computers.

[0003] In 2016, the National Institute of Standards and Technology (NIST) solicited post-quantum public key encryption algorithms from scholars around the world and developed cryptographic algorithm standards to counter quantum computing attacks. Among them, three lattice-based post-quantum cryptographic algorithms, CRYSTALS-KYBER, CRYSTALS-Dilithium, and FALCON, have been identified as standardized algorithms. In 2020, the lattice-based cryptographic algorithms LAC and Aigis won the first prize in the National Cryptography Design Competition announced by the Chinese Society of Cryptography. Lattice-based cryptographic systems are mostly based on unresolved difficult problems in lattices, such as learning with errors (LWE), ring learning with errors (RLWE), and module learning with errors (MLWE). These NP-hard problems in lattices often do not have corresponding quantum algorithms that can be quickly calculated, which can ensure the security of lattice-based post-quantum cryptographic algorithms.

[0004] In the encryption and decryption process of the algorithm, the core operation of the key part is u = A T r+e, where u, r and e are polynomial vectors, Α Tis a polynomial matrix. The most time-consuming part of the entire calculation process is the polynomial vector multiplication. The complexity of traditional polynomial multiplication is O(n 2 ), while in the lattice-based post-quantum cryptographic algorithm, the value of n is greater than 256, resulting in a high complexity of polynomial multiplication. In addition, in the implementation time of the lattice-based post-quantum cryptographic algorithm, polynomial multiplication accounts for more than 50% of the time, which shows that the computational efficiency of the lattice post-quantum cryptographic system basically depends on the computational efficiency of polynomial multiplication. Therefore, the design of high-performance polynomial multiplication hardware acceleration architecture is of great significance to the optimization and implementation of the lattice-based post-quantum cryptographic algorithm.

[0005] Most of the polynomial multiplication calculations in the lattice cryptographic algorithm are completed on the polynomial ring. The current polynomial multiplication calculation methods include the Schoolbook algorithm, the Karatsuba algorithm, the Toom-Cook algorithm, and the Number Theoretic Transform (NTT) algorithm. Among them, the Schoolbook algorithm is a classic polynomial multiplication, which multiplies the coefficients in the form of factorization and then adds the coefficients of the same degree to get the result. Its time complexity is O(n 2 The Karatsuba algorithm is to split a large integer into two parts with smaller bits, and through three multiplications, a small amount of addition and shift operations, the time complexity is reduced from O(n 2 ) is reduced to O(nlog3), but it is only applicable to the multiplication of two large integers and is not suitable for polynomial multiplication in the lattice. The Toom-Cook algorithm follows the divide-and-conquer idea of ​​the Karatsuba algorithm, splitting the large integer into multiple parts, generally three or four parts, and then converting them into multiple multiplication sub-operations, but it is also only applicable to the multiplication of two large integers. The NTT fast algorithm is an algorithm that migrates the Fast Fourier Transform (FFT) algorithm from the complex domain to the integer domain. It reduces the complexity of polynomial multiplication from O(nlog3) to O(nlog3). 2 ) is reduced to O(nlogn), which is very suitable for lattice cryptographic algorithms based on the LWE problem. However, the NTT fast algorithm requires that the modulus of the lattice cryptographic algorithm use a specific value such as q=2. x +1,x∈(1,2,3,KK), which makes it impossible for lattice ciphers such as Saber algorithm and NTRU (Number Theory Research Unit, NTRU) algorithm to use NTT fast multiplication.

[0006] Compared with software implementation, lattice cryptographic algorithms have significant advantages in resource consumption, security, power consumption, and speed when implemented in hardware. They can be applied to traditional high-performance devices as well as resource-constrained IoT terminal devices. Hardware research is currently focusing on overall architecture design, core computing module design, and modular operation design. Among them, the overall architecture design is often targeted at one or more specific lattice cryptographic algorithms, and hardware-level acceleration is achieved through instruction set architectures such as RISC-V; the core computing module can be divided into hash function modules, polynomial sampling modules, polynomial computing modules, encryption and decryption modules, etc. Among them, polynomial multiplication calculations are more time-consuming and incompatible with existing instruction set architectures, so the optimization and implementation of polynomial computing modules account for the largest proportion of research. At the current hardware implementation level, its main design indicators are high performance, high energy efficiency, low power consumption, and reconfigurability.

[0007] Chen et al. proposed a polynomial multiplication module design scheme that re-arranges the loop structure in the NTT algorithm and reuses the rotation factors to avoid the bit reversal overhead in NTT / INTT of arbitrary bases, but there are problems such as slow calculation speed and narrow algorithm applicability. In the lattice cryptographic chip, the advantages of this scheme cannot be highlighted, and it is difficult to achieve speed matching with peripheral hardware devices.

[0008] Therefore, how to provide a low-resource consumption, high-performance polynomial multiplication hardware architecture for use in lattice cryptographic chips has become an urgent problem to be solved by researchers in this field. Summary of the invention

[0009] In view of the deficiencies of the prior art and to solve the above problems, the present invention proposes a high-performance polynomial multiplication hardware acceleration architecture for a lattice cryptographic chip, which improves the overall performance of the polynomial multiplier and reduces hardware resource consumption.

[0010] The present invention provides a high-performance polynomial multiplication hardware acceleration architecture for a lattice cryptographic chip, and the present invention provides the following technical solutions:

[0011] The architecture adopts a radix-2 & radix-4 hybrid NTT hardware module, which is a hardware implementation of a radix-2 & radix-4 hybrid NTT algorithm, including a control logic unit and an operation logic unit;

[0012] The control logic module includes a control unit, which controls the address generator to generate data addresses, the memory mapping unit to generate data write-back addresses, the operation modulus and input data of the butterfly unit, and the scheduling of the rotation factors through control signals;

[0013] The arithmetic logic unit adopts a butterfly unit module, and the butterfly unit includes modular addition, modular subtraction, modular multiplication, memory and multiplexer.

[0014] Preferably, the base 2 & base 4 hybrid NTT hardware module needs to complete NTT operations, point multiplication operations, INTT operations, and addition and subtraction operations of polynomial vectors;

[0015] The NTT operation is the process of converting a polynomial vector from a coefficient polynomial to a point value polynomial, while the INTT operation is exactly the opposite; the point multiplication operation is the multiplication of two point value polynomial vectors, and the addition and subtraction operation is the addition and subtraction of two polynomial vectors.

[0016] Preferably, the butterfly unit is the core of the polynomial multiplication module architecture, which consists of four groups of small butterfly units BFU, denoted as BFU0, BFU1, BFU2 and BFU3 respectively. Each BFU requires 6 clock cycles from input to output, and a different number of registers are inserted in each BFU.

[0017] Preferably, the design of BFU0 and BFU3 has a rotation factor module, and the butterfly unit supports polynomial vector radix 2 and radix 4-NTT algorithms and point multiplication operations.

[0018] Preferably, the randomly input polynomial coefficients and the rotation factors corresponding to the Kyber algorithm are stored in a bank according to corresponding rules. The memory includes 4 groups of banks, which are responsible for storing the coefficients of N-term polynomial vectors. Each bank stores N / 4 coefficients. The four polynomial coefficients participating in the butterfly unit operation are generated through the address generator and the arbitration unit scheduling. The four results of the butterfly operation will also be written back to the 4 banks through the data write back unit.

[0019] Preferably, the address generator includes a coefficient base address generator, a memory mapping, and an arbitration unit. The coefficient base address generator generates four sets of base address signals for reading coefficients at this clock through the iterative loop signals p, k, and j of the state machine. The memory mapping unit maps the four sets of base address signals into read address signals of the coefficients and write address signals of the coefficients. The arbitration unit and the data reading unit determine the order in which the four coefficients taken out of the Bank are input into the butterfly unit according to the Bank index signal in the read address signal.

[0020] Preferably, the rotation factor module is divided into an address generation module and a storage module of the rotation factor. The address generator of the rotation factor is controlled by the control unit. When the polynomial multiplication module performs NTT, INTT, and PWM operations, the address of the rotation factor is generated. The rotation factor storage module ROM provides the corresponding primitive unit root according to the address of the rotation factor, and participates in the modular multiplication operation in the butterfly unit and the point-by-point multiplication operation in Kyber.

[0021] Preferably, the control unit is mainly composed of a state machine, which is written in two stages, and different states can be transferred through signals. The control unit implements multiple operations through multiple states in the state machine and transfers between states to complete a complete polynomial multiplication.

[0022] The present invention has the following beneficial effects:

[0023] Compared with the prior art, the present invention has the following advantages:

[0024] The present invention eliminates the pre-processing and post-processing operations in NTT by changing the loop order, and realizes the reuse of rotation factors in NTT and INTT, so that the Kyber public key encryption algorithm and other lattice cryptographic algorithms can use the base 4-NTT algorithm to achieve computational dimension reduction. It also solves the problem that the existing base 4-NTT algorithm cannot be applied to the Kyber algorithm, and the base 2-NTT algorithm has a high computational complexity.

[0025] The present invention designs a lightweight polynomial hardware acceleration architecture that can support NTT, INTT, dot multiplication and other operations under different bases in polynomial multiplication. The core unit is a lightweight butterfly unit composed of 4 groups of small butterfly structures, and different scheduling modes are designed for various operations in polynomial multiplication. Finally, according to the polynomial multiplication module designed by the present invention, a corresponding conflict-free memory mapping scheme and data storage scheme are proposed, which simplifies the read and write control of stored data and solves the problem of overly complex address conversion and data conflicts caused by a large amount of data interaction during polynomial operations.

[0026] The hardware architecture of the present invention has high module reusability. When the type of lattice cryptographic algorithm needs to be adjusted, only the port width and control unit of some modules need to be adjusted without redesign, which can reduce the hardware development cost.

[0027] The hardware architecture of the present invention has high compactness, can make full use of existing hardware resources, and efficiently complete various operations that need to be performed during the polynomial multiplication operation, thereby improving computing efficiency.

[0028] The present invention has high scalability, and has the advantages of high computing speed, low resource consumption, low power consumption, etc., and can meet the performance and power consumption requirements of IoT terminal devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0030] Figure 1 It is an overall schematic diagram of the polynomial hardware acceleration architecture;

[0031] Figure 2 This is a schematic diagram of the data flow of the radix 2 & radix 4-NTT hybrid algorithm, taking 8 points as an example;

[0032] Figure 3 It is a schematic diagram of the internal structure of the butterfly unit;

[0033] Figure 4 It is a schematic diagram of the scheduling of each mode of the butterfly unit;

[0034] Figure 5 It is a diagram of mutually exclusive connectivity of NTT / INTT addresses of 256-point polynomial;

[0035] Figure 6 This is a schematic diagram of the arrangement of rotation factors in the polynomial multiplication module. DETAILED DESCRIPTION

[0036] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. 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.

[0037] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0038] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0039] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0040] The present invention is described in detail below in conjunction with specific embodiments. Specific embodiment one:

[0042] according to Figures 1 to 6 As shown, the specific optimization technical solution adopted by the present invention to solve the above technical problems is: the present invention relates to a high-performance polynomial multiplication hardware acceleration architecture for a lattice cryptographic chip.

[0043] A high-performance polynomial multiplication hardware acceleration architecture for a lattice cryptographic chip, wherein the architecture adopts a radix-2 & radix-4 hybrid NTT hardware module, wherein the radix-2 & radix-4 hybrid NTT hardware module is a hardware implementation of a radix-2 & radix-4 hybrid NTT algorithm, and includes a control logic unit and an operation logic unit;

[0044] The control logic module includes a control unit, which controls the address generator to generate data addresses, the memory mapping unit to generate data write-back addresses, the operation modulus and input data of the butterfly unit, and the scheduling of the rotation factors through control signals;

[0045] The arithmetic logic unit adopts a butterfly unit module, and the butterfly unit includes modular addition, modular subtraction, modular multiplication, memory and multiplexer.

[0046] The base 2 & base 4 hybrid NTT hardware module needs to complete the NTT operation, point multiplication operation, INTT operation and addition and subtraction operation of the polynomial vector;

[0047] The NTT operation is the process of converting a polynomial vector from a coefficient polynomial to a point value polynomial, while the INTT operation is exactly the opposite; the point multiplication operation is the multiplication of two point value polynomial vectors, and the addition and subtraction operation is the addition and subtraction of two polynomial vectors.

[0048] The butterfly unit is the core of the polynomial multiplication module architecture. It consists of four groups of small butterfly units BFU, denoted as BFU0, BFU1, BFU2 and BFU3. Each BFU requires 6 clock cycles from input to output, and a different number of registers are inserted in each BFU.

[0049] The design of BFU0 and BFU3 has a rotation factor module, and the butterfly unit supports polynomial vector radix 2 and radix 4-NTT algorithms and point multiplication operations.

[0050] The randomly input polynomial coefficients and the rotation factors corresponding to the Kyber algorithm are stored in the Bank according to the corresponding rules. The memory includes 4 groups of Banks, which are responsible for storing the coefficients of the N-term polynomial vector. Each Bank stores N / 4 coefficients. The four polynomial coefficients participating in the butterfly unit operation are generated through the address generator and arbitration unit scheduling. The four results of the butterfly operation will also be written back to the 4 Banks through the data write back unit.

[0051] The address generator includes a coefficient base address generator, a memory mapping, and an arbitration unit. The coefficient base address generator generates four sets of base address signals for reading coefficients at this clock through the iterative loop signals p, k, and j of the state machine. The memory mapping unit maps the four sets of base address signals into the read address signals and write address signals of the coefficients. The arbitration unit and the data reading unit determine the order in which the four coefficients taken out of the Bank are input into the butterfly unit according to the Bank index signal in the read address signal.

[0052] The twiddle factor module is divided into an address generation module and a storage module of the twiddle factor. The address generator of the twiddle factor is controlled by the control unit. When the polynomial multiplication module performs NTT, INTT, and PWM operations, the address of the twiddle factor is generated. The twiddle factor storage module ROM provides the corresponding primitive unit root according to the address of the twiddle factor, and participates in the modular multiplication operation in the butterfly unit and the point-by-point multiplication operation in Kyber.

[0053] The control unit is mainly composed of a state machine, which is written in two stages. Different states can be transferred through signals. The control unit implements multiple operations through multiple states in the state machine and the transfer between states to complete the complete polynomial multiplication. Specific embodiment 2:

[0055] The difference between the second embodiment of the present invention and the first embodiment is that:

[0056] The technical solution adopted by the present invention is:

[0057] The polynomial multiplier hardware architecture used in lattice cryptographic chips is mainly a radix-2 & radix-4 hybrid NTT hardware module.

[0058] The radix-2 & radix-4 hybrid NTT hardware module is a hardware implementation of the radix-2 & radix-4 hybrid NTT algorithm, which can be divided into two major modules: a control logic unit and an arithmetic logic unit. The control logic module is mainly a control unit, which controls the address generator to generate data addresses, the memory mapping unit to generate data write-back addresses, the operation modulus and input data of the butterfly unit, and the scheduling of the rotation factors through control signals. The arithmetic logic unit is mainly a butterfly unit module, which is composed of devices such as modular addition, modular subtraction, modular multiplication, memory, and multiplexer.

[0059] The base 2 & base 4 hybrid NTT hardware module needs to complete the NTT operation, point multiplication operation, INTT operation and addition and subtraction operation of the polynomial vector. The NTT operation is the process of converting the polynomial vector from a coefficient polynomial to a point value polynomial, while the INTT operation is just the opposite; the point multiplication operation is the multiplication calculation of two point value polynomial vectors, and the addition and subtraction operation is the addition and subtraction calculation of two polynomial vectors.

[0060] The randomly input polynomial coefficients and the rotation factors corresponding to the Kyber algorithm are stored in the Bank according to the corresponding rules.

[0061] The coefficient storage module consists of 4 groups of banks, which are responsible for storing the coefficients of N-term polynomial vectors. Each bank stores N / 4 coefficients. The four polynomial coefficients participating in the butterfly unit operation are generated through the address generator and arbitration unit scheduling. The four results of the butterfly operation will also be written back to the 4 banks through the data write back unit.

[0062] The address generation module is composed of a coefficient base address generator, a memory mapping unit, and an arbitration unit. The coefficient base address generator generates four sets of base address signals for reading coefficients at this clock through the iterative loop signals p, k, and j of the state machine. The memory mapping unit maps the four sets of base address signals into the read address signals and write address signals of the coefficients. The arbitration unit and the data reading unit determine the order in which the four coefficients taken out of the Bank are input into the butterfly unit according to the Bank index signal in the read address signal.

[0063] The butterfly unit is the core of the polynomial multiplication module architecture. It consists of four groups of small butterfly units (Butterfly Unit, BFU), which are respectively recorded as BFU0, BFU1, BFU2 and BFU3. The designs of the four BFUs are not exactly the same, but each BFU requires 6 clock cycles from input to output, so a different number of registers will be inserted in each BFU. Among them, the designs of BFU0 and BFU3 are exactly the same except for the rotation factor, while the designs of BFU1 and BFU2 are different. The butterfly unit supports polynomial vector base 2 and base 4-NTT algorithms and point multiplication operations.

[0064] The rotation factor module is divided into an address generation module and a storage module of the rotation factor. The address generator of the rotation factor is controlled by the control unit. When the polynomial multiplication module performs NTT, INTT, and PWM operations, the address of the rotation factor is generated. The rotation factor storage module ROM provides the corresponding primitive unit root according to the address of the rotation factor, and participates in the modular multiplication operation in the butterfly unit and the point-by-point multiplication operation in Kyber.

[0065] The control unit is mainly composed of a state machine, which is written in two stages, and different states can be transferred through signals. The control unit implements multiple operations through multiple states in the state machine and the transfer between states to complete the complete polynomial multiplication.

[0066] The embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings.

[0067] like Figure 1 As shown, the present invention is a polynomial multiplier hardware architecture suitable for a lattice cryptographic chip. The overall architecture is divided into a control unit and an operation unit, and is composed of an address generator module, a rotation factor module, a memory mapping module, a data write module, a data write module, a butterfly unit module, etc.

[0068] Among them, the butterfly unit module is the core module, which supports radix 2-NTT / INTT algorithm, radix 4-NTT / INTT algorithm, point multiplication operation, etc.

[0069] Lattice-based post-quantum cryptography is a polynomial multiplication algorithm in the polynomial ring x. n +1, NTT is in a finite field The FFT defined above replaces the unit root in the complex field with the primitive root g in the finite field. In NTT, the primitive root g is also called the rotation factor ω. Assume that the number of calculation points n of NTT, the modulus q and the primitive root corresponding to q are given. The primitive root g satisfies the four properties of zeroness, periodicity, symmetry, and reducibility. The four properties can be expressed as follows:

[0070]

[0071] For lattice-based post-quantum cryptographic algorithms, after the modulus q is determined, the number of bits and primitive roots It has been proved that the primitive root satisfies the properties of the rotation factor in FFT. For the convenience of representation, the rotation factor ω is used. N represents the primitive root of unit of order N, that is Then the NTT and INTT calculations for N-term polynomial vectors can be expressed as follows, where a i Represents the i-th coefficient of vector a.

[0072]

[0073] The base 2-NTT algorithm divides the polynomial into two parts according to the odd and even terms according to the time domain guide j, thereby simplifying the operation. If the time domain guide j divides the polynomial into four parts according to this divide-and-conquer idea, the multiplication operation in the NTT algorithm can be further simplified. If the above formula is decomposed into four core residual groups according to the time domain guide j, where a j represents the j-th coefficient, φ 2N is the primitive root of unity of order 2N, ω N is a primitive root of unity of order N and satisfies As shown below:

[0074]

[0075] In order to simplify the formula and facilitate understanding, They are X0, X1, X2, and X3 respectively, which can be simplified to:

[0076]

[0077] According to the rotation factor ω N The sum zero and reducibility of can be concluded At the same time, due to The following results can be obtained:

[0078]

[0079] Once the number of terms N of the NTT algorithm is given, the number of modular additions and subtractions is determined, which is independent of dividing the NTT into k parts according to the time domain index j. However, as the cardinality k increases, the number of iterative layers can be effectively reduced, but this will also make the input vector a of the butterfly unit i and the rotation factor ω N The length becomes longer, resulting in more non-trivial multiplications inside the butterfly unit. At the same time, a higher radix k also requires more data paths and interconnect networks for memory mapping, increasing the complexity of the control logic. Compared with the radix 2-NTT algorithm, the radix 4-NTT algorithm reduces the number of iterations by half, and the coefficients and rotation factors ω N The number of full multiplications is greatly reduced, and the newly added constant multiplication can be implemented by addition and shift, which reduces resource consumption.

[0080] However, the radix 4-NTT algorithm also has some problems. For a polynomial vector of N terms, the number of iterations is log4N, which requires that the number of terms of the polynomial must be a power of 4. For the Kyber and Dilithium algorithms, the number of polynomial terms is 256, which meets the requirements of the radix 4-NTT algorithm. However, for lattice cryptographic algorithms with polynomial terms of 512 or 2048, the radix 4-NTT algorithm is not applicable. In addition, in order to obtain a shorter public key and ciphertext length, the Kyber algorithm sets the modulus q to 3329, which results in only a 256-order primitive root of unity, and no 512-order primitive root of unity. Therefore, the Kyber algorithm cannot directly use the ordinary NTT algorithm. In actual use of the Kyber algorithm, the abridged KNTT algorithm is often used to divide the 256-term polynomial vector into an odd part and an even part, and each part is regarded as an independent 128-point NTT for calculation.

[0081] Therefore, the present invention adopts a base 2 & base 4-NTT hybrid algorithm that combines the base 2-NTT algorithm with the base 4-NTT algorithm. This algorithm first uses The base 4-NTT algorithm is used again, and then two parallel base 2-NTT butterfly calculations are used to obtain the point value polynomial. The two point value polynomials are multiplied point by point to obtain the product C(a·b). The base 2-INTT algorithm is first executed in INTT, and then executed The base 4-INTT algorithm converts back to the coefficient polynomial C. Taking the 8-point polynomial vector as an example, the data flow diagram of the base 2 & base 4-NTT hybrid algorithm is as follows Figure 2 shown.

[0082] The radix 2 & radix 4-NTT hybrid algorithm is a hybrid algorithm that combines the radix 2-NTT and radix 4-NTT algorithms to solve the problem of polynomial coefficient N satisfying N = 2. x Under the condition of , the advantage of converting part of the full modular multiplication into half modular multiplication in base 4-NTT is absorbed, the applicability of the base 4-NTT algorithm is expanded, and the complexity of the NTT algorithm is effectively reduced.

[0083] The butterfly calculation in the radix 2 & radix 4 hybrid NTT algorithm is divided into two steps. The first step is to calculate the intermediate values. The calculation method of the intermediate values ​​d0 and d1 is basically the same as the radix 2-CT butterfly calculation method. In NTT mode, (a±bω)modq is calculated, and in INTT mode, 1 / 2(a+b)modq and 1 / 2(ab)·ωmodq are calculated. The rotation factor at this time is a fixed value. The calculation method of the intermediate values ​​d2 and d3 is different from that of the CT butterfly calculation and the GS butterfly calculation in base 2. In NTT mode, the calculation of (aω1+bω2)modq involves two modular multiplications and one modular addition, while in INTT mode, the calculation of 1 / 2(a±b)modq only covers modular addition and modular subtraction. The second step is to use the intermediate value of the first step to calculate the final result of the butterfly calculation, where the result A 4jm+k and A (4j+2)m+k The calculation method is exactly the same as the base 2-CT butterfly calculation method; the result A (4j+1)m+k and A (4j+3)m+k The calculation method is basically the same as the base 2-GS butterfly calculation method.

[0084] The design of the butterfly unit in the present invention needs to support both the base 2 and base 4-NTT algorithms, so the entire butterfly structure will be composed of four small butterfly units, respectively recorded as BFU0, BFU1, BFU2 and BFU3. The designs of the four BFUs are not exactly the same, but each BFU requires 6 clock cycles from input to output, so a different number of registers will be inserted in each BFU. Among them, the designs of BFU0 and BFU3 are exactly the same except for the rotation factor, and both are butterfly unit structures under base 2-NTT. BFU1 consists of one modular addition and one modular subtraction, and does not contain modular multiplication operations. In order to ensure data consistency, it is necessary to set three groups of registers before the modular addition unit and the modular subtraction unit at the two input ends of BFU1, and to insert three groups of registers when completing the modular addition and subtraction operations to ensure that the data of the same clock cycle is always in the same cycle execution, avoiding confusion of data of different cycles in multiple BFUs. BFU2 consists of two modular additions, one modular addition and one modular subtraction, and it is necessary to add an additional modular multiplier module to calculate additional multiplication operations, and add multiple multiplexers to control the flow of data. At the same time, there are multi-level registers and two multiplexers on the input of the rotation factor. In NTT and INTT modes, the register is a two-level register to make the polynomial coefficients correspond to the primitive unit root at this time during the butterfly calculation. In PWM mode, it is necessary to set a seven-level register, and the input is the coefficient under the point value polynomial to ensure the correspondence between the data. The hardware design of the overall butterfly unit under the NTT algorithm is as follows Figure 3 shown.

[0085] Since the butterfly unit in the present invention should support multiple operations such as NTT, INTT, dot multiplication, addition and subtraction, it is necessary to set multiple modes to control and schedule the four groups of small BFU units. The butterfly unit configuration in NTT mode is as follows Figure 3As shown, in INTT mode, the butterfly unit IBFU0 in INTT corresponds to the butterfly unit BFU1 in NTT, IBFU2 corresponds to BFU3, IBFU1 corresponds to BFU0, and IBFU3 corresponds to BFU2. In the point multiplication mode, since the point value polynomial obtained after the coefficient polynomial vector in the Kyber algorithm is transformed by NTT is not a linear polynomial, but a linear polynomial, the point multiplication of its linear polynomial is not a simple multiplication of each term one by one, but consists of four modular multiplications, four modular additions, and one modular subtraction. The specific calculation process is shown in the following formula:

[0086]

[0087] However, the dot product is different from NTT / INTT because it not only needs to calculate the product of two sets of corresponding position coefficients separately and We also need to calculate their sum Therefore, we cannot use the same butterfly unit to obtain these three sets of results at the same time, and we need to add additional modular addition units to calculate and In addition, the sum of the two sets of coefficients Two groups of modular addition units are also needed to sum, so the design of the present invention in the dot multiplication mode will not use the butterfly unit BFU1, but instead use three groups of modular addition units to calculate the three groups of sums. The present invention uses two small butterfly unit structures, BFU0 and BFU2, in the calculation of radix 2-NTT / INTT. BFU1 and BFU3 do not participate in the calculation at this time. There are two modular multiplication units, one modular addition unit, and one modular subtraction unit in BFU2, but only one modular multiplication unit, one modular addition unit, and one modular subtraction unit are needed at this time, and the other modular multiplication unit can maintain the original value output. The specific scheduling in different modes is as follows Figure 4 As shown in the figure, u0, u1, v0, and v1 represent the input of the four coefficients in the entire butterfly unit at this time. Each small BFU has two output signals, which are recorded as up and low. The four coefficients and the rotation factors are output as the result of this round of iteration after the butterfly calculation is completed, which are represented by the signals bf_0_lower, bf_1_lower, bf_0_upper, and bf_1_upper.

[0088] The present invention also proposes a conflict-free memory mapping solution to address the conflict between RAM read and write. For a polynomial vector with N=256 in Kyber, if the xth coefficient is represented in binary, it can be recorded as xth (2)If the first of the four coefficients is taken as the base data, the remaining three data items can be represented according to the base data. For example, in the first round of base 4-NTT, if the base data is 0x00XXXXXX, the other three items can be recorded as 0x01XXXXXX, 0x10XXXXXX, and 0x11XXXXXX. Then the order of base address changes during the iteration is:

[0089]

[0090] The iteration round is Ite = {0, 1, K, log4N-1}. The address of the x-th polynomial coefficient is expressed in binary, such as address a = (a7, a6, a5, a4, a3, a2, a1, a0), and the addresses are summed up in pairs, that is, (a7a6+a5a4+a3a2+a1a0), and then the value is modulo 4 to get the bank where the x-th coefficient should be placed. For example, the address of the 35th coefficient can be recorded as 0x00100011, and the sum of the two-by-two is 0+2+0+3=5, 5%4=1, so the 35th coefficient should be stored in Bank1. Figure 5 The coefficient items input in each round of iteration are listed. The four coefficients of the same group of clock inputs in the same round should be stored in 4 different banks with mutually exclusive addresses to avoid data conflicts. Therefore, the coefficients need to be stored in different banks according to the xth item.

[0091] The rotation factors of the radix 4-NTT mode and the radix 4-NTT mode are not exactly the same. In the radix 2-NTT mode, taking 4-point NTT as an example, the rotation factors need to use the 4th-order primitive unit root and are stored in the ROM in the order of bit reversal; in the radix 4-NTT mode, the rotation factors of the 4-point NTT need to use the 8th-order primitive unit root and the fixed The rotation factors are divided into three groups and stored in ROM. However, in NTT and INTT, the rotation factors required for calculation are different. The rotation factors required by INTT are the inverse elements of the rotation factors in NTT. If the inverse elements of these rotation factors are calculated separately and stored in ROM, due to the reuse of the butterfly unit, not only additional signals are required to control the reading of the rotation factors, but also storage is wasted. The present invention utilizes the periodicity of the rotation factors. The rotation factors in NTT are reused in INTT by changing the order of accessing the rotation factors. In the fixed multiplication, the rotation factors of NTT are The twiddle factor in I NTT is Through the same rotation factor characteristics, the original 4-NTT algorithm can be Adjust to 1 / 2·(x (4j+3)m+k -x (4j+1)m+k )modq, convert the original 1 / 2·(x 4jm+k -x (4j+2)m+k )modq is adjusted to Thus, the rotation factor in INTT is fixed to Keep consistent with the NTT algorithm.

[0092] In the radix-2 & radix-4-NTT hybrid algorithm, the NTT operation of an N-term polynomial vector requires log4N-1 rounds of radix-4-NTT iterations and 1 round of radix-2-NTT iterations. In the log4N-1 rounds of radix-4-NTT iteration loop, a total of The group rotation factors correspond to The primitive unit root of The arrangement rule divides these primitive roots into three groups for storage. In the last round of the base 2-NTT iteration cycle, it is necessary to There are 64 groups of rotation factors in total, according to In the point-by-point multiplication PWM after NTT, a total of N / 2 PWM operations are performed. There are N / 2 groups of rotation factors for the primitive unit roots, which are stored in the order of the bit-reversed bits. It can be seen that the rotation factors used in the PWM operation are exactly the same as the rotation factors used in the NTT / INTT operation except for the arrangement. However, in order to simplify the control logic of the rotation factors, the present invention still stores the rotation factors used in the PWM operation separately in an independent ROM in the hardware design, and adds a multiplexer in the data path of the rotation factors to select the corresponding rotation factors according to the different modes in the polynomial multiplication module. The specific arrangement of the rotation factors is as follows: Figure 6 shown.

[0093] In the description of this specification, the description of reference terms such as "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples without contradiction. In addition, the terms "first" and "second" are used only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" can explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "N" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. Any process or method description in the flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code including one or more executable instructions for implementing the steps of a custom logic function or process, and the scope of the preferred embodiment of the present invention includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved, which should be understood by a person skilled in the art of the art to which the embodiments of the present invention belong. The logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as a sequenced list of executable instructions for implementing the logic function, and may be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection having one or N wirings (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM).In addition, the computer readable medium can even be paper or other suitable medium on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, then editing, interpreting or processing in other suitable ways as necessary, and then storing it in a computer memory. It should be understood that the various parts of the present invention can be implemented with hardware, software, firmware, or a combination thereof. In the above-mentioned embodiment, N steps or methods can be implemented with software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented with hardware, as in another embodiment, any one of the following technologies known in the art or their combination can be used to implement: a discrete logic circuit with a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit with a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0094] The above is only a preferred implementation of a high-performance polynomial multiplication hardware acceleration architecture for a lattice cryptographic chip. The protection scope of a high-performance polynomial multiplication hardware acceleration architecture for a lattice cryptographic chip is not limited to the above embodiment. All technical solutions under this idea belong to the protection scope of the present invention. It should be pointed out that for those skilled in the art, several improvements and changes without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A high-performance polynomial multiplication hardware acceleration architecture for lattice cryptographic chips, Its characteristics are: The architecture adopts a radix-2 & radix-4 hybrid NTT hardware module, which is a hardware implementation of a radix-2 & radix-4 hybrid NTT algorithm, including a control logic unit and an operation logic unit; The control logic module includes a control unit, which controls the address generator to generate data addresses, the memory mapping unit to generate data write-back addresses, the operation modulus and input data of the butterfly unit, and the scheduling of the rotation factors through control signals; The arithmetic logic unit adopts a butterfly unit module, and the butterfly unit includes modular addition, modular subtraction, modular multiplication, memory and multiplexer.

2. The acceleration architecture according to claim 1, Its characteristics are: The base 2 & base 4 hybrid NTT hardware module needs to complete the NTT operation, point multiplication operation, INTT operation and addition and subtraction operation of the polynomial vector; The NTT operation is the process of converting a polynomial vector from a coefficient polynomial to a point value polynomial, while the INTT operation is exactly the opposite; the point multiplication operation is the multiplication of two point value polynomial vectors, and the addition and subtraction operation is the addition and subtraction of two polynomial vectors.

3. The acceleration architecture according to claim 2, Its characteristics are: The butterfly unit is the core of the polynomial multiplication module architecture. It consists of four groups of small butterfly units BFU, denoted as BFU0, BFU1, BFU2 and BFU3. Each BFU requires 6 clock cycles from input to output, and a different number of registers are inserted in each BFU.

4. The acceleration architecture according to claim 3, Its characteristics are: The design of BFU0 and BFU3 has a rotation factor module, and the butterfly unit supports polynomial vector radix 2 and radix 4-NTT algorithms and point multiplication operations.

5. The acceleration architecture according to claim 4, Its characteristics are: The randomly input polynomial coefficients and the rotation factors corresponding to the Kyber algorithm are stored in the Bank according to the corresponding rules. The memory includes 4 groups of Banks, which are responsible for storing the coefficients of the N-term polynomial vector. Each Bank stores N / 4 coefficients. The four polynomial coefficients participating in the butterfly unit operation are generated through the address generator and arbitration unit scheduling. The four results of the butterfly operation will also be written back to the 4 Banks through the data write back unit.

6. The acceleration architecture according to claim 5, Its characteristics are: The address generator includes a coefficient base address generator, a memory mapping, and an arbitration unit. The coefficient base address generator generates four sets of base address signals for reading coefficients at this clock through the iterative loop signals p, k, and j of the state machine. The memory mapping unit maps the four sets of base address signals into the read address signals and write address signals of the coefficients. The arbitration unit and the data reading unit determine the order in which the four coefficients taken out of the Bank are input into the butterfly unit according to the Bank index signal in the read address signal.

7. The acceleration architecture according to claim 6, Its characteristics are: The twiddle factor module is divided into an address generation module and a storage module of the twiddle factor. The address generator of the twiddle factor is controlled by the control unit. When the polynomial multiplication module performs NTT, INTT, and PWM operations, the address of the twiddle factor is generated. The twiddle factor storage module ROM provides the corresponding primitive unit root according to the address of the twiddle factor, and participates in the modular multiplication operation in the butterfly unit and the point-by-point multiplication operation in Kyber.

8. The acceleration architecture according to claim 7, Its characteristics are: The control unit is mainly composed of a state machine, which is written in two stages and can be transferred between different states through signals; The control unit implements various operations through various states in the state machine and the transition between states to complete the complete polynomial multiplication.

Citation Information

Patent Citations

  • Polynomial multiplication hardware implementation system suitable for lattice cryptographic algorithm

    CN114297571A

  • Efficient lightweight NTT multiplier circuit based on lattice cipher

    CN115756386A

  • NTT hardware implementation system based on FPGA platform

    CN116545622A

  • Efficient application type polynomial operation circuit applied to CRYSTALS-Kyber

    CN116886274A

  • Hardware circuit of NTT polynomial multiplier for post-quantum encryption Kyber scheme

    CN117193715A

Cited By

  • Concurrent constant geometry number-theory transformation structure

    CN119556884A

  • Constant geometric structure-based radix-4NTT hardware architecture and memory access method thereof

    CN119583062A

  • A Base-4 NTT Hardware Architecture Based on Constant Geometry and Its Memory Access Method

    CN119583062B

  • Hardware accelerator for key switching algorithm in CKKS homomorphic encryption algorithm

    CN119766410A

  • Data processing device, method, equipment and chip

    CN119987855A