CN103138917B - The Hamming distance model being input as basis with S box carries out SM4 cryptographic algorithm side channel energy analytical method - Google Patents
The Hamming distance model being input as basis with S box carries out SM4 cryptographic algorithm side channel energy analytical method Download PDFInfo
- Publication number
- CN103138917B CN103138917B CN201310027794.6A CN201310027794A CN103138917B CN 103138917 B CN103138917 B CN 103138917B CN 201310027794 A CN201310027794 A CN 201310027794A CN 103138917 B CN103138917 B CN 103138917B
- Authority
- CN
- China
- Prior art keywords
- circleplus
- round
- key
- energy consumption
- hamming distance
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000004422 calculation algorithm Methods 0.000 title claims abstract description 104
- 238000004458 analytical method Methods 0.000 title claims abstract description 97
- 238000000034 method Methods 0.000 claims abstract description 39
- 230000008569 process Effects 0.000 claims abstract description 6
- 238000005265 energy consumption Methods 0.000 claims description 116
- 239000011159 matrix material Substances 0.000 claims description 58
- 238000005070 sampling Methods 0.000 claims description 27
- 238000004088 simulation Methods 0.000 claims description 25
- 238000005259 measurement Methods 0.000 claims description 7
- 238000004364 calculation method Methods 0.000 claims description 6
- 238000013507 mapping Methods 0.000 claims description 6
- 239000013598 vector Substances 0.000 claims description 2
- 230000000875 corresponding effect Effects 0.000 description 56
- 230000009466 transformation Effects 0.000 description 7
- 238000013459 approach Methods 0.000 description 3
- 238000006243 chemical reaction Methods 0.000 description 3
- 230000002441 reversible effect Effects 0.000 description 3
- 238000001514 detection method Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000007704 transition Effects 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 230000002596 correlated effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 239000004576 sand Substances 0.000 description 1
- 238000007619 statistical method Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Landscapes
- Complex Calculations (AREA)
Abstract
The invention discloses and be input as with S box the method that basic Hamming distance model carries out the channel energy analysis of SM4 cryptographic algorithm side, its core is to carry out in the channel energy analytic process of SM4 cryptographic algorithm side, round function is selected to set up Hamming distance model as the point of attack, using the input of S box as the front and continued state v of Hamming distance model
1, Hamming distance (HD (v
1, v
2)) the successor states v of model
2it is round function input/output.The method can be applicable to the CPA/DPA side channel energy analysis of SM4 cryptographic algorithm.Utilize method of the present invention to improve the correct correlation guessed between key and energy information, enhance and analyze validity and success rate.
Description
Technical Field
The invention belongs to the technical field of cryptographic algorithm analysis and detection, and particularly relates to an energy analysis method for performing side channel energy analysis on a cryptographic module for realizing an SM4 cryptographic algorithm and acquiring protected key information in the processes of cryptographic algorithm realization, side channel energy analysis and cryptographic module detection, namely, a hamming distance model based on S-box input is used for performing SM4 cryptographic algorithm side channel energy analysis.
Background
With the development of information technology, various cryptographic algorithms are being widely applied to important departments such as economy, military, and administration to protect the security of information. In view of the importance of the cryptographic algorithm, the analysis and research of the implementation of the cryptographic algorithm software and hardware (cryptographic module) have important significance for protecting the information security. In recent years, a variety of attacks on cryptographic modules have been widely known, all for the purpose of obtaining a key in a cryptographic module. Common attack modalities can be divided into invasive, semi-invasive and non-invasive attacks. In recent years, side channel analysis in non-invasive attacks has been widely used due to its ease of implementation and relative low cost. Side channel analysis can be subdivided into timing analysis, energy analysis, and electromagnetic analysis. The side channel energy analysis is one of the most common methods in a plurality of analysis means, breaks through the analysis mode of the traditional cryptographic algorithm, and has strong capability and relatively easy implementation. The side channel energy analysis utilizes the correlation between the energy consumption of the cryptographic module and the data operation and execution, establishes an energy model based on an energy leakage function realized by the cryptographic algorithm, and guesses and verifies a protected key used by the cryptographic module by using a statistical method. Side-channel energy analysis methods generally include simple energy analysis (SPA), differential energy analysis (DPA), correlated energy analysis (CPA), and higher order differential energy analysis (HODPA).
Wherein, the DPA principle is as follows: acquiring N energy traces for encryption/decryption operation of N groups of plaintext/ciphertext data, wherein the energy traces refer to energy consumption measurement vectors acquired in the process of one-time password operation; generating a corresponding intermediate value (attack object) for each guessing key K, and determining a selection function according to the intermediate value; dividing the energy trace set into two subsets by a selection function; and respectively averaging the energy consumption corresponding to the two subsets, and calculating the difference of the two average energy consumption values, wherein the average value difference is the influence effect of the intermediate value corresponding to the selection function on the energy trace. According to the statistical theory, if K guesses incorrectly, when the number N of the energy traces approaches infinity, the mean difference of the two subsets approaches zero; if K guesses correctly, at some sample point in the energy trace, a maximum peak (absolute maximum) of the mean difference will occur, from which the correct key can be determined.
The CPA principle is as follows: acquiring N energy traces for encryption/decryption operation of N groups of plaintext/ciphertext data; for each guess key K, generating a corresponding intermediate value (attack object); establishing an energy model according to the intermediate value; mapping the intermediate value into simulation energy consumption through an energy model; calculating a linear correlation coefficient between the simulation energy consumption and the energy trace, wherein the range is between [ -1,1 ]; the maximum value of the absolute value in the correlation coefficient is selected to be 1 theoretically, but noise interference is inevitable in the process of acquiring the energy trace, the maximum value is smaller than 1, and the guessed key corresponding to the maximum value of the correlation coefficient is the correct key.
The SM4 cryptographic algorithm is the first commercial cryptographic grouping algorithm published in China, the data grouping and key length of the SM4 cryptographic algorithm are both 128 bits, and the encryption algorithm and the key expansion algorithm of the SM4 cryptographic algorithm both adopt 32-round nonlinear iteration structures.
The structure of the SM4 cryptographic algorithm is as follows:
is provided with In order to encrypt the plaintext, is the input of the algorithm of the ith round,for the round key of the ith round, the round function F is:
F(Xi,Xi+1,Xi+2,Xi+3,rki)=Xi⊕T(Xi+1⊕Xi+2⊕Xi+3⊕rki)(1)
wherein,the method is a reversible transformation and is compounded by a nonlinear transformation tau and a linear transformation L, namely T () -, L (. tau ()).
τ is made up of 4 parallel S-boxes, as shown in FIG. 2, with the input set toOutput is as Then:
(b0,b1,b2,b3)=τ(A)=(Sbox(a0),Sbox(a1),Sbox(a2),Sbox(a3))(2)
the output of the non-linear transformation τ is the input of the linear transformation L. Let the input beOutput is as Then:
C=L(B)=B⊕(B<<<2)⊕(B<<<10)⊕(B<<<18)⊕(B<<<24)(3)
suppose AiFor the i-th round S-box input, BiFor the output of the ith round S box, input of L shift, CiIs the output of the i-th wheel L shift. According to the algorithm, the following is satisfied:
Ai=(Xi+1⊕Xi+2⊕Xi+3⊕rki)(4)
Bi=τ(Ai)(5)
Ci=L(Bi)(6)
Xi+4=Xi⊕Ci(7)
according to the above formulas (4), (5), (6) and (7), the wheel input (X) of the (i + 1) th wheel can be obtainedi+1,Xi+2,Xi+3,Xi+4) Sequentially operating 32 rounds to obtain output cipher text The encryption structure flow of the SM4 cryptographic algorithm is shown in fig. 1.
The key expansion algorithm of the SM4 cryptographic algorithm is similar in structure to the encryption algorithm, as in fig. 2, only the linear transformation L shift function is inconsistent. Let the initial encryption key be (MK)0,MK1,MK2,MK3)。
(K0,K1,K2,K3)=(MK0⊕FK0,MK1⊕FK1,MK2⊕FK2,MK3⊕FK3)(8)
Wherein (FK)0,FK1,FK2,FK3) Are known constants.
rki=Ki+4=Ki⊕T′(Ki+1⊕Ki+2⊕Ki+3⊕CKi)=Ki⊕L'(τ(Ki+1⊕Ki+2⊕Ki+3⊕CKi))(9)
Wherein, the tau function is consistent with the tau function in the SM4 cryptographic algorithm encryption structure, and rkiIs the encryption key of the ith round, i is 0,1, …,31, CKiAre known constants.
The linear transformation L' is:
L'(x)=x⊕(x<<<13)⊕(x<<<23)(10)
according to equation (9), 32 round keys (rk) can be obtained respectively0,rk1,…,rk31) And the length is 32 bits.
The algorithm structure of data decryption and data encryption is the same, but the use sequence of round keys is opposite, and the decryption round keys are the reverse sequence of encryption round keys. For decryption, round key sequence (rk) is used31,rk30,…,rk0)。
The energy analysis method for the SM4 cryptographic algorithm generally selects the output of an S box and the output of L shift as attack objects, and uses a Hamming weight and a single-bit model to analyze by using a DPA method and a CPA method. These methods only utilize typical analysis points and cannot fully and effectively perform analysis on the SM4 cryptographic algorithm. Furthermore, when the available energy leakage information at the analysis point is small, the success rate of the SM4 cryptographic algorithm analysis will be affected. Therefore, there is a need to propose a more efficient side channel energy analysis method.
Disclosure of Invention
In the SM4 cryptographic algorithm analysis, whether a side channel energy analysis method is effective or not is characterized in that attack object selection and corresponding energy model selection in the cryptographic algorithm are critical, and the selection of a proper attack object can improve the signal-to-noise ratio of sampled energy information and the success rate of analysis.
The invention aims to systematically analyze the implementation characteristics of an SM4 cryptographic algorithm, creatively and respectively select S box output and round function (subsequent state) of the SM4 cryptographic algorithm as attack points, innovatively provides a Hamming distance model taking S box input as a Hamming distance reference state (previous state), and improves the correlation between a correct guessed key and energy information and the effectiveness and success rate of analysis for different energy leakage information during the operation of the SM4 cryptographic algorithm.
The invention for achieving the above objectThe technical scheme includes that a Hamming distance model based on S-box input is used for carrying out SM4 cryptographic algorithm side channel energy analysis method, in the process of carrying out SM4 cryptographic algorithm side channel energy analysis, an S-box or round function is selected as an attack point to establish a Hamming distance model, and the input of the S-box is used as a previous state v of the Hamming distance model1。
Hamming distance (HD (v) when attacking S-box1,v2) V) successor states of the model2Is the S box output; hamming distance (HD (v) when attacking round function1,v2) V) successor states of the model2Is the round function output/input. Hamming distance (HD (v) used for the attack on the last 4 rounds of S-box output as described above1,v2) The model is equivalent to an attack of a Hamming Weight (HW) model with S-box input and output exclusive or values as attack points; hamming distance (HD (v) used for attacking 4 rounds of front/end of round function1,v2) Model is equivalent to an attack of a Hamming Weight (HW) model with the xor value of the S-box input and the round function output/input as the attack point.
The hamming distance model based on S-box input described above is used for CPA/DPA side channel energy analysis for SM4 cryptographic algorithms.
When the hamming distance model based on the S-box input is applied to the CPA side channel energy analysis of the SM4 cryptographic algorithm, the steps are as follows:
(1) acquiring energy traces, specifically performing encryption/decryption operation on each group of plaintext/ciphertext, acquiring energy consumption information corresponding to a measurement time point, namely acquiring the energy traces, and establishing a sampling energy consumption matrix; (2) selecting an attack object as an S box or a round function, and determining a Hamming distance algorithm attack model; (3) after an attack object and a model are determined, guessing a round key, and calculating a middle value of round operation to determine a middle value matrix; (4) mapping the intermediate value and the intermediate value matrix into a simulation energy consumption value and a simulation energy consumption matrix; (5) and calculating the linear correlation coefficient of the simulation energy consumption matrix and the sampling energy consumption matrix to obtain a correct guess key.
The specific method for performing the above step (3) by using CPA is to know the k (k ∈ { 0.,. N-1} th) group of plaintext/ciphertext inputs Or ciphertext/plaintext output Guessing the key of the ith roundByte of (1)rki,jGuessed values of are rk respectivelyi,j,sS, S ∈ { 0.., 255}, a round key byte rk is guessed when 4 rounds of S-box outputs are selected for an attack before/after the S-box outputi,j,sThe corresponding intermediate value is that of the intermediate value, wherein,for the ith round of encryption/decryption operation of the kth group of plaintext/ciphertext, the corresponding intermediate value of the jth key byte is guessed as s,respectively Xi+1,j、Xi+2,j、Xi+3,jAre all intermediate calculation valuesThe jth byte of (1); when the attack of the first 4 rounds and the last 4 rounds of the round function output is selected, the round key byte rk is guessedi,j,sCorresponding intermediate values are respectively And wherein L is-1(x)jIs composed ofCarry out L-1The shifted j-th byte is then used, when N groups of plain/cipher texts are encrypted/decrypted, 256 guess round key bytes rk are calculated in sequencei,j,sDetermining a matrix of intermediate values for corresponding intermediate values The specific method for performing the step (4) by using the CPA comprises the following steps: (3) the simulated energy consumption of the step-middle value mapping is as follows:that is, the simulation energy consumption corresponding to the s guess key byte of the ith byte of the kth group of plaintext and the jth byte of the ith round, HW (x) is the number of bit values of 1 in x, the encryption/decryption operation is carried out on N groups of plaintext/ciphertext, and the round key byte rk is determinedi,j,sThe corresponding simulated energy consumption matrix is:
the specific method for performing the step (5) by using the CPA is to sample the energy consumption matrix of the step (1) And (4) respectively calculating correlation coefficients rho of the s-th column and the t-th column of the simulation energy consumption matrix Hs,t: Wherein,expressed as sample energy consumption value corresponding to kth plaintext/ciphertext and tth time point, T is the number of time points in the energy trace,is the average value of the s-th column of the matrix H,is the average value, p, of the t-th column of the matrix Ws,tRepresenting an emulation corresponding to the s-th guess keyLinear correlation coefficient between true energy consumption and t-th time-point sampling energy consumption, rs,tCalculating the correlation coefficient between all the columns for the approximate calculation value of the correlation coefficient to obtain a correlation coefficient matrix of simulation energy consumption and sampling energy consumption Selecting the maximum value R in Rm,n=max(rs,t),rm,nCorresponding guess key rki,j,mGuessing the byte of the round key correctly to obtain the j byte rk of the correct ith round keyi,j(ii) a Repeating the steps (1) to (5) to respectively obtain other 3 key bytes of the round key so as to obtain the correct round key rk of the ith roundiFor the first 4 rounds, the round key rk is usediCarrying out the cryptographic operation of the ith round to obtain N groups of round outputs of the ith round, namely the round inputs of the (i + 1) th roundSequentially obtaining encryption round keys (rk) of the first 4 rounds0,rk1,rk2,rk3)=(K4,K5,K6,K7) Or decryption round keys (rk)0,rk1,rk2,rk3)=(K35,K34,K33,K32) (ii) a For the rear 4 rounds, the round key rk is usediCarrying out the ith round of cryptographic operation to obtain the (i-1) th round of outputSequentially obtaining the encryption round keys (rk) of the last 4 rounds31,rk30,rk29,rk28)=(K35,K34,K33,K32) Or decryption round keys (rk)31,rk30,rk29,rk28)=(K4,K5,K6,K7) (ii) a And obtaining the encryption/decryption key according to the inverse operation of the key expansion algorithm.
The DPA side channel energy analysis step of the SM4 cryptographic algorithm by the Hamming distance model based on S-box input is as follows:
(a) collecting energy traces, specifically carrying out encryption/decryption operation on each group of plaintext/ciphertext, collecting energy consumption information corresponding to a measurement time point, namely the energy traces, establishing a sampling energy consumption matrix, (b) selecting an attack object as an S box or a round function, determining a DPA selection function, and knowing j (j ∈ {0,1,2,3}) bytes rk of an ith round keyi,jCorresponding attack objectGuessing the key byte rk with plaintext/ciphertexti,jAs a parameter, and expect a valueThe selection function defined herein is (c) Guessing a round key, and dividing the average energy consumption into two average energy consumption subset matrixes; (d) and (c) determining a correct guess key according to the difference of the two average energy consumption subsets obtained in the step (c).
The specific method of using DPA to perform step (c) is that the kth set of plaintext/ciphertext inputs is known Or ciphertext/plaintext output Then guess the i-th round key rkiByte rk in (1)i,j,rki,jGuessed values of are rk respectivelyi,j,sS, s ∈ { 0.., 255}, guessing the round key byte rki,j,sCorresponding selection function D (X)k,j,rki,j,s) When 1, the total number isrki,j,sCorresponding selection function D (X)k,j,rki,j,s) When the number is 0, the total number isFor a time point t in the energy trace, the mean of the total energy consumption of the two points is obtained: and wherein,for using guess round key byte rki,j,sWhen N groups of encryption/decryption operations are carried out, N of time point t corresponding to the function equal to 0 is selected0Group energy consumption averages;for selecting n for a time t corresponding to a function equal to 11Average of group energy consumption, n0+n1Calculating the average value of energy consumption at all time points by the formula to obtain two energy consumption matrixes D0(256 × T) and D1(256 × T), respectively: and the specific method for performing step (d) using DPA is: calculating the average energy consumption matrix D obtained in the step (c)0(256 × T) and D1(256 × T) difference matrix △ D ═ D1-D0Selecting the maximum energy consumption mean value differenceThenCorresponding guess round key byte rki,j,mThe correct key byte is obtained, namely the jth byte of the correct round key of the ith round is obtained, the steps (a) to (d) are repeated, and other 3 key bytes of the round key can be respectively obtained, so that the correct round key rk of the ith round is obtainediFor the first 4 rounds, the round key rk is usediCarrying out the cryptographic operation of the ith round to obtain N groups of round outputs of the ith round, namely the round inputs of the (i + 1) th roundSequentially obtaining encryption round keys (rk) of the first 4 rounds0,rk1,rk2,rk3)=(K4,K5,K6,K7) Or decryption round keys (rk)0,rk1,rk2,rk3)=(K35,K34,K33,K32) (ii) a For the rear 4 rounds, the round key rk is usediCarrying out the ith round of cryptographic operation to obtain the (i-1) th round of outputSequentially obtaining the encryption round keys (rk) of the last 4 rounds31,rk30,rk29,rk28)=(K35,K34,K33,K32) Or decryption round keys (rk)31,rk30,rk29,rk28)=(K4,K5,K6,K7) (ii) a And obtaining the encryption/decryption key according to the inverse operation of the key expansion algorithm.
When selecting the attack object, selecting the Hamming distance (HD (v) used for attack 4 rounds before/after the output of S box1,v2) Previous state v of the model1Is S Box input, successor state v2Is an S-box output, which is equivalent to an attack of a Hamming Weight (HW) model with the XOR value of the S-box input and the S-box output as the attack object, i.e. Hamming distance (HD (v) used when selecting 4 rounds of attack before/after round function1,v2) Previous state v of the model1Is S Box input, successor state v2Is a round function input/output equivalent to an attack using a Hamming Weight (HW) model with the exclusive or value of the S-box input and the round output/input as the attack object, i.e., an attack Or Herein, theIs the wheel input for the ith wheel,is the wheel output of the ith wheel, i is in turn 0,1,2,3 or 31,30,29, 28.
The technical scheme of the invention has the following advantages that (1) the existing SM4 cryptographic algorithm has single energy leakage analysis point and cannot be well adapted to the realization of various SM4 cryptographic algorithms. Aiming at the specific implementation of the SM4 cryptographic algorithm, the invention innovatively provides two novel Hamming distance models, and the novel method provided by the invention can be used for more effectively and comprehensively carrying out side channel energy analysis on the SM4 cryptographic algorithm; (2) the energy consumption mainly comprises dynamic energy consumption of the previous and the next two state bit 0 → 1,1 → 0 conversion, and the HD model assumes that the energy consumption values of the two conversions are equal, so as to establish a direct proportion relation between the conversion quantity and the energy consumption. The HW model is a special case of the HD model, and it assumes that all bits of the previous output state are 0, and the energy consumption is only related to the value of the subsequent state, which is simpler than the HD model, so the accuracy of the simulation energy consumption described by the HD model is much higher than that of the HW model. For a hardware implementation of the SM4 cryptographic algorithm, the registers are triggered by a clock signal, so that in each clock cycle the registers previously only transition once with the current state, and the effectiveness of the cryptographic module implemented by the hardware can be enhanced by analyzing the side channel energy by using the hamming distance of the values stored by the registers in successive clock cycles for the analysis. The invention can effectively analyze the SM4 cryptographic algorithm, obtain the key information and expand the side channel energy analysis method for the SM4 cryptographic algorithm.
Drawings
Fig. 1 is a flow chart of the encryption structure of the SM4 cryptographic algorithm;
FIG. 2 is a key expansion algorithm flow diagram of the SM4 cryptographic algorithm;
FIG. 3 is an HD model attack object of S-box output;
FIG. 4 is an HD model first 4 rounds of attack objects output by round functions;
FIG. 5 is the HD model's last 4 rounds of attack objects output by the round function;
figure 6 is a CPA analysis flow chart;
FIG. 7 is a flow chart of DPA analysis;
FIG. 8 is a sample waveform for 1000 sets of encryption operations;
FIG. 9 is a graph showing the HD model analysis output for the 1 st round of S boxes, and the correlation coefficient waveforms corresponding to the correct round of keys correspond to 4S boxes respectively;
fig. 10 shows the correlation coefficient waveforms corresponding to the correct round keys for the 1 st round S-box output HW model analysis, which correspond to 4S-boxes respectively;
fig. 11 is a sampling waveform of 1000 sets of encryption operations in the second embodiment;
fig. 12 is a diagram of the second embodiment, which shows the HD model analysis output from the S-box of round 1, and the correlation coefficient waveforms corresponding to the keys of the correct round correspond to 4S-boxes respectively;
FIG. 13 is a graph showing the correlation coefficient waveforms corresponding to the correct round keys for the second embodiment of HW model analysis of the output of the 1 st round S boxes corresponding to 4S boxes
Detailed Description
The following describes the technical solution of the present invention in detail, and first takes the round function of the SM4 cryptographic algorithm as an example to perform CPA analysis, which explains the technical solution of the present invention. Figure 6 is a CPA analysis flow chart. For the encryption operation of the SM4 cipher algorithm, the first 4 rounds of the cipher algorithm are analyzed if the encrypted plaintext is known. Assuming that N sets of plaintext encryption operations are performed, let the k-th set of plaintext input ask ∈ { 0.., N-1}, the wheel input of the ith wheel beingi is 0,1,2 and 3 in sequence, and the steps are as follows: (1) collecting energy traces, carrying out encryption operation on each group of plaintext, and collecting energy consumption information corresponding to a measurement time point, namely the energy trace is collectedTrace, establish a sampled energy consumption matrix W (N × T):
wherein,expressing the sampling energy consumption value corresponding to the kth plaintext and the tth time point, wherein T is the number of time points in the energy trace;
(2) selecting an attack object and determining an algorithm attack model; with the input of the S-box as the preceding state v of the Hamming distance1Respectively selecting the outputs of the two attack points S box and the output of the round function as a subsequent state v2Two Hamming Distance (HD) models were established. HD (v)1,v2) Is v is1And v2The hamming distance of (a), i.e., the number of bits 0 → 1,1 → 0 changes in the two states, hw (v) is the number of bits 1 in v, then: HD (v)1,v2)=HW(v1⊕v2) I.e. the preceding state v1And subsequent state v2Hamming distance HD (v)1,v2) Equivalent to Hamming weight HW (v) after XOR of two1⊕v2) Therefore, the HD model is actually a Hamming Weight (HW) model with the data of the preceding state xored with the following state as the attack point. Therefore, the HD model with S-box input as the previous state and S-box output as the subsequent state is actually the HW model with S-box input and output xor values as the attack points; the HD model with S-box input as the previous state and round function output as the subsequent state is actually the HW model with the xor value of the S-box input and the round function output as the attack point.
The HD model for the S-box output is based on the assumption: suppose that the S-box input value v of the SM4 cryptographic module is collected1And S-box output value v2The energy leakage point is in two states v1、v2Bit flipping. According to the encryption structure of the SM4 cryptographic algorithm, 4S boxes are independent of each other andif the L shift operation is reversible, the round operations for 4 bytes of the round key are also independent, and therefore, the attack targets corresponding to the key bytes of the round key can be selected separately. Converting the HD model into an HW model, and then, generating an ith round key rkiByte rk of (2)i,jThe corresponding attack objects are: as shown in fig. 3.
The HD model output to the round function is based on the assumption: suppose S-box input value v1And the round function output value v2Stored in the same register with two states v as energy leakage points1、v2The same register can be used for outputting the HD model with inverted state. After the Hamming distance model is converted into a Hamming weight model, the key rk of the ith roundiByte rk of (2)i,jThe corresponding attack objects are: the specific attack object is shown in fig. 4.
(3) Guessing the round key and calculating the intermediate value of the round operation. After an attack object and a model are determined, an ith round key rk is guessediThe j (j ∈ {0,1,2,3}) th byte rki,jJ is 0,1,2,3 in this order. rki,jGuessed values of are rk respectivelyi,j,s=s,s∈{0,...,255}。
For 256 guess key bytes rki,j,sAnd respectively carrying out encryption round operation of the ith round.
Guessing round key byte rk for HD model of S box outputi,j,sThe corresponding median values are:
guessing the round key byte rk for the HD model output by the round functioni,j,sCorresponding to an intermediate value of
According to the intermediate value of the formula, when encrypting N groups of plaintext, 256 guess round key bytes rk are calculated in sequencei,j,sCorresponding intermediate values, respectively resulting in an intermediate value matrix V (N × 256):
(4) the intermediate values are mapped to a simulated energy consumption matrix. According to the energy model determined in step (3), the simulated energy consumption of the intermediate value mapping is Is composed ofIn order to perform the ith round of encryption operation on the kth group of plaintext, the corresponding simulation energy consumption is guessed when the jth key byte is s. Encrypting N groups of plain texts by 256 guess round key bytes rki,j,sThe corresponding simulated energy consumption matrix is:
(5) and calculating the linear correlation coefficient of the simulation energy consumption and the energy trace to obtain a correct guessed key byte.
For the sampling energy consumption matrix W and the simulation energy consumption matrix H, respectively calculating the correlation coefficients of the s-th column and the t-th column of the sampling energy consumption matrix W and the simulation energy consumption matrix H Wherein,is the average value of the s-th column of the matrix H,is the average value of the t column of the matrix W. Rhos,tRepresents the linear correlation coefficient between the simulated energy consumption corresponding to the s-th guess key and the t-th sampling energy consumption at the time point, rs,tAn approximate calculation of the correlation coefficient is made. Calculating correlation coefficients among all the columns to obtain a correlation coefficient matrix of simulation energy consumption and sampling energy consumption as follows: rs,tthe larger the matching degree of the column s and the column t is, the larger the guess key rk isi,j,sThe stronger the correlation with the sampled energy information. Selecting the maximum value R in Rm,n=max(rs,t),rm,nCorresponding guess key rki,j,mThe correct guess round key byte is the jth byte of the ith round key. Similarly, according to the steps (1) to (5), the other 3 key bytes of the round key are respectively obtained, so as to obtain the correct round key rk of the ith roundi。
After CPA analysis is finished on the ith round of cryptographic operation, a correct round key rk is obtainediUsing round keys rkiPerforming encryption operation of the ith round to obtain N groups of round outputs of the ith round, namely the round inputs of the (i + 1) th roundk ∈ {0,1, …, N-1 }. according to the analysis method of steps (1) - (5) above, the wheel keys of the first four wheels are obtained in turn (rk)0,rk1,rk2,rk3)=(K4,K5,K6,K7)。
Key expansion algorithm inverse operation according to SM4 cryptographic algorithm, Ki=L'(τ(Ki+1⊕Ki+2⊕Ki+3⊕CKi))⊕Ki+4,(MK0,MK1,MK2,MK3)=(K0⊕FK0,K1⊕FK1,K2⊕FK2,K3⊕FK3) Determining the cryptographic key (MK) of the cryptographic operation of the SM4 cryptographic algorithm0,MK1,MK2,MK3)。
If the encrypted ciphertext is known, the last 4 rounds of encryption operations are analyzed, the analysis method is substantially the same as that of the first 4 rounds, and only a little different is made in selecting the attack object.
Assuming that N sets of encryption operations are performed, the ciphertext of the kth set is output asOrder toThe round output of the SM4 cipher algorithm for the ith round, i is 31,30,29,28 in order. The analysis method for the two Hamming distance models comprises the following steps: the analysis method of the final 4 rounds of the HD model output by the S box is completely the same as that of the first 4 rounds. After the HD model is converted into the HW model, the attack object is the input-output exclusive or value of the S-box of the round, as shown in fig. 3. Guess round key byte rki,j,sThe corresponding attack median is identical to the first 4 rounds. Sequentially obtain the correct round keys (rk) of the last 4 rounds31,rk30,rk29,rk28)=(K35,K34,K33,K32) And successfully analyzing and obtaining the key of the encryption operation of the SM4 cryptographic algorithm through the inverse operation of the key expansion algorithm.
The analysis method of the HD model of the round function input is the same as that of the first 4 rounds, and only the selection of the attack object is slightly different. After the HD model is converted to the HW model, the last 4 rounds of attack are shown in fig. 5. Guess round key byte rki,j,sThe corresponding attack median is:
according to the steps (1) to (5), the correct round keys (rk) of the last 4 rounds are obtained in sequence31,rk30,rk29,rk28)=(K35,K34,K33,K32) And successfully analyzing and obtaining the key of the SM4 cryptographic algorithm encryption operation according to the inverse operation of the key expansion algorithm.
For the decryption operation of the SM4 cryptographic algorithm, the decryption key can be obtained by using the above CPA analysis method. If the ciphertext is known, the first 4 rounds of SM4 cryptographic algorithm decryption operation are analyzed, the analysis method is the same as that of the first 4 rounds of SM4 cryptographic algorithm encryption operation, and round keys (rk) are sequentially obtained31,rk30,rk29,rk28) Obtaining a decryption key according to the inverse operation of the key expansion algorithm; if the plaintext is known, the last 4 rounds of decryption operation of the SM4 cryptographic algorithm are analyzed, the attack method is the same as that of the last 4 rounds of encryption operation of the SM4 cryptographic algorithm, and round keys (rk) are obtained in sequence0,rk1,rk2,rk3) And obtaining a decryption key according to the inverse operation of the key expansion algorithm.
According to the CPA analysis method, the 1 st round of encryption calculation is analyzed using the HW model (i.e., the HD model of the S-box) whose attack target is the S-box input/output exclusive or value and the HW model whose attack target is the S-box output, and the round key is known to be 0x85235CE 2.
Collecting 1000 sets of waveform, i.e. energy trace, of plaintext encryption operation, as shown in fig. 8, for 5000 time points, wherein the sampling energy consumption related to the SM4 encryption operation is between 43 μ s and 50 μ s, and the time points corresponding to the cryptographic operation are 408 time points, then sampling energy consumption matrixW (1000 × 408), selecting the exclusive OR value of the input and output of the 1 st round S box as an attack object, establishing a HW model, guessing the 1 st byte of the round key to obtain a simulation energy consumption matrix H (1000 × 256), calculating the correlation coefficient of the simulation energy consumption matrix H and the sampling energy consumption matrix W to obtain a correlation coefficient matrix R, selecting the guessed key byte corresponding to the maximum value in the R as the 1 st byte of the round key, and analyzing the other 3 bytes of the round key in sequence to obtain the 1 st round key rk1。
The analysis results are shown in table 1, which lists the top 10 largest correlation coefficients and their corresponding guessed key bytes when guessing 4 key bytes in round. For round 1, the correlation coefficient for the correct guessed key byte is much larger than the correlation coefficient for the other 9 wrong guessed key bytes.
Table 1: CPA analysis result of S-box output HD model of the 1 st round of encryption operation
Similarly, for the energy trace of fig. 8, the output of the S-box is selected as the attack object, the HW model is built, and the 1 st round key 0x85235CE2 is analyzed according to the above steps, and the analysis results are shown in table 2. As can be seen from table 2, the first 10 largest correlation coefficient values have slight differences, and the adjacent two are both smaller than 0.02, so that the correct round key cannot be determined, and the wrong round key 0x830a5082 is obtained through analysis; the correlation coefficient corresponding to the correct key in table 1 is at least 0.45 greater than the maximum correlation coefficient corresponding to other guessed keys, so that the correct round key can be easily distinguished.
Table 2: CPA analysis result of S box output HW model of 1 st round of encryption operation
Fig. 9 and 10 are graphs of correlation coefficients of correct round key bytes corresponding to all time points when two kinds of attack objects are selected for analysis, respectively. As can be seen from fig. 9, the correlation coefficient corresponding to the sampling point has a sharp peak, which indicates that: when the round key guesses correctly, the correlation with the sampling energy consumption leakage point is far larger than other time points; while fig. 10 has no obvious peak, when the round key guess is correct, the real energy consumption leakage point cannot be distinguished, and the correlation coefficient corresponding to all the time points is far smaller than the peak value of fig. 9. Therefore, when the energy consumption leakage point calculated by the SM4 cryptographic algorithm is the switching between the input and output states of the S-box, the side channel energy analysis method of the HD model using the S-box is better than the side channel energy analysis method of the HW model using the S-box.
According to the CPA analysis method, the 1 st round of encryption calculation is analyzed by using the HW model (i.e., the HD model of the round function) in which the xor value of the S-box input and the round function output is the target of attack and the HW model in which the round function output is the target of attack.
a) Collecting 1000 groups of waveforms of plaintext encryption operation, as shown in fig. 11, sampling energy consumption related to SM4 encryption operation is between 7 mus and 11.7 mus, and selecting a time point of the part corresponding to the cryptographic operation to obtain a sampling energy consumption matrix W; selecting an exclusive OR value of the input of the 1 st round S box and the output of the round function as an attack object, and establishing a HW model; guessing the 1 st byte of the round key to obtain a simulation energy consumption matrix H; calculating the correlation coefficient of the simulated energy consumption matrix H and the sampled energy consumption matrix W to obtain a correlation coefficient matrix R, and selecting a guessed key byte corresponding to the maximum value in the matrix R as a 1 st byte of the round key; analyzing other 3 bytes of the round key in sequence to obtain a 1 st round key rk1. The analysis results are shown in Table 3, which lists the scoresThe first 10 largest correlation coefficients and their corresponding guessed key bytes are analyzed for each round of key bytes. For round key guess 1, the correlation coefficient corresponding to the correct guessed key byte is much larger than the correlation coefficient corresponding to the other 9 wrong guessed key bytes.
Table 3: CPA analysis result of round function output HD model of round 1 of encryption operation
Similarly, for the energy trace of fig. 11, the output of the round function is selected as the attack object, the HW model is built, the 1 st round key 0x85235CE2 is analyzed according to the above steps, and the analysis result is shown in table 4. As can be seen from table 4, the difference between the first 10 maximum correlation coefficient values is very small, and the difference between the two adjacent correlation coefficient values is less than 0.015, so that the correct round key cannot be determined, and the wrong round key 0xCBAC3855 is obtained through analysis; the correlation coefficient corresponding to the correct key in table 3 is at least 0.4 greater than the maximum correlation coefficient corresponding to other guessed keys, so that the correct round key can be easily distinguished.
Table 4: CPA analysis result of round function output HW model of 1 st round of encryption operation
Fig. 12 and 13 are graphs of correlation coefficients of correct round key bytes corresponding to all time points when two kinds of attack objects are selected for analysis, respectively. As can be seen from fig. 12, the sampling point has a sharp peak corresponding to the correlation coefficient, which indicates that: when the round key guesses correctly, the correlation with the sampling energy consumption leakage point is far larger than other time points; while fig. 13 has no sharp peak, when the round key guess is correct, the real energy consumption leakage point cannot be distinguished, and the correlation coefficient corresponding to all the time points is much smaller than the sharp peak of fig. 12. Therefore, when the energy consumption leakage point calculated by the SM4 cryptographic algorithm is the transition between the input state of the S-box and the output state of the round function, the side channel energy analysis method of the HD model using the round function is better than the side channel energy analysis method of the HW model using the round function.
The DPA analysis and the CPA analysis are consistent in the operations of collecting energy traces and selecting attack objects. According to the above-mentioned principle of DPA analysis, in combination with the analysis of the SM4 cryptographic algorithm structure, the specific method of DPA analysis of the S-box of SM4 cryptographic algorithm of the present invention is as follows:
for the encryption operation of the SM4 cipher algorithm, the first 4 rounds of the cipher algorithm are analyzed if the encrypted plaintext is known. Assuming that N sets of plaintext encryption operations are performed, let the k-th set of plaintext input ask ∈ { 0.., N-1}, the wheel input of the ith wheel beingi is 0,1,2 and 3 in sequence.
(a) And collecting an energy trace. And carrying out encryption operation on each group of plaintext, collecting energy consumption information (energy trace) corresponding to the measurement time point, and establishing a sampling energy consumption matrix W (N multiplied by T).
(b) And selecting an attack object and determining a DPA selection function. The attack object selection in the DPA analysis method is completely consistent with the CPA method. For the HD model output by S-box, as shown in fig. 3, the ith round of attack object uses the xor value of the input and output of S-box as a new type of attack object. When the ith round of encryption operation of the kth group of plaintext input is carried out, the j byte attack object Hamming weight expected value ofDefining the selection function to use plaintext and guess key as parameters, then: in the HD model for round function output, as shown in FIG. 4, the ith round attack object uses the XOR value of the S box input and the round function output as a novel attack object Similarly, if the selection function is defined by using plaintext and guess key as parameters, then
(c) Guessing the round key divides the average energy consumption into two subsets. After an attack object and a selection function are determined, sequentially guessing the i-th round key byte rki,j,rki,jGuessed values of are rk respectivelyi,j,sS, S ∈ { 0.., 255 }. the selection function is computed for the HD model of the S-box output and the HD model of the round function output, respectively, for 256 guess keys rki,j,sRespectively carrying out encryption operation of the ith round to obtain 256 corresponding attack intermediate values, and calculating rki,j,sSubstituting to obtain corresponding selection function D (X)k,j,rki,j,s). Sequentially carrying out encryption operation on N groups of plaintext, and guessing round key byte rki,j,sCorresponding selection function D (X)k,j,rki,j,s) When 1, the total number isrki,j,sCorresponding selection function D (X)k,j,rki,j,s) When the number is 0, the total number isFor two different HD models, respectively according to a selection function, for a time point t in an energy trace, obtaining two total energy consumption mean values of the point:and,wherein,for using guess round key byte rki,j,sThe N sets of encryption operations are performed,D(Xk,j,rki,j,s) When equal to 0, n corresponds to the time point t0Group energy consumption averages;to select D (X)k,j,rki,j,s) When 1, n corresponds to the time point t1Average of group energy consumption, n0+n1N. Calculating the energy consumption average value of all time points to obtain two energy consumption matrixes D0(256 × T) and D1(256 × T), respectively: and,
(d) and calculating the difference of the two average energy consumption subsets to obtain a correct guessed key. Calculating an average energy consumption matrix D0(256 × T) and D1(256 × T) to yield a matrix △ D ═ D1-D0。
If rki,j,sGuess error, the probability of the selection function 0 and 1 for the encryption operation of N groups of plaintext input is aboutThe corresponding average energy consumption difference approaches 0 as N increases; if rki,j,sIf the guess is correct, the probability that the selection function is 0 or 1 for the encryption operation of the N groups of plaintext inputs should be 1, and the corresponding average energy consumption difference tends to be the actual influence of energy consumption along with the increase of N. Selecting the largest energy consumption mean differenceThenCorresponding guess round key byte rki,j,mTo be correctly encryptedAnd (4) key bytes, namely obtaining the j-th byte of the correct ith round key. Similarly, according to the steps (a) - (b), other 3 key bytes of the round key can be obtained respectively, so as to obtain the correct round key rk of the ith roundi。
After DPA analysis of the ith round of cryptographic operation is finished, the correct round key rk is obtainediUsing round keys rkiPerforming encryption operation of the ith round to obtain N groups of round outputs of the ith round, namely the round inputs of the (i + 1) th roundk ∈ {0,1, …, N-1 }. according to the analysis method of steps (a) - (b) above, the wheel keys of the first four wheels are obtained in turn (rk)0,rk1,rk2,rk3)=(K4,K5,K6,K7)。
The inverse of the cryptographic key expansion yields the key (MK) for the cryptographic operation of SM40,MK1,MK2,MK3)。
If the encrypted ciphertext is known, the SM4 cryptographic algorithm is analyzed for the last 4 rounds of encryption operations, and the choice of the attack object is completely consistent with the CPA last 4 rounds.
Assuming that N sets of encryption operations are performed, the ciphertext of the kth set is output as Order toThe output of the SM4 cipher algorithm round for the ith round is 31,30,29 and 28. As shown in fig. 3, the attack object of the HD model output to the S-box is consistent with the CPA end 4 rounds, and is the input and output exclusive or value of the S-box; as shown in fig. 4, the attack object of the HD model for the round function input is consistent with the CPA end 4 rounds, and is the exclusive or value of the S-box input and the round function input. Sequentially obtaining the correct round keys (rk) of the last 4 rounds according to the analysis method of the steps 1) to 4)31,rk30,rk29,rk28)=(K35,K34,K33,K32) And successfully analyzing the obtained encryption operation key of the SM4 cryptographic algorithm according to the inverse operation of the key expansion algorithm.
For the decryption operation of the SM4 cryptographic algorithm, the decryption key can be obtained using the above-described DPA analysis method as well. If the ciphertext is known, the first 4 rounds of SM4 cryptographic algorithm decryption operation are analyzed, the analysis method is the same as that of the first 4 rounds of SM4 cryptographic algorithm encryption operation, and round keys (rk) are sequentially obtained31,rk30,rk29,rk28) Obtaining a decryption key according to the inverse operation of the key expansion algorithm; similarly, if the plaintext is known, the last 4 rounds of decryption operation of the SM4 cryptographic algorithm are analyzed, the attack method is the same as that of the last 4 rounds of encryption operation of the SM4 cryptographic algorithm, and round keys (rk) are obtained in sequence0,rk1,rk2,rk3) And obtaining a decryption key according to the inverse operation of the key expansion algorithm.
The technical solutions described above only represent the preferred technical solutions of the present invention, and some possible modifications to some parts of the technical solutions by those skilled in the art all represent the principles of the present invention, and fall within the protection scope of the present invention.
Claims (10)
1. The method for analyzing the side channel energy of the SM4 cryptographic algorithm by using the Hamming distance model based on S-box input is characterized in that in the process of analyzing the side channel energy of the SM4 cryptographic algorithm, a round function is selected as an attack point, and the Hamming distance model is established by using the S-box input and the round function output; the input of the S-box at this time is the previous state v of the Hamming distance model1。
2. The SM4 cryptographic algorithm side channel with Hamming distance model based on S-box input as claimed in claim 1The energy analysis method is characterized in that the Hamming distance (HD (v) is obtained when the round function is attacked1,v2) V) successor states of the model2Is the round function output/input.
3. The method for SM4 cryptographic side channel energy analysis based on S-box input Hamming distance model as claimed in claim 2, wherein the Hamming distance (HD (v) used for the first/last 4 rounds of round function attack1,v2) Model is equivalent to an attack of a Hamming Weight (HW) model with the xor value of the S-box input and the round function output/input as the attack point.
4. The method for SM4 cryptographic side channel energy analysis by the Hamming distance model based on S-box input as claimed in claim 1,2 or 3, wherein the Hamming distance model based on S-box input is used for CPA/DPA side channel energy analysis of SM4 cryptographic algorithm.
5. The method for side channel energy analysis of SM4 cryptographic algorithm based on S-box input Hamming distance model as claimed in claim 4, wherein the S-box input based Hamming distance model is used to perform CPA side channel energy analysis of SM4 cryptographic algorithm as follows:
(1) acquiring energy traces, specifically performing encryption/decryption operation on each group of plaintext/ciphertext, acquiring energy consumption information corresponding to a measurement time point, namely acquiring the energy traces, and establishing a sampling energy consumption matrix;
(2) selecting an attack object as a round function, and determining a Hamming distance attack model;
(3) after an attack object and a model are determined, guessing a round key, and calculating a middle value of round operation to determine a middle value matrix;
(4) mapping the intermediate value and the intermediate value matrix into a simulation energy consumption value and a simulation energy consumption matrix;
(5) and calculating the linear correlation coefficient of the simulation energy consumption matrix and the sampling energy consumption matrix to obtain a correct guess key.
6. The method for SM4 cryptographic algorithm side channel energy analysis using S-box input based Hamming distance model as claimed in claim 5, wherein the specific method for using CPA to perform step (3) is that when encrypting/decrypting N (k ∈ {0,1, …, N-1}) sets of plaintext/ciphertext, it is known that the K (k ∈ {0,.., N-1}) sets of plaintext/ciphertext inputs or ciphertext/plaintext outputs are respectively the plaintext/ciphertext outputs Guessing the key of the ith roundByte of (1)Wherein Z2 8,Z2 32Are 8-dimensional and 32-dimensional vector spaces with {0,1} as elements, rki,jGuessed values of are rk respectivelyi,j,sS, s ∈ { 0.., 255}, guessing the round key byte rk when selecting the first 4 rounds of attacks or the last 4 rounds of attacks that the round function outputsi,j,sCorresponding intermediate valueRespectively as follows:
7. s-box input based according to claim 5The method for analyzing the side channel energy of the SM4 cryptographic algorithm by using the basic Hamming distance model is characterized in that the specific method for performing the step (5) by using the CPA comprises the step of performing sampling energy consumption matrix of the step (1)And (4) respectively calculating correlation coefficients rho of the s-th column and the t-th column of the simulation energy consumption matrix Hs,t:Wherein,expressed as sample energy consumption value corresponding to kth plaintext/ciphertext and tth time point, T is the number of time points in the energy trace,the matrix elements in the simulation energy consumption matrix, namely the simulation energy consumption corresponding to the jth byte of the ith round of the kth group of plaintext, the jth byte of the sth round,is the average value of the s-th column of the matrix H,is the average value, p, of the t-th column of the matrix Ws,tRepresents the linear correlation coefficient between the simulated energy consumption corresponding to the s-th guess key and the t-th sampling energy consumption at the time point, rs,tCalculating the correlation coefficient between all the columns for the approximate calculation value of the correlation coefficient to obtain a correlation coefficient matrix of simulation energy consumption and sampling energy consumptionSelecting the maximum value R in Rm,n=max(rs,t),rm,nCorresponding guess key rki,j,mGuessing the byte of the round key correctly to obtain the j byte rk of the correct ith round keyi,j(ii) a Repeating the steps (1) to (5) to respectively obtain other 3 key bytes of the round key so as to obtain the correct round key rk of the ith roundiFor the first 4 rounds, the round key rk is usediCarrying out the cryptographic operation of the ith round to obtain N groups of round outputs of the ith round, namely the round inputs of the (i + 1) th roundSequentially obtaining encryption round keys (rk) of the first 4 rounds0,rk1,rk2,rk3)=(K4,K5,K6,K7) Or decryption round keys (rk)0,rk1,rk2,rk3)=(K35,K34,K33,K32) (ii) a For the rear 4 rounds, the round key rk is usediCarrying out the ith round of cryptographic operation to obtain the (i-1) th round of outputSequentially obtaining the encryption round keys (rk) of the last 4 rounds31,rk30,rk29,rk28)=(K35,K34,K33,K32) Or decryption round keys (rk)31,rk30,rk29,rk28)=(K4,K5,K6,K7) (ii) a And obtaining the encryption/decryption key according to the inverse operation of the key expansion algorithm.
8. The method for analyzing the channel energy of the SM4 cryptographic algorithm side by the Hamming distance model based on S-box input as claimed in claim 4, wherein the step of DPA side channel energy analysis of the SM4 cryptographic algorithm by the Hamming distance model based on S-box input is as follows:
(a) acquiring energy traces, specifically performing encryption/decryption operation on each group of plaintext/ciphertext, acquiring energy consumption information corresponding to a measurement time point, namely acquiring the energy traces, and establishing a sampling energy consumption matrix;
(b) selecting the attack object as a round functionDetermining DPA selection function, and knowing j (j ∈ {0,1,2, 3) } th byte rk of ith round keyi,jThe corresponding attack object isGuessing the key byte rk with plaintext/ciphertexti,jAs a parameter, and its expected valueThe selection function defined herein is Wherein hw (x) represents the number of 1's in the x bit string;
(c) guessing a round key, and dividing the average energy consumption into two average energy consumption subset matrixes;
(d) and (c) determining a correct guess key according to the difference of the two average energy consumption subsets obtained in the step (c).
9. The method for SM4 cryptographic algorithm side channel energy analysis using an S-box input based Hamming distance model as claimed in claim 8, wherein the specific method for performing step (c) using DPA is that the kth group of plaintext/ciphertext inputs is knownOr ciphertext/plaintext outputThen guess the i-th round key rkiByte rk in (1)i,j,rki,jGuessed values of are rk respectivelyi,j,sS, s ∈ { 0.., 255}, guessing the round key byte rki,j,sCorresponding selection function D (X)k,j,rki,j,s) When 1, the total number isrki,j,sCorresponding selection function D (X)k,j,rki,j,s) When the number is 0, the total number isFor a time point t in the energy trace, the mean of the total energy consumption of the two points is obtained:andwherein,for using guess round key byte rki,j,sWhen N groups of encryption/decryption operations are carried out, N of time point t corresponding to the function equal to 0 is selected0Group energy consumption averages;for selecting n for a time t corresponding to a function equal to 11Average of group energy consumption, n0+n1N is the number of groups for encryption/decryption, and the energy consumption is averaged over all time points by the above formula to obtain two energy consumption matrices D0(256 × T) and D1(256 × T), respectively:
and
the specific method for performing step (d) using DPA is: calculating the average energy consumption matrix D obtained in the step (c)0(256 × T) and D1(256 × T) difference matrix △ D ═ D1-D0Selecting the maximum energy consumption mean value differenceThenCorresponding guess round key byte rki,j,mThe correct key byte is obtained, namely the jth byte of the correct round key of the ith round is obtained, the steps (a) to (d) are repeated, and other 3 key bytes of the round key can be respectively obtained, so that the correct round key rk of the ith round is obtainediFor the first 4 rounds, the round key rk is usediThe ith round of sealingCode operation to obtain N groups of wheel outputs of the ith wheel, namely the wheel input of the (i + 1) th wheelSequentially obtaining encryption round keys (rk) of the first 4 rounds0,rk1,rk2,rk3)=(K4,K5,K6,K7) Or decryption round keys (rk)0,rk1,rk2,rk3)=(K35,K34,K33,K32) (ii) a For the rear 4 rounds, the round key rk is usediCarrying out the ith round of cryptographic operation to obtain the (i-1) th round of outputSequentially obtaining the encryption round keys (rk) of the last 4 rounds31,rk30,rk29,rk28)=(K35,K34,K33,K32) Or decryption round keys (rk)31,rk30,rk29,rk28)=(K4,K5,K6,K7) (ii) a And obtaining the encryption/decryption key according to the inverse operation of the key expansion algorithm.
10. The method of SM4 cryptographic side channel energy analysis using the Hamming distance model based on S-box input as claimed in claim 6, wherein the Hamming distance (HD (v) used for the attack performed 4 rounds before/after the round function is selected1,v2) Previous state v of the model1Is S Box input, successor state v2Is a round function input/output equivalent to an attack using a Hamming Weight (HW) model with the exclusive or value of the S-box input and the round output/input as the attack object, i.e., an attack Or Herein, theIs the wheel input for the ith wheel,is the wheel output of the ith wheel, i is in turn 0,1,2,3 or 31,30,29, 28.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310027794.6A CN103138917B (en) | 2013-01-25 | 2013-01-25 | The Hamming distance model being input as basis with S box carries out SM4 cryptographic algorithm side channel energy analytical method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310027794.6A CN103138917B (en) | 2013-01-25 | 2013-01-25 | The Hamming distance model being input as basis with S box carries out SM4 cryptographic algorithm side channel energy analytical method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103138917A CN103138917A (en) | 2013-06-05 |
CN103138917B true CN103138917B (en) | 2016-03-09 |
Family
ID=48498277
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310027794.6A Active CN103138917B (en) | 2013-01-25 | 2013-01-25 | The Hamming distance model being input as basis with S box carries out SM4 cryptographic algorithm side channel energy analytical method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103138917B (en) |
Families Citing this family (25)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103457719B (en) * | 2013-07-23 | 2016-06-08 | 国家密码管理局商用密码检测中心 | A kind of side channel energy to SM3 cryptographic algorithm HMAC pattern analyzes method |
CN104601319B (en) * | 2013-10-31 | 2017-12-15 | 上海复旦微电子集团股份有限公司 | A kind of data ciphering method and device |
CN103825722B (en) * | 2013-11-19 | 2017-02-15 | 国家密码管理局商用密码检测中心 | Second order side channel energy analysis method for SM4 cipher algorithm |
CN103647637B (en) * | 2013-11-19 | 2017-01-04 | 国家密码管理局商用密码检测中心 | A kind of SM4 algorithm to simple mask carries out second order side channel energy and analyzes method |
CN103873229B (en) * | 2014-03-13 | 2017-01-11 | 华南师范大学 | Rapid protection method for resisting timing and cache side channel attack under KLEIN encryption AVR environment |
US9584310B2 (en) * | 2014-03-19 | 2017-02-28 | Nxp B.V. | Protecting a white-box implementation against attacks |
CN104052590B (en) * | 2014-05-05 | 2017-06-16 | 清华大学 | Frequency-domain analysis method based on side channel correlation energy analysis |
CN104202145B (en) * | 2014-09-04 | 2018-07-03 | 成都信息工程学院 | For the method for the selection plaintext or cipher text side channel energy analytical attack of SM4 cryptographic algorithms round function output |
CN104734842B (en) * | 2015-03-13 | 2018-06-08 | 上海交通大学 | Method is resisted in circuits bypass attack based on pseudo-operation |
CN104753665B (en) * | 2015-03-19 | 2018-04-06 | 成都信息工程学院 | A kind of side channel energy attack method for the output of SM4 passwords round function |
CN104753668B (en) * | 2015-03-19 | 2018-04-13 | 成都信息工程学院 | A kind of side channel energy attack method for SM4 passwords linear transformation output |
CN104734845B (en) * | 2015-03-25 | 2018-11-23 | 上海交通大学 | Bypass attack means of defence based on full Encryption Algorithm pseudo-operation |
CN104868990B (en) * | 2015-04-15 | 2018-04-06 | 成都信息工程学院 | A kind of template attack method for the output of SM4 cryptographic algorithms wheel |
CN104852795B (en) * | 2015-05-05 | 2018-03-30 | 国家密码管理局商用密码检测中心 | It is a kind of to take turns ZUC stream cipher algorithm mask means of defence of the output for boolean's mask |
CN104967509B (en) * | 2015-05-05 | 2018-05-18 | 国家密码管理局商用密码检测中心 | It is a kind of to take turns ZUC stream cipher algorithm mask means of defence of the output for arithmetic mask |
CN105812121B (en) * | 2016-03-08 | 2018-10-12 | 中国人民解放军军械工程学院 | A kind of highly stylized key efficient analysis method |
CN105591739B (en) * | 2016-03-08 | 2018-07-31 | 中国人民解放军军械工程学院 | A kind of key distribution method based on light Hamming weight |
CN105812122B (en) * | 2016-03-08 | 2018-10-12 | 中国人民解放军军械工程学院 | The method for establishing crypto chip Hamming weight and light radiation correlativity |
CN106027226B (en) * | 2016-05-13 | 2019-03-15 | 西安电子科技大学 | A kind of searching method in block cipher association key impossible differential path |
CN105897400A (en) * | 2016-06-20 | 2016-08-24 | 北京华大信安科技有限公司 | Masking method and device for SM4 algorithm |
CN107508678B (en) * | 2017-10-13 | 2020-08-04 | 成都信息工程大学 | Side channel attack method of RSA mask defense algorithm based on machine learning |
CN108155984B (en) * | 2017-12-29 | 2020-10-02 | 北京理工大学 | Reverse engineering analysis method for cryptographic algorithm cluster based on energy analysis |
CN109995502A (en) * | 2017-12-31 | 2019-07-09 | 国民技术股份有限公司 | A kind of side Multiple Channel Analysis method and device, terminal and computer readable storage medium |
CN115276962B (en) * | 2022-09-29 | 2023-01-03 | 中安网脉(北京)技术股份有限公司 | USB KEY centralized storage management system and method based on RFID technology |
CN115664641B (en) * | 2022-12-26 | 2023-03-14 | 飞腾信息技术有限公司 | Method and device for verifying round key in encryption algorithm |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1840732A1 (en) * | 2006-03-31 | 2007-10-03 | Axalto SA | Protection against side channel attacks |
-
2013
- 2013-01-25 CN CN201310027794.6A patent/CN103138917B/en active Active
Non-Patent Citations (6)
Title |
---|
Adaptive Analysis with HD Model on XOR operation in Ciper Chips;Deng Gaoming;《IEEE computer society》;20121231;全文 * |
Differential Power Analysis Attack on SMS4 Block Ciper;Xuefei Bai etc.;《Circuits and Systems for communications 2008.ICCSC 2008.4th IEEE International Conference on》;20080528;全文 * |
SMS4密码算法的差分故障攻击;张蕾等;《计算机学报》;20060930;第29卷(第9期);全文 * |
SMS4算法的能量分析攻击及其防御研究;沈薇;《信息科技辑》;20090815;第19页至第34页 * |
一种SMS4加密算法差分功耗攻击;李浪等;《计算机科学》;20100731;第37卷(第7期);第13段至18段以及图5 * |
基于汉明距离的相关能量侧信道分析方法研究;何斌等;《第二届全国信息与电子工程学术交流会暨第十三届四川省电子学会曙光分会学术年会论文集》;20060901;前言和2.1小节 * |
Also Published As
Publication number | Publication date |
---|---|
CN103138917A (en) | 2013-06-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103138917B (en) | The Hamming distance model being input as basis with S box carries out SM4 cryptographic algorithm side channel energy analytical method | |
CN103227717B (en) | The input of round key XOR is selected to carry out the method that SM4 cryptographic algorithm side channel energy is analyzed | |
CN103166752B (en) | Round function is selected to be the application that object of attack carries out the channel energy analysis of SM4 cryptographic algorithm side | |
CN103647637B (en) | A kind of SM4 algorithm to simple mask carries out second order side channel energy and analyzes method | |
CN103825722B (en) | Second order side channel energy analysis method for SM4 cipher algorithm | |
CN103457719B (en) | A kind of side channel energy to SM3 cryptographic algorithm HMAC pattern analyzes method | |
CN103199983B (en) | N rank local energy model in the channel energy analysis of side and application thereof | |
CN104852795B (en) | It is a kind of to take turns ZUC stream cipher algorithm mask means of defence of the output for boolean's mask | |
CN103905182B (en) | Anti-attack method based on middle data storage position dynamic change and circuit implementation | |
CN104052590B (en) | Frequency-domain analysis method based on side channel correlation energy analysis | |
CN104796250B (en) | The side-channel attack method realized for rsa cryptosystem algorithm M-ary | |
Duan et al. | Differential power analysis attack and efficient countermeasures on PRESENT | |
CN103532973A (en) | Differential power attack testing method for DES (data encryption standard) algorithm circuit | |
CN105933108B (en) | A kind of pair of SM4 algorithm realizes the method cracked | |
CN104811295A (en) | Side channel energy analysis method for ZUC cryptographic algorithm with mask protection | |
CN111030820B (en) | Mask SM4 algorithm-based method for selecting plaintext related collision attack | |
CN110190951A (en) | A kind of power consumption attack method and system for the overturning of DES algorithm L register | |
CN104811297B (en) | Modular multiplication remainder input side-channel attack is realized for the M-ary of RSA | |
Gaspar et al. | Hardware implementation and side-channel analysis of lapin | |
CN113158179B (en) | Learning side channel attack method for automatically discovering leakage model and encryption equipment | |
CN104967509B (en) | It is a kind of to take turns ZUC stream cipher algorithm mask means of defence of the output for arithmetic mask | |
CN109936437B (en) | power consumption attack resisting method based on d +1 order mask | |
CN110730062B (en) | Chaos grouping encryption analysis method based on template attack | |
CN103546277B (en) | The DPA of a kind of smart card SM4 algorithm attacks and key recovery method and system | |
CN115412360A (en) | Side channel correlation energy analysis method and system applied to ring polynomial multiplier |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |