An efficient and secure cryptographic hardware with shared core functions
Through shared core function design and integration of T tables and hard macro memory blocks, the problem of resource consumption and side channel attacks of the AES algorithm in the encryption and decryption process is solved, and efficient and secure encryption and decryption hardware implementation is achieved.
Patent Information
- Application Number
- CN202210697673.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-20
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-06-20
AI Technical Summary
Existing encryption modules are difficult to ensure efficiency and security when facing side-channel attacks. Especially in IoT applications, the implementation of the AES algorithm consumes large resources and is vulnerable to attacks.
The shared core function design method is adopted, and through formal consistency, fused T-table construction and hard macro memory block (BRAM) implementation, shared round function modules and fused T-tables are used to reduce resource consumption and improve the ability to resist side channel attacks.
It achieves the consistency of the encryption and decryption round functions of the AES algorithm, reduces resource consumption, shortens the key generation cycle, improves side channel security, significantly reduces the number of LUTs and BRAM used, and improves the ability to resist side channel attacks.
Smart Images

Figure CN115021893B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information security technology, and proposes an efficient and secure cryptographic hardware with a shared core function, which can resist first-order side channel attacks. Hardware designers can use the present invention to efficiently and securely implement the Advanced Encryption Standard (AES) algorithm, which can resist first-order side channel attacks and ensure the security of sensitive data; the present invention is mainly used to ensure the side channel security of encryption hardware. Background Art
[0002] The encryption module is an indispensable part of systems such as confidential communication, authentication, and electronic signature. With the rapid development of IoT applications, encryption modules must be implanted in micro devices or embedded systems. Therefore, it is of great significance to ensure the efficiency of encryption modules. At the same time, hardware encryption devices are seriously threatened by side channel attacks. Most direct implementations of cryptographic algorithms can be easily cracked by side channel attacks. Therefore, it is very important to ensure the side channel security of encryption modules. In summary, designing a secure and efficient encryption module has become an urgent problem to be solved.
[0003] The most widely deployed symmetric encryption algorithm is the AES encryption algorithm. The T-table implementation for AES is an efficient implementation of AES, which was applied to hardware implementation by Drutarovsky et al. Specifically, the T-table implementation uses a lookup table to complete part of the byte replacement, row shift, and column confusion of the AES algorithm, reducing the time required for calculation. The specific design of the T-table is as follows:
[0004]
[0005] The 32-bit output of table T includes four 8-bit data, namely, 1x S-box, 3x S-box, 1x S-box and 2x S-box; -1 The 32-bit output of the table includes four 8-bit data, which are 9 times the S -1 Box, 11 times S -1 Box, 13 times S -1 Box and 15 times S -1 The S box is a byte replacement, S -1 The box is byte replacement inversion. Using the original T-table solution, AES encryption and decryption are calculated separately. The specific T-table solution process is as follows Figure 1 and Figure 2As shown. In fact, the AES algorithm belongs to the cryptographic algorithm of the SPN structure. The cryptographic algorithm of the SPN structure has better diffusion than the Feistel structure, but the asymmetric encryption and decryption causes a certain degree of resource waste. Due to the different encryption and decryption functions and the different encryption and decryption round key generation, the resource consumption will increase by about 50%, and the difficulty of hardware design against side channel attacks will be increased.
[0006] FPGA chips contain soft logic and hard logic. Soft logic refers to any logic function implemented using general logic resources such as look-up tables (LUTs), flip-flops (FFs), and data selectors. Hard logic refers to logic functions implemented using dedicated hardware circuit hard macros such as block RAMs (BRAMs), digital signal processors, analog-to-digital converters, and high-speed serial communication interfaces. With the improvement of semiconductor integration and the increase in the scale of FPGAs, the way to implement complete and complex systems on FPGAs has begun to attract attention. Embedding hard macros into FPGA chips is more efficient than soft logic designed by users themselves (reference: FPGA Principles and Structures, edited by Hideharu Amano and translated by Qian Zhao).
[0007] BRAM is an efficient memory implemented in the form of hard macros. If the block memory hard macros can be used skillfully in the design of cryptographic hardware circuits, side channel attacks can be resisted to a certain extent. There are two specific reasons. First, the registers in the BRAM hard macros can replace the triggers required for the round function output of the cryptographic algorithm, thereby reducing or even eliminating the triggers that store sensitive information. Since the registers in the BRAM hard macros are not affected by wiring amplification, their signal-to-noise ratio is extremely low, and they have a certain degree of resistance to side channel attacks. At the same time, Bhasin et al. gave an experimental verification of the resistance of registers in BRAM to side channel attacks (reference: Shivam Bhasin, Sylvain Guilley, Annelie Heuser, Jean-Luc Danger. From cryptography to hardware: analyzing and protecting embedded Xilinx BRAM for cryptographic applications. J. Cryptogr. Eng. 3 (4): 213-225 (2013)). Second, the use of BRAM can reduce the impact of layout and wiring imbalance in dual-track circuits. The use of BRAM saves computing processes, and its output has the technical feature of small fan-out, which reduces the impact of layout and routing imbalance in dual-track circuits, thereby enhancing the ability to resist side channel attacks (reference: Shivam Bhasin, Jean-Luc Danger, Sylvain Guilley, Wei He. Exploiting FPGA Block Memories for Protected Cryptographic Implementations. ACM Trans. Reconfigurable Technol. Syst. 8(3):16:1-16:16(2015)).
[0008] In terms of improving the hardware implementation performance of cryptographic algorithms, the use of BRAM has the following two functions. First, it reduces the number of general logic resource lookup tables (LUTs) used. In FPGA chips that are mainly used for calculations, general logic resources are more scarce. The use of BRAM can reduce the calculation process and thus reduce the number of LUTs used. Second, it improves the computing speed of IP cores. The use of BRAM can reduce the calculation on the critical path, thereby increasing the minimum clock delay and speeding up the computing speed of cryptographic algorithms. Summary of the invention
[0009] In order to reduce the area of secure implementation of cryptographic algorithms and improve the throughput of secure implementation of cryptographic algorithms, the present invention proposes an efficient and secure cryptographic hardware for sharing core functions. The design method of the efficient and secure cryptographic hardware for sharing core functions includes three steps: formal consistency, fusion T-table construction, and hard macro memory block (Block RAM, referred to as BRAM) implementation. The formal consistency can provide a formal basis for the shared core function; the fusion T-table construction is an important step in the design of the shared core function, which solves the problem of additional resource consumption caused by the asymmetric encryption and decryption of the SPN structure cryptographic algorithm; the hard macro memory block implementation is a key step in improving the side channel security of the hardware implementation of the shared core function. The present invention has the following technical advantages: First, the encryption and decryption round functions of the AES algorithm are consistent through this method, which greatly reduces resource consumption and reduces the area required for cryptographic implementation; second, the number of cycles required for AES decryption key generation is reduced through this method; third, the hardware implementation of the cryptographic algorithm is resistant to side channel attacks through this method, improving the side channel security of the cryptographic hardware implementation.
[0010] The technical solution adopted by the present invention is:
[0011] An efficient and secure cryptographic hardware with a shared core function, characterized in that it includes a shared round function module, which includes a 2-input XOR unit, a 2-to-1 selector, a memory module, and a 5-input XOR network;
[0012] The output terminal of the 2-input XOR unit is connected to an input terminal of the 2-to-1 selector;
[0013] The other input end of the 2-to-1 selector is connected to the output end of the 5-input XOR network, and the output end is connected to the input end of the memory module. The control end of the 2-to-1 selector is connected to the output end of the state machine for receiving a control signal F1; the control signal F1 indicates whether an initial round operation is currently being performed;
[0014] The output end of the memory module is connected to the input end of the 5-input XOR network; the memory module stores a fused T table; the fused T table is a table obtained by replacing the T table used for encryption and the T table used for decryption for inversion; the control end of the 5-input XOR network is connected to the output end of the state machine for receiving a round number control signal F2;
[0015] When encrypting or decrypting a message, in the initial round, the 2-input XOR unit performs an XOR operation based on the input message and the initial round key NK. 0 Perform a round key addition operation and send the calculation result R0 to the 2-to-1 selector;
[0016] The output of the 2-to-1 selector is recorded as R2. The output R2 selects between the two input information according to the state control signal F1 of the state machine. When the initial round key is used for encryption / decryption, the R0 value is selected as the output. When the 1st to 10th round keys are used for encryption / decryption, the output value R1 of the 5-input XOR network is selected as the output. In the initial round of the first cycle, the output R2 of the 2-to-1 selector selects the value of R0 for output.
[0017] The shared round function module runs for 10 cycles, which are the 2nd to 11th cycles; wherein, in each cycle:
[0018] The memory module uses the input R2 and control signal f as the query address of the fusion T table, and outputs the query result as R3; wherein the control signal f represents the encryption or decryption state;
[0019] The 5-input XOR network first performs XOR on R3 and the input round key NK of round R R Perform 32 5-input XOR operations, and then perform 2-choose-1 operations on the results of the 32 5-input XOR operations according to the control signal F2 of the state machine to obtain 16 5-input XOR results b j ; Wherein, j is an integer from 0 to 15; the round key NK R It can be divided into 16 bytes from high to low, respectively. The subscript j is an integer from 0 to 15, and the superscript R is an integer from 1 to 10; the output of the 5-input XOR network is 16 8-bit data b j , that is, R1;
[0020] The 2-to-1 selector outputs the value of R2 selecting R1 for output in the 2nd to 11th cycles;
[0021] After the shared round function module runs for 10 cycles, the result R1 obtained in the 10th round is output in the 12th cycle.
[0022] Further, the fusion T table is Among them, f is 1 bit, a is 8-bit data, and a is the 8-bit data intercepted from R2 from high to low; when encrypting, f takes 1, and the result of the MT table is the result of the T table substitution, which are 1 times the S box output, 3 times the S box output, 1 times the S box output, and 2 times the S box output; when decrypting, f takes 0, and the result of the MT table is the inverse of the T table substitution, which are 9 times the S box output. -1 Box, 11 times S -1 Box, 13 times S -1 Box and 15 times S -1 Box; S box is the byte replacement in the AES algorithm, S -1The box is the inverse of the byte substitution in the AES algorithm.
[0023] Furthermore, the output 32-bit data of the MT table is split into four 8-bit outputs, and the subscripts t1 to t4 are used to represent the four bytes from the highest to the lowest bit, specifically MT[f,a]={MT[f,a] t1 ,MT[f,a] t2 ,MT[f,a] t3 ,MT[f,a] t4}.
[0024] Furthermore, the input R2 of the memory module is 128 bits of data, and R2 is divided into 16 8-bit data from high to low, called a0, a1, ..., a j , …, a 15 , j∈[0,1,……,15]; the memory module includes 16 block memories, and the input of the jth block memory includes f and a j The output of the jth block memory is based on the input f and a j Query the fusion T table to obtain the result.
[0025] Furthermore, the outputs of the 16 block memories are 16 32-bit data, which are MT[f,a 0+4i ]、MT[f,a 13-8f+4i ]、MT[f,a 10+4i )]、MT[f,a 7+8f+4i ], where i is 0, 1, 2, and 3 respectively, and the subscript of a needs to be modulo 16.
[0026] Furthermore, the 5-input XOR network includes four XOR sub-networks; each of the XOR sub-networks includes 8 5-input XOR gates and 1 8-input 2-to-1 selector; the input of the 5-input XOR sub-network is MT[f,a 0+4i ]、MT[f,a 13-8f+4i ]、MT[f,a 10+4i )]、MT[f,a 7+8f+4i ], the output is 4 8-bit data b 0+4i 、b 1+4i 、b 2+4i 、b 3+4i , as the output of the 5-input XOR subnetwork; when i is 0, 1, 2, and 3 respectively, we get b0~b 15 A total of 128 bits of data are the output of the 5-input XOR network, denoted as R1; among them, in the 5-input XOR sub-network, the state F2 of the 2-to-1 selector is determined by the number of encryption rounds. When the 10th round of encryption and decryption is executed, F2 is 1; when the initial round of encryption and decryption and rounds 1-9 are executed, F2 is 0.
[0027] Further, the XOR sub-network is expressed as: in, is the 1+4ith byte of the Rth round key, R is an integer from 1 to 10, i is an integer from 0 to 3, MT[f,a 0+4i ] tk It is the kth byte from high to low in the output value of the fused T table, where k is an integer from 1 to 4.
[0028] According to the present invention, a highly efficient and secure cryptographic hardware design method for sharing core functions is designed, which is characterized by comprising the following steps:
[0029] A. Form consistency refers to the fact that in the operations of the encryption and decryption round functions, except for the T-table substitution and the T-table substitution inversion, all other operations are the same. In this case, the encryption and decryption round functions are considered to have the same form. The original AES encryption circuit optimization process based on the T-table is as follows: Figure 1 As shown, the original AES decryption circuit optimization process based on T table substitution and inversion is as follows Figure 2 As shown in the figure, the round functions of AES encryption and decryption are not consistent. If the 2-input XOR of the AES decryption round function is changed to a 5-input XOR, the encryption and decryption operations will be consistent in form, which can provide a formal basis for sharing the round function.
[0030] B. Constructing a fused T-table refers to merging the T-table substitution used for encryption and the T-table substitution used for decryption into a new table. This table is called a fused T-table, or MT for short. The storage depth of the fused T-table is 512, and the output is 32-bit data. Its definition is shown in formula (2):
[0031]
[0032] Where f is 1 bit and a is 8 bits. When f is 1, the result of the MT table is the original T table substitution result; when f is 0, the result of the MT table is the original inverse T table substitution. The input of the MT table is a 9-bit address and the output is 32-bit data. The 32-bit output is split into four 8-bit outputs, represented by subscripts t1, t2, t3, and t4, as shown in the formula.
[0033] MT[f,a]={MT[f,a] t1 ,MT[f,a] t2 ,MT[f,a] t3 ,MT[f,a] t4}
[0034] C. Hard macro BRAM implementation refers to the use of storage blocks to implement the fused T table, and the registers storing the round function output are implemented using the registers inside the block storage. This implementation can not only reduce the use of general logic resources, but also improve the ability of the cryptographic implementation to resist side channel attacks. Block storage implementation is the key to improving the compactness and security of shared round functions.
[0035] The present invention designs a highly efficient and secure cryptographic hardware with shared core functions, which has three technical advantages: first, the number of BRAMs used is reduced by 50%, second, the number of LUTs used is reduced, and third, the ability to resist side channel attacks is improved.
[0036] The first technical advantage is that the number of BRAMs used is reduced by 50%. In the Xilinx Kintex-7 series of BRAMs, the smallest BRAM is 18Kb, and two 18Kb BRAMs form a 36Kb BRAM. If one byte substitution of AES is stored, the storage depth is 256, the output is 8-bit data, the storage space is 2Kb, the number of BRAMs used is 1, and the storage resource utilization rate in the BRAM is 1 / 9; if one T-table substitution is stored, the storage depth is 256, the output is 32-bit data, the storage space is 8Kb, and the storage resource utilization rate in the BRAM is 4 / 9; if one fusion T-table is stored, the storage depth is 512, the output is 32-bit data, and the storage space is 16Kb, only one 18Kb BRAM is still needed, and the storage resource utilization rate in the BRAM is 8 / 9. Byte substitution and byte substitution inversion require a total of 2 BRAMs, T-table substitution and T-table substitution inversion require a total of 2 BRAMs, and the fused T-table only requires 1 BRAM to store all the contents of T-table substitution and T-table substitution inversion. Therefore, compared with byte substitution, the fused T-table reduces the number of BRAMs used by 50%, and the utilization rate of the internal storage resources in the BRAM increases by 8 times.
[0037] The second technical advantage is that the number of LUTs used is reduced. In FPGA chips that are mainly used for computing, LUTs are scarce resources. The efficient and secure cryptographic hardware method proposed in this paper reduces the number of LUTs used in two ways. On the one hand, the encryption and decryption round functions can be shared, and the required 5-input XOR network is reduced from one for encryption and one for decryption to only one 5-input XOR network, thereby reducing the number of LUTs used; on the other hand, the use of hard macro BRAM to implement the fused T table reduces the LUTs required for the generation of the fused T table.
[0038] The third technical advantage is the improved ability to resist side channel attacks. The registers in the hard macro BRAM are used to replace the round function output registers of the cryptographic algorithm. The original round function registers store information related to the key, and side channel attacks on them can easily recover the key; while the registers in the hard macro BRAM, such as Figure 3As shown, since it is not affected by wiring amplification, its signal-to-noise ratio is extremely low, and it has a certain degree of resistance to side channel attacks. Bhasin et al. gave an experimental verification that the registers in BRAM have strong resistance to side channel attacks (reference: Shivam Bhasin, Sylvain Guilley, Annelie Heuser, Jean-Luc Danger. From cryptography to hardware: analyzing and protecting embedded Xilinx BRAM for cryptographic applications. J. Cryptogr. Eng. 3(4): 213-225 (2013)).
[0039] Compared with the prior art, the AES implementation of the shared core function proposed in the present invention has the following positive effects:
[0040] The present invention proposes a shared core function AES hardware design method, provides an AES round function design based on a fused T table, shares the encryption and decryption round function, and reduces the difficulty of security implementation design and resource cost. Taking the number of general logic resource look-up tables (LUTs) in a field programmable gate array (FPGA) as an area indicator and the throughput as a speed indicator, the AES circuit provided by the present invention has the technical characteristics of low area and high throughput. Specifically, the AES implementation provided by the present invention can resist the side channel attack of one million energy traces / electromagnetic traces, and the minimum number of successful attacks is at least 7.36 times that of the BCDL (T-box) implementation; using a Virtex-5 FPGA device for synthesis, the number of LUTs used is 21% of that of the BCDL (T-box) implementation; the number of BRAMs used is 25% of that of the BCDL (T-box) implementation; and the throughput is 5.63 times that of the BCDL (T-box) implementation. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is an encryption optimization process based on T table substitution.
[0042] Figure 2 It is a decryption optimization process based on T table substitution and inversion.
[0043] Figure 3 is an example of a memory module used as a read-only memory.
[0044] Figure 4 The memory module of the fused T table of the present invention is implemented.
[0045] Figure 5 This is the overall circuit diagram of the shared wheel function of the present invention.
[0046] Figure 6 The circuit diagram of the memory module and the 5-input XOR network of the present invention.
[0047] Figure 7 This is the CPA attack result of 1 million energy traces implemented by the AES hardware of the present invention.
[0048] Figure 8 This is the CPA attack result of 1 million electromagnetic traces implemented by the AES hardware of the present invention. DETAILED DESCRIPTION
[0049] The present invention is further described in detail below with reference to the accompanying drawings.
[0050] The efficient and secure hardware design method for the shared core function provided by the present invention provides a hardware implementation of the shared round function, which is characterized by a shared round function module.
[0051] Shared round function module such as Figure 5 As shown, it includes a 2-input XOR, a 2-to-1 selector, a memory module, and a 5-input XOR network; the input of the 2-input XOR is a message and an initial round key; the output of the 2-to-1 selector is determined by the state of the current state machine, when the initial round key is used for encryption / decryption, the R0 value output by the 2-input XOR is selected as the output, and when the 1st to 10th round keys are used for encryption / decryption, the R1 value output by the 5-input XOR network is selected as the output; the memory module includes 16 block memories, the input of a single block memory includes 9 bits, and the output of a single block memory is 32 bits.
[0052] The various modules of the present invention are described as follows:
[0053] When the key is valid and the external input message is valid, the shared round function module starts running, and the running cycle is 12 cycles.
[0054] In the first cycle, a) 2-input XOR and b) 2-to-1 selector modules are run; from the second cycle to the eleventh cycle, c) memory module, d) 5-input XOR network and b) 2-to-1 selector module are run in sequence; in the twelfth cycle, the calculated value R1 of the 5-input XOR network is output.
[0055] a) 2 input XOR
[0056] The input to the 2-input XOR is the message and the initial round key NK 0 , the output is the result of the XOR of the two, which is actually a round key addition operation. When encrypting, the message is actually plaintext, and when decrypting, the message is actually ciphertext.
[0057] b) 2-to-1 selector
[0058] A 2-to-1 selector is a selector that takes 2 inputs and outputs 1. The specific information selected from the 2 inputs as the output is determined by the state of the state machine. According to the state machine's state signal F1, the selection is made between the 2-input XOR output R0 and the 5-input XOR network output R1. When the initial round key is used for encryption / decryption, the R0 value is selected as the output. When the 1st to 10th round keys are used for encryption / decryption, the R1 value is selected as the output. The output of the 2-to-1 selector is represented by R2, which is 128 bits of data. The control signal F1 indicates whether the initial round operation is currently being performed.
[0059] c) Memory Module
[0060] The first input R2 of the memory module is the output of the 2-to-1 selector, which is 128 bits of data. R2 is divided into 16 8-bit bits from high to low, called a0, a1, ..., a j , …, a 15 , j∈[0,1,……,15]; the second input f of the memory module is related to the encryption and decryption status, which is 1-bit data. When encryption is performed, f takes 1, and when decryption is performed, f takes 0.
[0061] The memory module includes 16 block memories (BRAMs), and the input of each block memory is 9 bits; the output of each block memory is obtained by looking up the fused T table and is 32-bit data.
[0062] Furthermore, the output of the 16 block memories is obtained by querying the fusion T table, and the output is 16 32-bit data, which are MT[f,a 0+4i ]、MT[f,a 13-8f+4i ]、MT[f,a 10+4i )]、MT[f,a 7+8f+4i ], where i is 0, 1, 2, and 3 respectively, and the subscript of a needs to be modulo 16 (that is, when the subscript of a is less than 16, the subscript itself is taken, and when it is greater than or equal to 16, the modulo needs to be taken).
[0063] Further, the fusion T table is Among them, f is 1 bit and a is 8 bits. When encrypting, f is 1, and the result of MT table is the result of T table substitution, which are 1 times S box output, 3 times S box output, 1 times S box output and 2 times S box output respectively. When decrypting, f is 0, and the result of MT table is the inverse of T table substitution, which are 9 times S box output, 1 times S box output and 2 times S box output respectively. -1 Box, 11 times S -1 Box, 13 times S -1 Box and 15 times S -1The S box is a byte replacement in the AES algorithm description. -1 The box is the byte replacement inversion in the AES algorithm description. The MT table outputs 32 bits of data. If it is split into four 8-bit outputs, the subscripts t1, t2, t3, and t4 are used to represent the four bytes from the highest to the lowest bit, specifically MT[f,a] = {MT[f,a] t1 ,MT[f,a] t2 ,MT[f,a] t3 ,MT[f,a] t4}.
[0064] d) 5-input XOR network
[0065] The first input of the 5-input XOR network is 16 32-bit data R3 output by the memory module, and the second input is a 128-bit round key NK R The third input is the round number control signal F2. The output of the 5-input XOR network is 16 8-bit data, namely R1.
[0066] The 5-input XOR network includes four XOR sub-networks. Each XOR sub-network includes eight 5-input XOR gates and one 8-input 2-to-1 selector. Figure 6 As shown in FIG. 1 , it is a connection diagram between the memory module and the 5-input XOR sub-network. Each XOR sub-network can be expressed as:
[0067]
[0068] When i is 0, 1, 2, and 3 respectively, it corresponds to 4 5-input XOR sub-networks, and the subscript of a needs to be modulo 16.
[0069] The input of the 5-input XOR subnetwork is MT[f,a 0+4i ]、MT[f,a 13-8f+4i ]、MT[f,a 10+4i )]、MT[f,a 7+8f+4i ], the output is 4 8-bit data b 0+4i , b 1+4i , b 2+4i , b 3+4i . In the 5-input XOR subnetwork, the state F2 of the 2-to-1 selector is determined by the number of encryption rounds. When the 10th round of encryption and decryption is executed, F2 takes 1; when the initial round of encryption and decryption and the 1st to 9th rounds are executed, F2 takes 0.
[0070] The output of the 5-input XOR network is the output of 4 5-input XOR sub-networks, which is 4 32-bit data, with a total of 128 bits of output.
[0071] The following is an introduction to the derivation of the shared round function formula of the present invention:
[0072] In order to facilitate the understanding of the circuit implementation, the following Figure 4 and attached Figure 5 , the shared round function of the present invention is publicly derived.
[0073] 1. Optimization of encryption and decryption round functions 1-9
[0074] The input 128-bit data of the AES round function can be divided into 16 8-bit data using a i ,i∈[0,15] is expressed as:
[0075]
[0076] The initial value of A is 128 bits of message M and 128 bits of initial round key NK 0 The result of exclusive OR. A=M+NK 0 , where “+” represents exclusive OR.
[0077] The encryption round function is optimized based on the fusion T table. After byte substitution, row shift and column confusion, it is expressed as:
[0078]
[0079] Where S[a i ] indicates that the original AES input is a i The byte substitution result. After splitting the above formula into four columns, let i = 0, 1, 2, 3, each column can be expressed as:
[0080]
[0081] The decryption round function is optimized based on the fusion T table. After inverse byte substitution, reverse row shift and reverse column confusion, it is expressed as:
[0082]
[0083] After splitting the above formula into four columns, let i = 0, 1, 2, 3, each column can be expressed as follows:
[0084]
[0085] After adding the round key plus operation, the encryption and decryption round functions of rounds 1 to 9 are optimized by merging the T table. The output can be expressed as:
[0086]
[0087] When f=1, it indicates an encryption operation, and when f=0, it indicates a decryption operation.
[0088] 2. Optimization of the 10th round function for encryption and decryption
[0089] The shared round function is designed for the 10th round of encryption and decryption. The last round of the encryption round function can be expressed as:
[0090]
[0091] The last round of the decryption round function can be expressed as:
[0092]
[0093] Therefore, the optimization of the 10th round of encryption and decryption round function based on the fusion T table can be expressed as:
[0094]
[0095] 3. Shared round function
[0096] Therefore, the merge 1 scheme based on the fused T table is adopted, and the shared round function is:
[0097]
[0098] Among them, the output data b 0+4i , b 1+4i , b 2+4i , b 3+4i is 4 8-bit integers. When i is an integer from 0 to 3, b0, b1, b2, ..., b 15 , a total of 128 bits of data, as a 5-input XOR network output, in Figure 5 , counted as R1. MT[f,a 0+4i ] tk The kth byte from high to low in the output value of the fused T table, where k is an integer from 1 to 4.
[0099] In order to reduce the number of XOR gates, the XOR operation is performed after the multiplexer selection. At this time, the shared round function is expressed as:
[0100]
[0101] It can be seen that by adding multiplexers, the number of required XOR gates is reduced.
[0102] 4. Adapting key generation for shared round functions
[0103] The encryption and decryption round keys adapted to the fusion T table are given. For the AES algorithm, the required round key formula is as follows:
[0104]
[0105] Evaluation results
[0106] The advantages of the present invention are twofold: first, by sharing the round function design, the number of LUTs used in the FPGA hardware design is reduced; second, the use of memory modules in the round function reduces the number of registers storing sensitive information, thereby improving the ability of the AES hardware implementation to resist side channel attacks. The security of the AES implementation of the present invention is evaluated below.
[0107] The BCDL (T-box) proposed by Nassar et al. (Reference: Wei He, Andrés Otero, Eduardo de la Torre, Teresa Riesgo. Automatic generation of identical routing pairs for FPGA implemented DPL logic. ReCon Fig 2012: 1-6) only needs 135,872 entries to successfully attack. Taking the minimum number of successful entries as the evaluation indicator, the MBAES (AES based on fused T-table) implementation provided by the present invention can resist the side channel attack of one million energy traces / electromagnetic traces, and its security is at least 7.36 times that of the BCDL (T-box) implementation.
[0108] The BCDL (T-box) given by Nassar et al. [BGS+2011] uses 2217 LUTs and 34 BRAMs for Virtex-5 devices. These resource consumptions include encryption operations and encryption key generation. For a uniform comparison, we subtracted the 216 LUTs and 2 BRAMs required for encryption key generation from this. The BCDL (T-box) implementation given by Nassar et al. [BGS+2011] only includes encryption operations. Based on the estimation that the resources required for decryption are the same as those required for encryption, after adding decryption operations, the number of LUTs used by MBAES is 21% of that of the BCDL (T-box) implementation. The number of BRAMs used by MBAES is 25% of that of the BCDL (T-box) implementation. The throughput of MBAES is 5.63 times that of the BCDL (T-box) implementation.
[0109] Table 1 shows the comprehensive results of two different AES implementations on the Virtex-5 device.
[0110]
[0111] By using the efficient and secure cryptographic hardware design method of the shared core function provided by the present invention, efficient and secure hardware design can be performed on other SPN structure cryptographic codes. At the same time, by using the method of this aspect, a shared core function design can be performed on the key operations of encryption and decryption round key generation to reduce resource consumption.
[0112] Although the specific embodiments of the present invention are disclosed for the purpose of illustration, the purpose is to help understand the content of the present invention and implement it accordingly, those skilled in the art will understand that various substitutions, changes and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. Therefore, the present invention should not be limited to the content disclosed in the best embodiment, and the scope of the present invention is subject to the scope defined in the claims.
Claims
1. An efficient and secure cryptographic hardware with shared core functions, characterized in that: A shared round function module includes a 2-input XOR unit, a 2-to-1 selector, a memory module, and a 5-input XOR network; The output terminal of the 2-input XOR unit is connected to an input terminal of the 2-to-1 selector; The other input end of the 2-to-1 selector is connected to the output end of the 5-input XOR network, and the output end is connected to the input end of the memory module. The control end of the 2-to-1 selector is connected to the output end of the state machine for receiving a control signal F1; the control signal F1 indicates whether an initial round operation is currently being performed; The output end of the memory module is connected to the input end of the 5-input XOR network; The memory module stores a fused T table; The fused T table is a table obtained by combining the inverse substitution of the decrypted T table and the substitution of the encrypted T table; The control end of the 5-input XOR network is connected to the output end of the state machine for receiving the round number control signal F2; When encrypting or decrypting a message, in the initial round, the 2-input XOR unit performs an XOR operation based on the input message and the initial round key NK. 0 Perform a round key addition operation and send the calculation result R0 to the 2-to-1 selector; The output of the 2-to-1 selector is recorded as R2. The output R2 selects between the two input information according to the state control signal F1 of the state machine. When the initial round key is used for encryption / decryption, the R0 value is selected as the output. When the 1st to 10th round keys are used for encryption / decryption, the output value R1 of the 5-input XOR network is selected as the output. In the initial round of the first cycle, the output R2 of the 2-to-1 selector selects the value of R0 for output. The shared round function module runs for 10 cycles, which are the 2nd to 11th cycles; wherein, in each cycle: The memory module uses the input R2 and control signal f as the query address of the fusion T table, and outputs the query result as R3; wherein the control signal f represents the encryption or decryption state; The 5-input XOR network first performs XOR on R3 and the input round key NK of round R R Perform 32 5-input XOR operations, and then perform 2-choose-1 operations on the results of the 32 5-input XOR operations according to the control signal F2 of the state machine to obtain 16 5-input XOR results b j , where j is an integer from 0 to 15; the round key NK R It can be divided into 16 bytes from high to low, respectively. The subscript j is an integer from 0 to 15, and the superscript R is an integer from 1 to 10; the output of the 5-input XOR network is 16 8-bit data b j , that is, R1; The 2-to-1 selector outputs the value of R2 selecting R1 for output in the 2nd to 11th cycles; After the shared round function module runs for 10 cycles, the result R1 obtained in the 10th round is output in the 12th cycle.
2. The efficient and secure cryptographic hardware according to claim 1, characterized in that: The fusion T table is Among them, f is 1 bit, a is 8-bit data, and a is the 8-bit data intercepted from R2 from high to low; when encrypting, f is 1, and the result of the MT table is the result of the T table substitution, which are 1 times the S box output, 3 times the S box output, 1 times the S box output, and 2 times the S box output; when decrypting, f is 0, and the result of the MT table is the inverse of the T table substitution, which are 9 times the S box output. -1 Box, 11 times S -1 Box, 13 times S -1 Box and 15 times S -1 Box; S box is the byte replacement in the AES algorithm, S -1 The box is the inverse of the byte substitution in the AES algorithm.
3. The efficient and secure cryptographic hardware according to claim 2, characterized in that: The 32-bit output data of the MT table is split into four 8-bit outputs, and the subscripts t1 to t4 are used to represent the four bytes from the highest to the lowest bit, specifically: MT[f,a]={MT[f,a] t1 ,MT[f,a] t2 ,MT[f,a] t3 ,MT[f,a] t4 }。 4. The efficient and secure cryptographic hardware according to claim 2 or 3, characterized in that: The input R2 of the memory module is 128 bits of data. R2 is divided into 16 8-bit bits from high to low, called a0, a1, ..., a j , …, a 15 The memory module includes 16 block memories, and the input of the jth block memory includes f and a j The output of the jth block memory is based on the input f and a j Query the fusion T table to obtain the result.
5. The efficient and secure cryptographic hardware according to claim 4, characterized in that: The outputs of the 16 block memories are 16 32-bit data, which are MT[f,a 0+4i ]、MT[f,a 13-8f+4i ]、MT[f,a 10+4i )]、MT[f,a 7+8f+4i ], where i is 0, 1, 2, and 3 respectively, and the subscript of a needs to be modulo 16.
6. The efficient and secure cryptographic hardware according to claim 5, characterized in that: The 5-input XOR network includes four XOR sub-networks; each XOR sub-network includes 8 5-input XOR gates and 1 8-input 2-to-1 selector; the input of the 5-input XOR sub-network is MT[f,a 0+4i ]、MT[f,a 13-8f+4i ]、MT[f,a 10+4i )]、MT[f,a 7+8f+4i ], the output is 4 8-bit data b 0+4i , b 1+4i , b 2+4i , b 3+4i , as the output of the 5-input XOR subnetwork; when i is 0, 1, 2, and 3 respectively, we get b0~b 15 A total of 128 bits of data are the output of the 5-input XOR network, denoted as R1; among them, in the 5-input XOR sub-network, the state F2 of the 2-to-1 selector is determined by the number of encryption rounds. When the 10th round of encryption and decryption is executed, F2 is 1; when the initial round of encryption and decryption and rounds 1-9 are executed, F2 is 0.
7. The efficient and secure cryptographic hardware according to claim 6, characterized in that: The XOR sub-network is expressed as: in, The round key NK is R 1+4i bytes; MT[f,a 0+4i ] tk It is the kth byte from high to low in the output value of the fused T table, and k is an integer from 1 to 4.
