The content of the invention
In view of this, it is necessary to which a kind of AES wheel operation methods and circuit are provided.
The present invention provides a kind of AES wheels operation method, and this method comprises the following steps:
S1:Using random number X, the plaintext of any 128 is sheltered;
S2:It is breast wheel operation or end wheel operation to judge the data after masking, and keeps in the data, if it is middle to judge
During wheel operation, step S3a is carried out;If judgement is end wheel operation, step S3b is carried out;
S3a:Computing E is extended to the random number X, obtains E (X);
S4:The E (X), round key and the S2 data kept in are carried out at the same time exclusive or, are obtained into the first S box arrays
Value;
S5:To the value for entering the first S box arrays, S box computings are carried out, and the first S box array operations will be passed through
The data exported afterwards, exclusive or is carried out with the random number X;
S6:The data for the data exported after the S boxes computing and the random number X obtain after exclusive or, into every trade
Displacement and row mixing, and obtained data are back to step S2;
S3b:2nd S box arrays are entered to the data of step S2, carry out S box computings;
S7:The data that will be exported after the 2nd S box array operations, exclusive or is carried out with the random number X;
S8:The data and the random number X data obtained after exclusive or exported after the 2nd S box computings are carried out
Row displacement, and the random number X is shifted into every trade, obtain S (X);
S9:The number for the data exported after last round key, the S boxes computing and the random number X obtain after exclusive or
Exclusive or is carried out according to the data and the S (X) shifted into every trade, obtains final ciphertext, wherein, first and second described S
Box array, by 4, randomly selected S boxes are formed from the S boxes of N kind difference circuit structures respectively, and N is the nature not less than 3
Number.
Wherein, the step S1 includes:
S11:Operand A on data path, by linear operation, it is K to obtain result, and K=f (A), wherein f, which are represented, to be added
The intermediary operation of decrypting process;
S12:Using the random number X by exclusive or come computing, new operand B, B=A ⊕ X are produced, wherein ⊕ is represented
Xor operation;
S13:A is replaced to carry out encryption and decryption computing with the new operand B, it is L, L=f (B)=f (A ⊕ to obtain result
X);
S14:The random number X carries out above-mentioned same operation, and it is M, M=f (X) to obtain result.
Wherein, the step b includes:
B1. by 32 Bits Expandings it is 48 by the data after the masking by extended arithmetic E, and exports and include 86
Block, every piece include 4 corresponding input bits, and 2 adjacent blocks in adjacent position.
Wherein, the round key is one of several 128 sub-keys for being generated using key schedule from master key, institute
State each sub-key and be used for 1 round trip processing.
Wherein, first and second described S box array, includes the S boxes of LUT, SOP, PPRM and DSE structure.
Wherein, first and second described S box array, by 4 respectively by random gate device from N kind difference circuit structures
S boxes in randomly selected S boxes form.
Wherein, the step S5 includes:
S51:Each described S box, uses the nonlinear transformation provided in a manner of look-up table, enters S box arrays by described
Value in 8 input bits of each block be converted into 8 carry-out bits.
The present invention also provides a kind of AES take turns computing circuit, the wheel computing circuit include masking block, data selecting module,
Data register module, extended arithmetic module, the first XOR operation module, the first S boxes array, the second XOR operation module, first
In-place computation module, the 2nd S boxes array, the 3rd XOR operation module, the second in-place computation module and the 4th XOR operation module,
Wherein:
The masking block is used to use random number X, and the plaintext of any 128 is sheltered;
The data selecting module is used to judge that the data after masking are breast wheel operation or end wheel operation;
The data register module is used for the temporary data judged through the data selecting module;
The extended arithmetic module is used to be extended computing E to the random number X, obtains E (X);
The data that the breast wheel that the first XOR operation module is used to keep in the E (X), round key and S2 operates are same
Shi Jinhang exclusive or, obtains the value into the first S box arrays;
The first S boxes array is used to, to the value for entering the first S box arrays, carry out S box computings;
The second XOR operation module is used for the data that will will be exported after the first S box array operations, with institute
State random number X and carry out exclusive or;
The first in-place computation module is used to carry out the data exported after the S boxes computing with the random number X different
The data obtained after or, shift and arrange mixing into every trade, and will shift into every trade and arrange mixed data and be back to the number
According to selecting module;
The data register module is additionally operable to the data of the temporary end wheel operation judged through the data selecting module, on
State data and enter the 2nd S box arrays;
The 2nd S boxes array is used for the data for the end wheel operation that computing judges through the data selecting module and output should
Data;
The 3rd XOR operation module is used for the data that will be exported after the 2nd S box array operations, and described
Random number X carries out exclusive or;
The second in-place computation module be used for the data that are exported after the 2nd S box computings and the random number X into
The data obtained after row exclusive or are shifted into every trade, and the random number X is shifted into every trade, obtain S (X);
The 4th XOR operation module be used for the data that are exported after last round key, the S boxes computing with it is described random
The data and the S (X) that the data that number X obtained after exclusive or are shifted into every trade carry out exclusive or, obtain final ciphertext,
Wherein, first and second described S box array, by 4 randomly selected S boxes structures from the S boxes of N kind difference circuit structures respectively
Into N is the natural number not less than 3.
Wherein, the S boxes of the different circuit structures, include the S boxes of SOP, PPRM and DSE structure.
AES wheel operation methods of the present invention and circuit, power consumption is defendd using data masking and different S boxes circuit random alignments
Analysis, in AES flows, to pertain only to place-exchange or simple Boolean calculation linear operation include row displacement, row mixing and
Round key addition, is sheltered using xor operation and is recovered data;To the S boxes of nonlinear operation, different circuits are designed
The S boxes of structure, power consumption profile during these S box computings is different, when data pass through S boxes, by randomly choosing data path
The arrangement of upper S boxes so that in AES the computing of S boxes Power randomization.Have the beneficial effect that:1) attacker is in data path
On can not observe the truthful data of encryption process, simultaneously because Power randomization, statistical analysis key also becomes to be stranded very much
It is difficult;2) circuit structure of AES is not changed, algorithm is succinct, easy to implement;3) AES electricity can be increased substantially with less cost
Resist the ability of power consumption analysis attack in road.
Embodiment
Below in conjunction with the accompanying drawings and specific embodiment the present invention is described in further detail.
AES of the present invention wheel operation method and circuit, by AES flows, to pertaining only to place-exchange or simple boolean
The linear operation of computing, is sheltered using xor operation and is recovered data;To the S boxes of nonlinear operation, difference is designed
Power consumption profile different S boxes when circuit structure, computing, when data pass through S boxes, by randomly choosing S on data path
The arrangement of box so that in AES the computing of S boxes Power randomization.
The computations AES wheel operation methods of AES as shown in Figure 1, this method comprises the following steps:
S1:Using random number X, the plaintext of any 128 is sheltered;
Preferably, referring to Fig. 2, being the step flow chart sheltered to the plaintext of any 128 using random number X,
Comprise the following steps:
S11:Operand A on data path, by linear operation, it is K to obtain result, and K=f (A), wherein f, which are represented, to be added
The intermediary operation of decrypting process;
S12:Using the random number X by exclusive or come computing, new operand B, B=A ⊕ X are produced, wherein ⊕ is represented
Xor operation;
S13:A is replaced to carry out encryption and decryption computing with the new operand B, it is L, L=f (B)=f (A ⊕ to obtain result
X);
S14:The random number X carries out above-mentioned same operation, and it is M, M=f (X) to obtain result.
It is appreciated that when f is linear operation, position can be arbitrarily exchanged with xor operation, data B is counted after so sheltering
Obtained result L needs simple and random number X f operation results M to carry out exclusive or, you can recovers correct result K;
L ⊕ M=f (A ⊕ X) ⊕ f (X)=f (A ⊕ X ⊕ X)=f (A)=K
S2:It is breast wheel operation or end wheel operation to judge the data after masking, and keeps in the data, if it is middle to judge
During wheel operation, step S3a is carried out;If judgement is end wheel operation, step S3b is carried out;
S3a:Computing E is extended to the random number X, obtains E (X);
Specifically, by 32 Bits Expandings it is 48 by the data after the masking by extended arithmetic E, and exports and include 8
The block of 6, every piece includes adjacent position in 4 corresponding input bits, and 2 adjacent blocks.
S4:The E (X), round key and the S2 data kept in are carried out at the same time exclusive or, are obtained into the first S box arrays
Value;
Preferably, the round key is one of several 128 sub-keys generated using key schedule from master key,
Each sub-key is used for 1 round trip and handles.
S5:To the value for entering the first S box arrays, S box computings are carried out, and the first S box array operations will be passed through
The data exported afterwards, exclusive or is carried out with the random number X;
S6:The data for the data exported after the S boxes computing and the random number X obtain after exclusive or, into every trade
Displacement and row mixing, and obtained data are back to step S2;
S3b:2nd S box arrays are entered to the data of step S2, carry out S box computings;
Preferably, first and second described S box array, including LUT (Look UP Table), SOP (Sum Of
Products), PPRM (Positive Polarity Reed-Muller), DSE (Decoder-Switch-Encoder) structure
S boxes.
Preferably, each described S box, uses the nonlinear transformation provided in a manner of look-up table, enters S box battle arrays by described
8 input bits of each block are converted into 8 carry-out bits in the value of row.
S7:The data that will be exported after the 2nd S box array operations, exclusive or is carried out with the random number X;
S8:The data and the random number X data obtained after exclusive or exported after the 2nd S box computings are carried out
Row displacement, and the random number X is shifted into every trade, obtain S (X);
S9:The number for the data exported after last round key, the S boxes computing and the random number X obtain after exclusive or
Exclusive or is carried out according to the data and the S (X) shifted into every trade, obtains final ciphertext.
It is appreciated that S box computings are nonlinear operations, after entering first and second S box using the data sheltered, by nothing
Method simply returns to correct operation result, and therefore, the present invention is using above-mentioned steps S11~step S14 to any 128
Sheltered in plain text.Before the data of masking carry out byte replacement operation, by exclusive or, recover its original result.Data are through the
Sheltered again after one S box arrays, continue to carry out subsequent arithmetic with the data hidden.Handle in this way, whole AES computings stream
Journey can be to be hidden and be recovered simply in a manner of xor operation.In byte replacing part using different circuit structures
S boxes, these S boxes output result is consistent, but power consumption profile during computing is different.When data pass through S boxes, by selecting at random
Select the arrangement of S boxes on data path so that every time the S boxes that pass through of cryptographic calculation be it is randomly selected, statistically from the point of view of, word
Randomization form can be presented in the power consumption of section replacement operation.
Referring to Fig. 3, the structure chart of computing circuit is taken turns for AES of the present invention, including masking block 110, data selecting module
120th, data register module 130, extended arithmetic module 140, the first XOR operation module 150, the first S boxes array 160, second are different
Or computing module 170, the first in-place computation module 180, the 2nd S boxes array 190, the 3rd XOR operation module 210, the second displacement
220 and the 4th XOR operation module 230 of computing module, wherein,
Masking block 110 is used to use random number X, and the plaintext of any 128 is sheltered;
Preferably, masking block 110 is to the operand A on data path, and by linear operation, it is K, K=f to obtain result
(A), wherein f represents the intermediary operation of encryption process, then using the random number X by exclusive or come computing, produce new behaviour
Count B, and B=A ⊕ X, wherein ⊕ represent xor operation, replace A to carry out encryption and decryption computing by using the new operand B, obtain
It is L, L=f (B)=f (A ⊕ X) to result, the random number X carries out above-mentioned same operation, and it is M, M=f (X) to obtain result.
It is appreciated that when f is linear operation, position can be arbitrarily exchanged with xor operation, data B is counted after so sheltering
Obtained result L needs simple and random number X f operation results M to carry out exclusive or, you can recovers correct result K;
L ⊕ M=f (A ⊕ X) ⊕ f (X)=f (A ⊕ X ⊕ X)=f (A)=K
Data selecting module 120 is used to judge that the data after masking are breast wheel operation or end wheel operation.Preferably, data
It is breast wheel operation or end wheel data that selecting module 120 can be used for selecting data for data selector.It is appreciated that data are selected
Module 120 is selected it is also an option that whether data are breast wheel operation.
Data register module 130 is used for the temporary data judged through the data selecting module.Preferably, data register mould
Block 130 is used for the temporary data selected through data selecting module 120 for register.
Extended arithmetic module 140 is used to be extended computing E to the random number X, obtains E (X), wherein, E (X) is used for
Eliminate the masking of random number X.
The data that the breast wheel that first XOR operation module 150 is used to keep in the E (X), round key and S2 operates are same
Shi Jinhang exclusive or, obtains the value into the first S box arrays;
The first S boxes array 160 is used to, to the value for entering the first S box arrays, carry out S box computings;
The second XOR operation module 170 is used for the number that will will be exported after 160 computing of the first S boxes array
According to random number X progress exclusive or;
The first in-place computation module 180 is used to carry out the data exported after the S boxes computing and the random number X
The data obtained after exclusive or, shift and arrange mixing into every trade, and will shift and arrange into every trade mixed data be back to it is described
Data selecting module 120;
The data register module 130 is additionally operable to the temporary end wheel operation judged through the data selecting module 120
Data, above-mentioned data enter the 2nd S boxes array 190;
The 2nd S boxes array 190 is used for the data for the end wheel operation that computing judges through the data selecting module 120 simultaneously
Export the data;
The 3rd XOR operation module 210 is used for the data that will be exported after 190 computing of the 2nd S boxes array,
Exclusive or is carried out with the random number X;
The second in-place computation module 220 is used for the data exported after the 2nd S box computings and the random number X
The data obtained after exclusive or are shifted into every trade, and the random number X is shifted into every trade, obtain S (X);
The 4th XOR operation module 230 be used for the data that are exported after last round key, the S boxes computing with it is described with
Machine number X carries out the data that obtained data after exclusive or shift into every trade and the S (X) carries out exclusive or, obtains final close
Text, wherein, first and second described S box array, by 4 randomly selected S from the S boxes of N kind difference circuit structures respectively
Box is formed, and N is the natural number not less than 3.
It is appreciated that first and second S box array can be merged into same S boxes array.
Specifically, refer to the AES that Fig. 4 is defence power consumption attack proposed by the present invention and take turns operating structure figure, data path
Bit wide 128.During breast wheel computing, in plain text with random number X, XOR operation is carried out together.Data selecting module 120 is used for selecting
Data are breast wheel operation or first run operation.Data register module 130 is used for temporal data, round key addition move on to S boxes it
Preceding progress.E (X) is used for the masking for eliminating random number X, is random number X in the value of breast wheel, is passed through in breast wheel for random number X
Space shifts and the result of row mixing.The improved S boxes array of data completes byte replacement operation, is shifting and is arranging into every trade
Before mixing, exclusive or can be carried out with random number X, to carry out data masking.
Referring to Fig. 5, the data wheel computing schematic diagram for end wheel.After the improved S boxes array of data, with random number X
Exclusive or, then data are into every trade shifting function.Meanwhile X also carries out shifting function, obtained result is S (X).Finally, end wheel is close
Key, the data through space displacement and S (X) carry out exclusive or, obtain final ciphertext.
Fig. 6 is by taking 32 bits before data path (4 S boxes) as an example, illustrates the S box array junctions that can defend power consumption attack
Structure.The implementation of S boxes can have many kinds, and the present invention have chosen LUT (Look UP Table), SOP (Sum Of
Products), PPRM (Positive Polarity Reed-Muller), DSE (Decoder-Switch-Encoder) structure
S boxes, its power consumption profile for redirecting of different circuit implementations is different.When data enter improved S boxes, according to random number
Y, putting in order for this four S boxes is selected by randomly ordered device.The result of calculation of these four S boxes is identical, simply electricity
Line structure is different, and the power consumption of generation also differs.After the completion of byte replaces calculating, data will be sent out by participating in the S boxes of computing.Its
The data path of his three 32 bits can use similar circuit structure, and S box arrays are improved so as to form.
Stochastic inputs a large amount of plaintexts are needed when power consumption attack, some S box power consumption profile is observed.But by
The computing of rotation is being carried out in the S boxes circuit of random 4 different structures of practicality so that power consumption profile can not area in the computing of S boxes
Point, power consumption attack protection thus can be effectively implemented to non-linear unit S boxes.
AES wheel operation methods of the present invention and circuit, power consumption is defendd using data masking and different S boxes circuit random alignments
Analysis, in AES flows, to pertain only to place-exchange or simple Boolean calculation linear operation include row displacement, row mixing and
Round key addition, is sheltered using xor operation and is recovered data;To the S boxes of nonlinear operation, different circuits are designed
The S boxes of structure, power consumption profile during these S box computings is different, when data pass through S boxes, by randomly choosing data path
The arrangement of upper S boxes so that in AES the computing of S boxes Power randomization.Have the beneficial effect that:1) attacker is in data path
On can not observe the truthful data of encryption process, simultaneously because Power randomization, statistical analysis key also becomes to be stranded very much
It is difficult;2) circuit structure of AES is not changed, algorithm is succinct, easy to implement;3) AES electricity can be increased substantially with less cost
Resist the ability of power consumption analysis attack in road.
Although the present invention is described with reference to current better embodiment, those skilled in the art should be able to manage
Solution, above-mentioned better embodiment is only used for illustrating the present invention, is not used for limiting protection scope of the present invention, any in the present invention
Spirit and spirit within, any modification for being done, equivalence replacement, improvements etc., should be included in the right guarantor of the present invention
Within the scope of shield.