CN101764685B - Encrypting and deciphering system for realizing SMS4 algorithm - Google Patents

Encrypting and deciphering system for realizing SMS4 algorithm Download PDF

Info

Publication number
CN101764685B
CN101764685B CN2009101933081A CN200910193308A CN101764685B CN 101764685 B CN101764685 B CN 101764685B CN 2009101933081 A CN2009101933081 A CN 2009101933081A CN 200910193308 A CN200910193308 A CN 200910193308A CN 101764685 B CN101764685 B CN 101764685B
Authority
CN
China
Prior art keywords
computing
data
module
memory module
encryption
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.)
Expired - Fee Related
Application number
CN2009101933081A
Other languages
Chinese (zh)
Other versions
CN101764685A (en
Inventor
张永强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
GCI Science and Technology Co Ltd
Original Assignee
GCI Science and Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by GCI Science and Technology Co Ltd filed Critical GCI Science and Technology Co Ltd
Priority to CN2009101933081A priority Critical patent/CN101764685B/en
Publication of CN101764685A publication Critical patent/CN101764685A/en
Application granted granted Critical
Publication of CN101764685B publication Critical patent/CN101764685B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Storage Device Security (AREA)

Abstract

The invention relates to the field of block cipher algorithm of wireless local network, and provides an encrypting and deciphering system for realizing SMS4 algorithm; the encrypting and deciphering system comprises a first operation module and a first-stage production line of a first storing module, a second operation module and a second -stage production line of a second storing module and a third operation module and a third -stage production line of a third storing module. The three operation modules in the technical scheme of the invention realize functional reuse for encryption and decryption operation and round key spreading operation, thereby directly reducing component redundancy and reducing the occupied area of the system. Moreover, the invention adopts three-stage production line structure to deal with three groups of data simultaneously, and in which any group of data can be the encryption and decryption operation or the round key spreading operation, so as to improve system efficiency.

Description

Realize the encrypting and deciphering system of SMS4 algorithm
Technical field
The present invention relates to WLAN block cipher field, be specially the encrypting and deciphering system that proposes a kind of SMS4 of realization algorithm.
Background technology
The SMS4 cryptographic algorithm is that first of domestic announcement is used for the commercial cipher algorithm of WLAN product, and this algorithm is that China is first openly to the cryptographic algorithm of special dimension, and WLAN industry and commercial cipher research are all had important meaning.SMS4 is based on the grouping symmetric cryptographic algorithm of S box, and it carries out the encryption and decryption computing to one group of Bit data, and the block length of this algorithm is 128 bits, and key length is 128 bits.AES and key schedule all adopt 32 to take turns the nonlinear iteration structure.
AES is mainly the process that encryption and decryption data and round key carry out cryptographic calculation of reading in.The enciphering transformation of algorithm comprises XOR and synthetic displacement T 1Computing, wherein synthetic displacement T 1Computing is by linear change L 1τ is composited with nonlinear change, i.e. T 1(.)=L 1(τ (.)).Nonlinear change τ is made up of 4 parallel S boxes, and the S box is that 8 bits of fixing are imported the conversion that 8 bits are exported; Linear change L 1Comprise XOR and shift left operation.
The structure of decipherment algorithm and AES is identical, but the order of use round key in contrast.
Round key in the enciphering and deciphering algorithm is that encryption key MK generates through the round key expansion algorithm.The basic structure of this expansion algorithm is also identical with enciphering and deciphering algorithm, comprises XOR and synthetic displacement T equally 2Computing.Wherein synthetic displacement T 2Synthetic displacement T in computing and the AES 1Computing is basic identical, only incites somebody to action linear change L wherein 1Be revised as L 2, linear change L 2Comprise XOR and shift left operation equally, form is slightly different.
There is multiple implementation in the prior art in the encrypting and deciphering system of realizing the SMS4 algorithm, but these schemes are mostly based on following framework: comprise round key expansion module, control module and encryption and decryption module.With the cryptographic operation is example, at first reads in encryption key MK, system parameters FK and preset parameter CK by the round key expansion module, and wherein FK and CK are fixed values, and all parameters of reading in are taken turns interative computation through 32 and produced 32 round key and storage.As expressly getting into the encryption and decryption module, then cryptographic calculation starts, and reads in the respective wheel key in the iteration every the wheel, takes turns the iterative cryptographic operation until accomplishing 32, finally exports ciphertext.The difference of different schemes is in the realization of encryption and decryption module.If simple according to the operation in the algorithm, expressly all will take turns iteration through 32 could accomplish encryption to each group, and the clock frequency in the practical application is generally all lower, thereby causes interior ciphered data amount of unit interval few, and efficient is low.If improve clock frequency by force, can bring bigger interference to system again, bring difficulty to design of integrated circuit.Therefore the technical staff has designed different encrypted computing structure to reduce cycle-index, improves encryption efficiency.Taking turns in the circulation such as one and to add a plurality of round function F, thereby reach the purpose that reduces iterations, is 32 as long as keep the number of round function F and the product of iterations.Can also between each round function F, insert register and form flowing structure, make system can carry out the encryption and decryption computing to multi-group data at one time.
But consider from the structure of system's overall situation; Encryption and decryption module and round key expansion module have bigger similitude on function; Prior art still uses two independent modules to realize respectively round key expansion and encryption and decryption functions, makes system higher in the situation lower component redundancy that adopts pipeline organization.
Summary of the invention
The objective of the invention is to propose a kind of encrypting and deciphering system of the SMS4 of realization algorithm, under the situation that adopts pipeline organization, reduce the parts redundant degree of system.
Because there are bigger similitude in encryption and decryption module and round key expansion module function in the encrypting and deciphering system of realization SMS4 algorithm; In order to reduce the parts redundant degree; The thought that the present invention is based on module reuse proposes a kind of encrypting and deciphering system of the SMS4 of realization algorithm, comprising: first order streamline, second level streamline, third level streamline;
Said first order streamline comprises first computing module and first memory module; Said second level streamline comprises second computing module and second memory module; Said third level streamline comprises the 3rd computing module and the 3rd memory module;
The memory module of said each level production line all comprises Control Parameter zone, input block territory and operational data zone; Said Control Parameter zone is used for storing control parameter, this Control Parameter indication mode of operation and iteration round; Said input block territory is used for storage input data, and said first order streamline receives the input data of corresponding round, and is stored in the input block territory of the memory module of each level production line; Said operational data zone is used to store operational data, and the computing output result of each level production line is stored in the operational data zone of the memory module of each level production line;
Said mode of operation comprises cipher key spreading pattern and encryption and decryption pattern; Said mode of operation is determined by the input data of first round, is that encryption key then is in the cipher key spreading pattern as if the input data, then is in the encryption and decryption pattern if the input data are plaintext or ciphertext;
Said first computing module will import data and system parameters or zero parameter is carried out xor operation, and the result is exported in computing is stored in said first memory module; Said second computing module receives the computing output result of first memory module, with this computing output result and preset parameter or round key execution xor operation, carries out S box table lookup operation more then, and the result is exported in computing is stored in said second memory module; Said the 3rd computing module receives the computing output result of second memory module, then this computing output result is carried out the ring shift left operation, carries out XOR again, and the result is exported in computing is stored in said the 3rd memory module;
Said first computing module comprises the first data alternative pack and the first XOR parts; The said first data alternative pack is used for the selection of data, and the foundation of selection is the mode of operation that comprises in the said Control Parameter; If be in cipher key spreading pattern, then selective system parameter; If be in the encryption and decryption pattern, then select zero parameter; The said first XOR parts are used for the output result of said input data and the said first data alternative pack is carried out xor operation;
Said second computing module comprises the second data alternative pack, the second XOR parts and S box parts; The said second data alternative pack is used for the selection of data, and it selects foundation is the mode of operation that comprises in the said Control Parameter; If be in the cipher key spreading pattern, then select preset parameter; If be in the encryption and decryption pattern, then select round key; Select said round key also according to the iteration round that comprises in the said Control Parameter; The said second XOR parts are used for the output result of said operational data and the said second data alternative pack is carried out xor operation; Said S box parts are used for the output result of the said second XOR parts is carried out S box table lookup operation;
Said the 3rd computing module comprises the 3rd data alternative pack, ring shift left parts and the 3rd XOR parts; Said the 3rd data alternative pack is used for the selection of data, and it selects foundation is the mode of operation that comprises in the Control Parameter; If be in the cipher key spreading pattern, then select parameter 0,0,13,23}; If be in the encryption and decryption pattern, then select parameter 2,10,18,24}; Said ring shift left parts are used for operational data is carried out ring shift left and xor operation; Said ring shift left parts are carried out the ring shift left computing of four kinds of band parameters earlier to operational data, the number of bits that said parameter representative moves to left is carried out xor operation to four kinds of ring shift left results again; The parameter of said ring shift left parts is from the output result of said the 3rd data alternative pack; Said the 3rd XOR parts are used for the output result of said input data and said ring shift left parts is carried out xor operation;
Said second computing module computing output result according to said the 3rd memory module storage when said third level streamline is in the cipher key spreading pattern upgrades round key;
Said third level streamline is sent to first order streamline to computing output result and gets into next iteration round, this moment replication work pattern and the iteration round increased progressively; If said third level streamline is in last iteration round, then be not sent to first order streamline to computing output result; If this last iteration round is last the iteration round under the encryption and decryption pattern, then export the result to the computing of said third level streamline as the encryption and decryption operation result.
The encrypting and deciphering system of the realization SMS4 algorithm that the present invention proposes; Employing comprises the pipelined architecture that first order streamline, second level streamline and third level streamline are formed; Through these three computing modules of first computing module, second computing module and the 3rd computing module, realize the multiplexing functions of encryption and decryption computing and round key extended arithmetic.Though there are three computing modules in the technical scheme; But because each module is only accomplished the part of computing; Essence is equivalent to each module and is merely 1/3rd of round function module in the prior art; Can be regarded as the present invention and only adopt a multiplexing round function module, just can realize needing two functions that independent round function module could realize in the prior art, directly reduce the parts redundant degree; And this programme can be realized interspersed the carrying out of 32 next round functional operation of the 32 next round functional operation and the round key expansion of encryption and decryption processing under the employing pipelined architecture; Promptly can 3 computings of concurrent execution each cycle user, wherein each computing can be encryption and decryption computing or cipher key spreading computing.
Description of drawings
Fig. 1 is the sketch map of a Standard Encryption module;
Fig. 2 is a kind of sketch map of round key expansion module;
Fig. 3 is each module diagram of inside of three class pipeline in the encrypting and deciphering system of realization SMS4 algorithm of embodiment 1;
Fig. 4 moves towards sketch map for the signal of the encrypting and deciphering system first order streamline of the realization SMS4 algorithm of embodiment 2;
Fig. 5 moves towards sketch map for the signal of the encrypting and deciphering system second level streamline of the realization SMS4 algorithm of embodiment 2;
Fig. 6 moves towards sketch map for the signal of the encrypting and deciphering system third level streamline of the realization SMS4 algorithm of embodiment 2.
Embodiment
The SMS4 algorithm is the domestic significant commercial interest cryptographic algorithm that is applied to the WLAN field, and wherein enciphering and deciphering algorithm and key schedule all adopt 32 to take turns the nonlinear iteration structure.The structure of decipherment algorithm and AES is identical, just the use reversed in order of round key.
Briefly introduce in the face of enciphering and deciphering algorithm down:
If expressly be input as X 0, X 1, X 2, X 3Ciphertext is input as Y 0, Y 1, Y 2, Y 3Round key is rk i, i=0 wherein, 1,2 ..., 31.Use The binary system manifold of expression e bit, X then, Y, rk iAll be the binary system manifold of 32 bits, use
Figure GSB00000617403100052
Expression.The encryption and decryption of algorithm is transformed to:
X i + 4 = F ( X i , X i + 1 , X i + 2 , X i + 3 , r k i ) = X i ⊕ T 1 ( X i + 1 ⊕ X i + 2 ⊕ X i + 3 ⊕ rk i ) , i = 0,1 , . . . , 31
F is a round function, carry out as above 32 take turns interative computation after, obtain ciphertext:
(Y 0,Y 1,Y 2,Y 3)=(X 35,X 34,X 33,X 32)
The deciphering conversion is identical with the enciphering transformation structure, only is that the use order of round key is different.When encrypting: the order of using of round key is rk 0, rk 1..., rk 31During deciphering: the order of using of round key is rk 31, rk 30..., rk 0
Synthetic displacement T 1Be an inverible transform, by nonlinear transformation τ and linear transformation L 1Be composited, i.e. T 1(.)=L 1(τ (.)).Nonlinear transformation τ is made up of 4 parallel S boxes, and the S box is imported the conversion that 8 bits are exported for 8 fixing bits, is designated as Sbox (.).
If be input as A=(a 1, a 2, a 3, a 4), be output as B=(b 1, b 2, b 3, b 4), wherein, a 1, a 2, a 3, a 4, b 1, b 2, b 3, b 4All be 8 bit binary number, use
Figure GSB00000617403100061
Expression.Nonlinear transformation τ and linear transformation L 1Be respectively:
B=τ(A)=(Sbox(a 0),Sbox(a 1),Sbox(a 2),Sbox(a 3));
C = L 1 ( B ) = B &CirclePlus; ( B < < < 2 ) &CirclePlus; ( B < < < 10 ) &CirclePlus; ( B < < < 18 ) &CirclePlus; ( B < < < 24 ) .
Above-mentioned algorithm use the basic operation of bit XOR and bit ring shift left; The expression bit XOR with
Figure GSB00000617403100063
, with<<<i representes bit ring shift left i position.
Fig. 1 is the sketch map of a Standard Encryption module, is made up of data selector, round function F parts and register.With the ciphering process is example: data selector judges whether the encryption of current data group is accomplished, and then reads in new plaintext and encrypts if accomplished; If completion is then sent last round of operation result into next round and is proceeded cryptographic calculation.Round function F parts are core components of encryption and decryption module, read in be-encrypted data and round key and carry out cryptographic calculation, and concrete encrypting step is as indicated above.Register is temporary last round of encrypted result, takes turns until 32 and exports ciphertext when the computing of iteration encryption and decryption is accomplished.
Briefly introduce in the face of the round key expansion algorithm down:
Round key in the enciphering and deciphering algorithm is generated through key schedule by encryption key, and this algorithm basic structure is identical with enciphering and deciphering algorithm, also is to generate 32 round key after taking turns interative computation through 32.
Encryption key MK=(MK 0, MK 1, MK 2, MK 3),
Figure GSB00000617403100064
I=0,1,2,3;
Make i=0; 1; ..., 35, round key is
Figure GSB00000617403100066
i=0; 1; ..., 31, then the round key expansion algorithm is:
( K 0 , K 1 , K 2 , K 3 ) = ( MK 0 &CirclePlus; FK 0 , MK 1 &CirclePlus; FK 1 , MK 2 &CirclePlus; FK 2 , MK 3 &CirclePlus; FK 3 )
rk i = K i + 4 = F ( K i , K i + 1 , K i + 2 , K i + 3 , CK i ) = K i &CirclePlus; T 2 ( K i + 1 &CirclePlus; K i + 2 &CirclePlus; K i + 3 &CirclePlus; CK i ) , i = 0,1 , . . . 31
T 2T in conversion and the enciphering and deciphering algorithm 1Basic identical, only be linear transformation L 1Be revised as L 2If be input as B, be output as C, then linear transformation L 2For
Figure GSB00000617403100069
FK is system parameters: FK 0=(A3B1BAC6), FK 1=(56AA3350), FK 2=(677D9197), FK 3=(B27022DC), these parameters all are that 16 systems are represented; CK is the preset parameter value.
Fig. 2 is a kind of sketch map of round key expansion module, comprises data selector and exclusive-OR operator, round function F parts, register three parts composition.The first of round key expansion module comprises data selector and exclusive-OR operator; Data selector judges whether current round key group generates fully; If generate the then encryption key of the new input of acceptance fully, carry out next round round key generation computing as the input data otherwise will go up the wheel operation result; Exclusive-OR operator carries out XOR to the encryption key MK and the system parameters FK of input, promptly accomplishes ( K 0 , K 1 , K 2 , K 3 ) = ( MK 0 &CirclePlus; FK 0 , MK 1 &CirclePlus; FK 1 , MK 2 &CirclePlus; FK 2 , MK 3 &CirclePlus; FK 3 ) Computing.The XOR that round function F parts read in MK and FK is K and CK as a result, takes turns interative computation through 32 and produces 32 round key, and the concrete operation process as stated.Register stores each round key of taking turns computing successively, finishes 32 round key of back output until computing.
Can find out that from the introduction of enciphering and deciphering algorithm and round key expansion algorithm there are more multi-functional identical parts in the encryption and decryption module with the round key expansion module, can reduce system redundancy from the module reuse angle; And there are property successively in time in round key computing and encryption and decryption computing, can switch through function to realize module reuse.
Embodiment 1:
The encrypting and deciphering system of the realization SMS4 algorithm that the present invention proposes comprises: first order streamline, second level streamline, third level streamline; Fig. 3 is each module diagram of inside of three class pipeline; Wherein first order streamline comprises first computing module and first memory module; Second level streamline comprises second computing module and second memory module, and third level streamline comprises the 3rd computing module and the 3rd memory module.
The memory module of each level production line all comprises Control Parameter zone, input block territory and operational data zone, and wherein the Control Parameter zone is used for storing control parameter, and the input block territory is used for storage input data, and the operational data zone is used to store operational data; Control Parameter comprises mode of operation and iteration round; Each level production line can be in cipher key spreading pattern and encryption and decryption pattern; This is by the input data decision of first round; As if the input data is that encryption key then is in the cipher key spreading pattern, then is in the encryption and decryption pattern if the input data are plaintext or ciphertext.
The course of work of the encrypting and deciphering system of the realization SMS4 algorithm of present embodiment 1 is following, and computing is then all described with ciphering process for encryption and decryption:
When cipher key spreading computing of carrying out when system or encryption and decryption computing sum are less than 3, can import new arithmetic operation to system.First order streamline receives the input data of first round; It is stored in the input block territory of the memory module of each level production line; And according to the input type of data confirm mode of operation, be stored in the Control Parameter zone, simultaneously the iteration round in the Control Parameter zone is set at 1.
First computing module in the first order streamline will be imported data and system parameters or zero parameter and carry out xor operation, and first memory module is stored operation result.Second computing module receives the computing output result of first memory module, with this computing output result and preset parameter or round key execution xor operation, carries out S box table lookup operation more then, and second memory module is stored operation result.The 3rd computing module receives the computing output result of second memory module, then this computing output result is carried out the ring shift left operation, carries out XOR again, and the 3rd memory module is stored operation result.If third level streamline is in the cipher key spreading pattern, the computing output result of the 3rd memory module storage should be sent to second computing module, is used to upgrade round key information.
The operation that first computing module in the first order streamline is carried out is relevant with mode of operation.If be in the cipher key spreading pattern, the input data type is an encryption key, and then the first computing module selective system parameter is carried out XOR, with MK 0, MK 1, MK 2, MK 3The expression encryption key, FK 0, FK 1, FK 2, FK 3The expression system parameters, then XOR output is expressed as ( K 0 , K 1 , K 2 , K 3 ) = ( MK 0 &CirclePlus; FK 0 , MK 1 &CirclePlus; FK 1 , MK 2 &CirclePlus; FK 2 , MK 3 &CirclePlus; FK 3 ) . If be in the encryption and decryption pattern; The input data type be expressly, ciphertext, then first computing module selects zero parameter to carry out XOR, though with the not variation of data of zero XOR; But make the computing module of winning under two kinds of mode of operations, have similar structure, thereby realize multiplexing.
The operation that second computing module in the streamline of the second level is carried out is relevant with mode of operation.If be in the encryption and decryption pattern, the data type of reception is the encryption and decryption intermediate data, is example with the ciphering process, uses X i, X I+1, X I+2, X I+3Expression expressly or carry out the encryption and decryption intermediate data of cryptographic calculation, rk iThe expression round key, A representes output, then second computing module selects round key to carry out XOR
Figure GSB00000617403100091
Again A is carried out the computing of tabling look-up of S box as input, obtain the S box operation result B that tables look-up, second memory module is stored B then.If be in the cipher key spreading pattern, the data type of reception is a round key expansion intermediate data, with K i, K I+1, K I+2, K I+3Expression round key expansion intermediate data, CK iThe expression preset parameter, A representes output, then second computing module selects preset parameter to carry out XOR
Figure GSB00000617403100092
And A carried out the computing of tabling look-up of S box as input, and the operation result B that obtains tabling look-up, second memory module is stored B then.Similarly, the parameter that second computing module uses in the different working pattern comprises round key and preset parameter, so need select to choose through data, has so both guaranteed the multiplexing of module to guarantee the realization of various functions again.
The operation that the 3rd computing module in the third level streamline is carried out is relevant with mode of operation.If be in the encryption and decryption pattern, the data type of reception is the encryption and decryption intermediate data, then the encryption and decryption intermediate data is carried out ring shift left and XOR C = B &CirclePlus; ( B < < < 2 ) &CirclePlus; ( B < < < 10 ) &CirclePlus; ( B < < < 18 ) &CirclePlus; ( B < < < 24 ) , And then carry out XOR The 3rd memory module is with the output X of XOR I+4Store.If be in the cipher key spreading pattern, the data type of reception is a round key expansion intermediate data, then round key expansion intermediate data is carried out ring shift left and XOR
Figure GSB00000617403100095
And then carry out XOR
Figure GSB00000617403100096
The 3rd memory module is with the output K of XOR I+4Store.
Pass through three class pipeline respectively when the input data, promptly accomplish iterative operation one time, third level streamline will be exported the result to computing and be sent to next iteration round of first order streamline entering, and this moment, mode of operation should remain unchanged, and the iteration round should increase progressively.Above-mentioned iterative process need circulate and carry out 32 times, could accomplish a cipher key spreading computing or encryption, decrypt operation.When the handled iteration round of third level streamline equals 32, then be not sent to first order streamline to computing output result, this moment if be in the encryption and decryption pattern then the 3rd memory module preserved the output result of encryption and decryption computing.And for the cipher key spreading pattern, the computing output result of the 3rd memory module storage has been updated to the round key parameter region of second computing module when iteration end each time.
Embodiment 2:
The encrypting and deciphering system of the realization SMS4 algorithm of present embodiment comprises: first order streamline, second level streamline, third level streamline; Fig. 3 is each module diagram of inside of three class pipeline; Wherein first order streamline comprises first computing module and first memory module; Second level streamline comprises second computing module and second memory module, and third level streamline comprises the 3rd computing module and the 3rd memory module.
The memory module of each level production line all comprises Control Parameter zone, input block territory and operational data zone, and wherein the Control Parameter zone is used for storing control parameter, and the input block territory is used for storage input data, and the operational data zone is used to store operational data; Control Parameter comprises mode of operation and iteration round; Each level production line can be in cipher key spreading pattern and encryption and decryption pattern; This is by the input data decision of first round; As if the input data is that encryption key then is in the cipher key spreading pattern, then is in the encryption and decryption pattern if the input data are plaintext or ciphertext.
First computing module, second computing module and the 3rd computing module comprise multiple implementation; First computing module comprises the first data alternative pack and the first XOR parts in the present embodiment; Second computing module comprises the second data alternative pack, the second XOR parts and S box parts, and the 3rd computing module comprises the 3rd data alternative pack, ring shift left parts and the 3rd XOR parts.
The first data alternative pack, the second data alternative pack and the 3rd data alternative pack all are the parts that are used for the selection of data, and the Control Parameter that receives in the data is obtained mode of operation and iteration round.The first XOR parts, the second XOR parts and the 3rd XOR parts all are the XORs that is used for data; Participate in the output result of the data division of XOR from data selector; For the different working pattern; The XOR parts are carried out identical operations, and data selector comes for the XOR parts accurate data to be provided according to mode of operation, thereby realize different calculation functions.The S box that S box parts are used to carry out encryption and decryption intermediate data or the round key expansion intermediate data computing of tabling look-up.The ring shift left parts are used for the input data are comprised the computing of ring shift left and XOR; The ring shift left parts are carried out the ring shift left computing of four kinds of band parameters earlier to the input data; The number of bits that this parameter representative moves to left is carried out xor operation to four kinds of ring shift left results again.
Fig. 4 moves towards sketch map for the signal in the first order streamline, and Fig. 5 moves towards sketch map for the signal in the streamline of the second level, and Fig. 6 moves towards sketch map for the signal in the third level streamline.
The course of work of the encrypting and deciphering system of the realization SMS4 algorithm of present embodiment 2 is following, and computing is then all described with ciphering process for encryption and decryption:
When cipher key spreading computing of carrying out when system or encryption and decryption computing sum are less than 3, can import new arithmetic operation to system.First order streamline receives the input data of first round; It is stored in the input block territory of the memory module of each level production line; And according to the input type of data confirm mode of operation, be stored in the Control Parameter zone, simultaneously the iteration round in the Control Parameter zone is set at 1.
First computing module in the first order streamline will be imported data and system parameters or zero parameter and carry out xor operation, and first memory module is stored operation result.Second computing module receives the computing output result of first memory module, with this computing output result and preset parameter or round key execution xor operation, carries out S box table lookup operation more then, and second memory module is stored operation result.The 3rd computing module receives the computing output result of second memory module, then this computing output result is carried out the ring shift left operation, carries out XOR again, and the 3rd memory module is stored operation result.If third level streamline is in the cipher key spreading pattern, the computing output result of the 3rd memory module storage should be sent to second computing module, is used to upgrade round key information.
First computing module in the first order streamline comprises the first data alternative pack and the first XOR parts; Wherein the first data alternative pack is selected its output according to the mode of operation that comprises in the Control Parameter; If be in then selective system parameter of cipher key spreading pattern, otherwise select zero parameter.The output result that the first XOR parts will be imported the data and the first data alternative pack carries out xor operation.When being in the cipher key spreading pattern, the input data type is an encryption key, this moment the first data alternative pack output system parameter, with MK 0, MK 1, MK 2, MK 3The expression encryption key, FK 0, FK 1, FK 2, FK 3The expression system parameters, then the computing of first XOR parts output is expressed as ( K 0 , K 1 , K 2 , K 3 ) = ( MK 0 &CirclePlus; FK 0 , MK 1 &CirclePlus; FK 1 , MK 2 &CirclePlus; FK 2 , MK 3 &CirclePlus; FK 3 ) . When being in the encryption and decryption pattern, the input data type be expressly, ciphertext, first data alternative pack output this moment, zero parameter, then the first XOR parts will be expressly, ciphertext and zero XOR, that is keep original data.Above-mentioned data are selected and the data operation process makes the computing module of winning under two kinds of mode of operations, have similar structure, thereby realize multiplexing.
Mode of operation is determined when first order streamline.After through the computing in the first order streamline, the operational data that is under the cipher key spreading pattern then is round key expansion intermediate data; The operational data that is under the encryption and decryption pattern then is the encryption and decryption intermediate data.
Second computing module in the streamline of the second level comprises the second data alternative pack, the second XOR parts and S box parts.Wherein the second data alternative pack is selected its output according to the mode of operation that comprises in the Control Parameter, if being in the cipher key spreading pattern then selects preset parameter, otherwise selects the round key of corresponding round according to the iteration round.The second XOR parts are carried out xor operation with the output result of the operational data and the second data alternative pack, and S box parts are carried out S box table lookup operation to the output result of the second XOR parts.When being in the encryption and decryption pattern, the data type of reception is the encryption and decryption intermediate data, is example with the ciphering process, and this moment, the second data alternative pack was exported the round key of corresponding round, used X i, X I+1, X I+2, X I+3Expression expressly or carry out the encryption and decryption intermediate data of cryptographic calculation, rk iThe expression round key, A representes output, then the second XOR parts are at first carried out XOR
Figure GSB00000617403100121
Again A is carried out the computing of tabling look-up of S box as input, obtain the S box operation result B that tables look-up, second memory module is stored B then.When being in the cipher key spreading pattern, the data type of reception is a round key expansion intermediate data, and second data alternative pack output this moment preset parameter is with K i, K I+1, K I+2, K I+3Expression round key expansion intermediate data, CK iThe expression preset parameter, A representes output, then second computing module selects preset parameter to carry out XOR
Figure GSB00000617403100122
And A carried out the computing of tabling look-up of S box as input, and the operation result B that obtains tabling look-up, second memory module is stored B then.Similarly, the parameter that second computing module uses in the different working pattern comprises round key and preset parameter, so need select to choose through data, has so both guaranteed the multiplexing of module to guarantee the realization of various functions again.
The 3rd computing module in the third level streamline comprises the 3rd data alternative pack, ring shift left parts and the 3rd XOR parts.Wherein the 3rd data alternative pack is selected its output according to the mode of operation that comprises in the Control Parameter, if be in the cipher key spreading pattern then select parameter 0,0,13,23}, otherwise select parameter 2,10,18,24}.The ring shift left parts are carried out ring shift left and xor operation to operational data; Earlier operational data is carried out the ring shift left computing of four kinds of band parameters; The number of bits that this parameter representative moves to left; Again four kinds of ring shift left results are carried out xor operation, and the parameter of ring shift left parts is from the output result of the 3rd data alternative pack.The output result that the 3rd XOR parts will be imported data and ring shift left parts carries out xor operation.When being in the encryption and decryption pattern, the data type of reception is the encryption and decryption intermediate data, this moment the 3rd data alternative pack output parameter 2,10,18,24}, the ring shift left parts will be carried out ring shift left and XOR to the encryption and decryption intermediate data C = B &CirclePlus; ( B < < < 2 ) &CirclePlus; ( B < < < 10 ) &CirclePlus; ( B < < < 18 ) &CirclePlus; ( B < < < 24 ) , And then carry out XOR
Figure GSB00000617403100132
The 3rd memory module is with the output X of XOR I+4Store.When being in the cipher key spreading pattern, the data type of reception is a round key expansion intermediate data, and { 0,0,13,23}, ring shift left parts will expand intermediate data to round key and carry out ring shift left and XOR the 3rd data alternative pack output parameter at this moment
Figure GSB00000617403100133
And then carry out XOR
Figure GSB00000617403100134
The 3rd memory module is with the output K of XOR I+4Store.Similarly, the 3rd computing module is selected one of two groups of parameters through data selector in the different working pattern, thereby changes the computing behavior of ring shift left parts, thereby realizes both having guaranteed the multiplexing of module to guarantee the realization of various functions again.
Pass through three class pipeline respectively when the input data, promptly accomplish iterative operation one time, third level streamline will be exported the result to computing and be sent to next iteration round of first order streamline entering, and this moment, mode of operation should remain unchanged, and the iteration round should increase progressively.Above-mentioned iterative process need circulate and carry out 32 times, could accomplish a cipher key spreading computing or encryption, decrypt operation.When the handled iteration round of third level streamline equals 32, then be not sent to first order streamline to computing output result, this moment if be in the encryption and decryption pattern then the 3rd memory module preserved the output result of encryption and decryption computing.And for the cipher key spreading pattern, the computing output result of the 3rd memory module storage has been updated to the round key parameter region of second computing module when iteration end each time.So as shown in Figure 6, the output of the 3rd memory module comprises that output result or intermediate object program or round key Update Information; Under the encryption and decryption pattern, the output of the 3rd memory module is intermediate object program all in the general computing, and the output of having only the iteration round to equal the 3rd memory module 32 o'clock this moments just is encryption and decryption output result; And under the cipher key spreading pattern, the output of general the 3rd memory module Updates Information as round key, i.e. the output result of round key extended arithmetic is updated to the round key parameter region of second computing module.
Because the present invention is the three class pipeline structure, can carry out computing to 3 groups of data simultaneously, improve operation efficiency.Because data processing time at different levels is different, might cause data at the corresponding levels completions of also being untreated, the data of upper level cause data collision with regard to getting into the corresponding levels.Further improvement as present embodiment; The encrypting and deciphering system of this realization SMS4 algorithm also comprises clock module; Clock module is sent to first memory module, second memory module and the 3rd memory module with the clock signal that produces, and three memory modules are all carried out the sampling and the storage operation result of data according to the clock signal that receives.Three memory modules all must receive new clock signal, can carry out stores synchronized to the upper level data.Clock signal plays the effect of unified work tempos at different levels, guarantees streamline co-ordination at different levels, makes that the system works effect is better.
The encrypting and deciphering system of realizing the SMS4 algorithm in the prior art is made up of encryption and decryption module and round key expansion module, and area occupied is 2S M+ 2S F+ 2S R, S wherein MBe data selector area, S FBe the area of round function F, S RArea for register.3 groups of data of every encryption, the time that is consumed is 3 * 32 * (T M+ T F+ T R), T wherein M, T F, T RRepresentative data is through the time of data selector, round function F and register respectively.And in this programme, system's area is about S M+ S F+ 5S R, 3 groups of times that data consumed of every encryption are 33 * (T M+ T F+ 3T R).And in the encrypting and deciphering system of realizing the SMS4 algorithm, round function all accounts for major part on the expense of area and time, i.e. S F>S M+ S R, T F>T M+ T RTherefore, technical scheme of the present invention reduces under the half the approximately situation in area overhead with respect to prior art, and time overhead has reduced 2/3.
Above-described embodiment of the present invention does not constitute the qualification to protection range of the present invention.Any modification of within spirit of the present invention and principle, being done, be equal to replacement and improvement etc., all should be included within the claim protection range of the present invention.

Claims (2)

1. an encrypting and deciphering system of realizing the SMS4 algorithm is characterized in that, comprising: first order streamline, second level streamline, third level streamline;
Said first order streamline comprises first computing module and first memory module; Said second level streamline comprises second computing module and second memory module; Said third level streamline comprises the 3rd computing module and the 3rd memory module;
The memory module of said each level production line all comprises Control Parameter zone, input block territory and operational data zone; Said Control Parameter zone is used for storing control parameter, and this Control Parameter is used to indicate mode of operation and iteration round; Said input block territory is used for storage input data, and said first order streamline receives the input data of corresponding round, and is stored in the input block territory of the memory module of each level production line; Said operational data zone is used to store operational data, and the computing output result of each level production line is stored in the operational data zone of the memory module of each level production line;
Said mode of operation comprises cipher key spreading pattern and encryption and decryption pattern; Said mode of operation is determined by the input data of first round, is that encryption key then is in the cipher key spreading pattern as if the input data, then is in the encryption and decryption pattern if the input data are plaintext or ciphertext;
Said first computing module will import data and systematic parameter based on said mode of operation or zero parameter is carried out xor operation, and the result is exported in computing is stored in said first memory module; Said second computing module receives the computing output result of first memory module; Based on mode of operation result and preset parameter or round key are exported in this computing then and carry out xor operation; Carry out S box table lookup operation again, and the result is exported in computing be stored in said second memory module; Said the 3rd computing module receives the computing output result of second memory module, based on mode of operation this computing output result is carried out the ring shift left operation then, carries out XOR again, and the result is exported in computing is stored in said the 3rd memory module;
Said first computing module comprises the first data alternative pack and the first XOR parts; The said first data alternative pack is used for the selection of data, and the foundation of selection is the mode of operation that comprises in the said Control Parameter; If be in cipher key spreading pattern, then selective system parameter; If be in the encryption and decryption pattern, then select zero parameter; The said first XOR parts are used for the output result of said input data and the said first data alternative pack is carried out xor operation;
Said second computing module comprises the second data alternative pack, the second XOR parts and S box parts; The said second data alternative pack is used for the selection of data, and it selects foundation is the mode of operation that comprises in the said Control Parameter; If be in the cipher key spreading pattern, then select preset parameter; If be in the encryption and decryption pattern, then select round key; Select said round key also according to the iteration round that comprises in the said Control Parameter; The said second XOR parts are used for the output result of said operational data and the said second data alternative pack is carried out xor operation; Said S box parts are used for the output result of the said second XOR parts is carried out S box table lookup operation;
Said the 3rd computing module comprises the 3rd data alternative pack, ring shift left parts and the 3rd XOR parts; Said the 3rd data alternative pack is used for the selection of data, and it selects foundation is the mode of operation that comprises in the Control Parameter; If be in the cipher key spreading pattern, then select parameter 0,0,13,23}; If be in the encryption and decryption pattern, then select parameter 2,10,18,24}; Said ring shift left parts are used for operational data is carried out ring shift left and xor operation; Said ring shift left parts are carried out the ring shift left computing of four kinds of band parameters earlier to operational data, the number of bits that said parameter representative moves to left is carried out xor operation to four kinds of ring shift left results again; The parameter of said ring shift left parts is from the output result of said the 3rd data alternative pack; Said the 3rd XOR parts are used for the output result of said input data and said ring shift left parts is carried out xor operation;
Said second computing module computing output result according to said the 3rd memory module storage when said third level streamline is in the cipher key spreading pattern upgrades round key;
Said third level streamline is sent to first order streamline to computing output result and gets into next iteration round, and the replication work pattern also increases progressively the iteration round; If said third level streamline is in last iteration round, then be not sent to first order streamline to computing output result; If this last iteration round is last the iteration round under the encryption and decryption pattern, then export the result to the computing of said third level streamline as the encryption and decryption operation result.
2. the encrypting and deciphering system of realization SMS4 algorithm according to claim 1; It is characterized in that; Also comprise the clock module that is used for clocking; Said clock module is sent to said first memory module, said second memory module and said the 3rd memory module with the clock signal that produces, and said first memory module, said second memory module and said the 3rd memory module are all carried out the storage of data according to the clock signal that receives.
CN2009101933081A 2009-10-26 2009-10-26 Encrypting and deciphering system for realizing SMS4 algorithm Expired - Fee Related CN101764685B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2009101933081A CN101764685B (en) 2009-10-26 2009-10-26 Encrypting and deciphering system for realizing SMS4 algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2009101933081A CN101764685B (en) 2009-10-26 2009-10-26 Encrypting and deciphering system for realizing SMS4 algorithm

Publications (2)

Publication Number Publication Date
CN101764685A CN101764685A (en) 2010-06-30
CN101764685B true CN101764685B (en) 2012-02-08

Family

ID=42495682

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2009101933081A Expired - Fee Related CN101764685B (en) 2009-10-26 2009-10-26 Encrypting and deciphering system for realizing SMS4 algorithm

Country Status (1)

Country Link
CN (1) CN101764685B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102111263A (en) * 2011-02-21 2011-06-29 山东中孚信息产业股份有限公司 Data stream encryption method
CN102567281B (en) * 2011-12-16 2014-10-15 北京大学深圳研究生院 Reconfigurable scheduling operator array structure, integrated circuit (IC) array structure and control module
CN103513961B (en) * 2012-06-18 2017-07-11 中兴通讯股份有限公司 On-chip buffering method and device
CN103516684B (en) * 2012-06-26 2017-11-17 中兴通讯股份有限公司 A kind of method and device handled packet
US9361106B2 (en) * 2013-12-27 2016-06-07 Intel Corporation SMS4 acceleration processors, methods, systems, and instructions
US9513913B2 (en) 2014-07-22 2016-12-06 Intel Corporation SM4 acceleration processors, methods, systems, and instructions
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
US9467279B2 (en) 2014-09-26 2016-10-11 Intel Corporation Instructions and logic to provide SIMD SM4 cryptographic block cipher functionality
CN105049194B (en) * 2015-06-01 2018-05-08 北京时代民芯科技有限公司 A kind of SM4 algorithms of pipeline organization realize system
CN110071927B (en) * 2019-04-28 2021-09-14 苏州国芯科技股份有限公司 Information encryption method, system and related components
CN113672946A (en) * 2021-07-15 2021-11-19 平头哥(上海)半导体技术有限公司 Data encryption and decryption component, related device and method

Also Published As

Publication number Publication date
CN101764685A (en) 2010-06-30

Similar Documents

Publication Publication Date Title
CN101764685B (en) Encrypting and deciphering system for realizing SMS4 algorithm
CN101764684B (en) Encrypting and deciphering system for realizing SMS4 algorithm
CN102025484B (en) Block cipher encryption and decryption method
CN105490802B (en) The parallel encryption and decryption communication means of improvement SM4 based on GPU
CN101626289B (en) Design method of AES encryption chip and computer encryptor
CN101350714B (en) Efficient advanced encryption standard (AES) data path using hybrid RIJNDAEL S-BOX
CN104639314A (en) Device based on AES (advanced encryption standard) encryption/decryption algorithm and pipelining control method
CN1921382B (en) Encrypting-decrypting method based on AES algorithm and encrypting-decrypting device
CN105049194B (en) A kind of SM4 algorithms of pipeline organization realize system
US7561689B2 (en) Generating keys having one of a number of key sizes
CN103503362B (en) Data processing equipment, data processing method and program
WO2003100751A1 (en) Data conversion device and data conversion method
CN106034021B (en) Lightweight dual-mode compatible AES encryption and decryption module and method thereof
CN104852798B (en) A kind of data encrypting and deciphering system and method
CN101848081A (en) S box and construction method thereof
CN105916141B (en) A kind of realization system and method for self synchronous Zu Chongzhi&#39;s enciphering and deciphering algorithm
CN110311771A (en) SM4 encipher-decipher method and circuit
Priyanka et al. FPGA implementation of image encryption and decryption using AES 128-bit core
CN103731822A (en) System and method for achieving ZUC
CN109033892A (en) Round transformation multiplex circuit and AES based on composite matrix decrypt circuit
CN101431405A (en) DES encrypted circuit and method thereof and its hardware circuit implementing method
CN104219045B (en) RC4 stream cipher generators
JP2002040932A (en) Ciphering device using standard algorithm for ciphering data
CN103209071B (en) Aes encryption device
CN102780557B (en) Method and device for AES (advanced encryption standard) encryption/decryption with selection gate optimization

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20120208

Termination date: 20201026

CF01 Termination of patent right due to non-payment of annual fee