The invention is generally related to an encryption/decryption device based on the advanced encryption standard (AES), and more particularly it is related to an encryption/decryption device that verifies whether the advanced encryption standard is executed correctly.
In cryptography, the term “encryption” refers to a process of changing plaintext into incomprehensible ciphertext to protect its content. Only a device having a decryption method can restore the ciphertext to normal readable content through a decryption process. Ideally, only authorized personnel can read the information conveyed by the ciphertext. Encryption itself cannot prevent the interception of transmitted information, but it can prevent the interceptor from understanding the content of the information.
In order to prevent the encryption/decryption device from being attacked and causing ciphertext leakage, it is necessary to verify the correctness of each encryption step and decryption step to ensure the security of the encryption/decryption device.
The present invention proposes an encryption/decryption device having a verification mechanism, which is suitable for any implementation of byte replacement transformation. Although there are many ways to implement byte replacement transformation or inverse byte replacement transformation, the verification mechanism of the encryption/decryption device of the present invention can detect whether an error occurs in the operation when the input value of the multiplicative inverse element (Multiplicative Inverse) is 0x0, and detect whether an error occurs in the binary field multiplication operation in the mixed row operation and the inverse mix row operation. In addition, the verification mechanism proposed by the present invention can also protect the encryption procedure and the decryption procedure to ensure the security of the encrypted/decrypted data.
In an embodiment, an encryption/decryption device comprises a SubBytes/InvSubBytes unit, a MixColumns/InvMixColumns unit, an addroundkey unit, a first verification unit, and a controller. The SubBytes/InvSubBytes unit performs a transformation on an input state array to generate an output state array. The MixColumns/InvMixColumns unit performs a mix column operation/inverse mix column operation on the output state array to generate a mix-column/inverse mix-column array. The mix column/inverse mix column operation comprises a multiplication operation. The addroundkey unit performs a binary field addition operation on the mix-column/inverse mix-column array and a round key to generate result data. The first verification unit determines whether the output state array and the mix-column/inverse mix-column array meet a mapping relationship to generate a first verification signal. The controller determines whether the binary field multiplication operation performed by the MixColumns/InvMixColumns unit is correct based on the first verification signal.
In another embodiment, an encryption/decryption device comprises a SubBytes/InvSubBytes unit, a MixColumns/InvMixColumns unit, an addroundkey unit, a second verification unit, and a controller. The SubBytes/InvSubBytes unit performs a transformation on an input state array to generate an output state array. The MixColumns/InvMixColumns unit performs a mix column operation/inverse mix column operation on the output state array to generate a mix-column/inverse mix-column array. The addroundkey unit performs a binary field addition operation on the mix-column/inverse mix-column array and a round key to generate result data. The second verification unit verifies a mapping relationship between the input state array and the output state array to generate a second verification signal. The controller determines whether the transformation performed by the SubBytes/InvSubBytes unit is correct based on the second verification signal.
In another embodiment, an encryption/decryption device comprises a SubBytes/InvSubBytes unit, a MixColumns/InvMixColumns unit, an addroundkey unit, a third verification unit, and a controller. The SubBytes/InvSubBytes unit performs a transformation on an input state array to generate an output state array. The MixColumns/InvMixColumns unit performs a mix column operation/inverse mix column operation on the output state array to generate a mix-column/inverse mix-column array. The addroundkey unit performs a binary field addition operation on the mix-column/inverse mix-column array and a round key to generate result data. The third verification unit verifies a mapping relationship between the result data and the output state array to generate a third verification signal. The controller determines whether the mix column operation/inverse mix column operation performed by the MixColumns/InvMixColumns unit and the binary field addition operation are correct based on the third verification signal.
A detailed description is given in the following embodiments with reference to the accompanying drawings.
The invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:
with an embodiment of the present invention;
The following description is made for the purpose of illustrating the general principles of the disclosure and should not be taken in a limiting sense. The scope of the disclosure is determined by reference to the appended claims.
In the following detailed description, for purposes of explanation, numerous specific details and embodiments are set forth in order to provide a thorough understanding of the present disclosure. The use of like and/or corresponding numerals in the drawings of different embodiments does not suggest any correlation between different embodiments.
In addition, in some embodiments of the present disclosure, terms concerning attachments, coupling and the like, such as “connected” and “interconnected,” refer to a relationship wherein structures are secured or attached to one another either directly or indirectly (for example, electrically connection) via intervening structures, as well as both movable or rigid attachments or relationships, unless expressly described otherwise.
In addition, in this specification, relative spatial expressions are used. For example, “lower”, “bottom”, “higher” or “top” are used to describe the position of one element relative to another. It should be appreciated that if a device is flipped upside down, an element that is “lower” will become an element that is “higher”.
It should be understood that, although the terms first, second, third etc. may be used herein to describe various elements, components, regions, layers, portions and/or sections, these elements, components, regions, layers, portions and/or sections should not be limited by these terms. These terms are only used to distinguish one element, component, region, layer, portion or section from another element, component, region, layer or section. Thus, a first element, component, region, layer, portion or section in the specification could be termed a second element, component, region, layer, portion or section in the claims without departing from the teachings of the present disclosure.
It should be understood that this description of the exemplary embodiments is intended to be read in connection with the accompanying drawings, which are to be considered part of the entire written description. The drawings are not drawn to scale. In addition, structures and devices are shown schematically in order to simplify the drawing.
The terms “approximately”, “about” and “substantially” typically mean a value is within a range of +/−20% of the stated value, more typically a range of +/−10%, +/−5%, +/″3%, +/″2%, +/″1% or +/″0.5% of the stated value. The stated value of the present disclosure is an approximate value. Even there is no specific description, the stated value still includes the meaning of “approximately”, “about” or “substantially”.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs. It should be appreciated that, in each case, the term, which is defined in a commonly used dictionary, should be interpreted as having a meaning that conforms to the relative skills of the present disclosure and the background or the context of the present disclosure, and should not be interpreted in an idealized or overly formal manner unless so defined.
In addition, in some embodiments of the present disclosure, terms concerning attachments, coupling and the like, such as “connected” and “interconnected,” refer to a relationship wherein structures are secured or attached to one another either directly or indirectly (for example, electrically connection) via intervening structures, as well as both movable or rigid attachments or relationships, unless expressly described otherwise.
In the drawings, similar elements and/or features may have the same reference number. Various components of the same type can be distinguished by adding letters or numbers after the component symbol to distinguish similar components and/or similar features.
According to some embodiments of the present invention, the encryption/decryption circuit 140 uses the advanced encryption standard (AES) to perform an encryption procedure or a decryption procedure on the input data DIN to generate the encrypted/decrypted data DOUT. As shown in
As shown in
According to an embodiment of the present invention, when the input data DIN has just been input to the encryption/decryption circuit 140, the second multiplexer MUX1 provides the input data DIN to the addroundkey unit 147, so that the addroundkey unit 147 performs a binary field addition operation on the input data DIN and the round key RK to generate the result data ARK, and the generated result data ARK is provided to the ShiftRow/InvShiftRow unit 143. According to an embodiment of the present invention, when the addroundkey unit 147 performs a binary field addition operation on the input data DIN and the round key RK, the addroundkey unit 147 performs the exclusive-OR operation on the input data DIN and the round key RK to generate the result data ARK.
The ShiftRow/InvShiftRow unit 143 performs a circular shift on each row in the result data ARK to generate the shift data SR. The register 144 temporarily stores the shift data SR, and provides the shift data SR as the input status array SBI/ISBI to the SubbBytes/InvSubBytes unit 145. The SubbBytes/InvSubBytes unit 145 converts the input state array SBI/ISBI to generate the output state array SBO/ISBO.
According to an embodiment of the present invention, when the encryption/decryption circuit 140 performs the encryption procedure, the SubbBytes/InvSubBytes unit 145 performs byte replacement transformation on the input state array SBI to generate an output state array SBO. According to another embodiment of the present invention, when the encryption/decryption circuit 140 performs the decryption procedure, the SubbBytes/InvSubBytes unit 145 performs inverse byte replacement transformation on the input state array ISBI to generate the output state array ISBO. According to some embodiments of the present invention, the byte replacement transformation and the inverse byte replacement transformation are inverse functions of each other, and the byte replacement transformation and the inverse byte replacement transformation each includes a linear transformation and a non-linear transformation.
According to an embodiment of the present invention, when the encryption/decryption circuit 140 in
According to another embodiment of the present invention, when the encryption/decryption circuit 140 in
According to some embodiments of the present invention, since the SubbBytes/InvSubBytes unit 200 shares the most complex multiplicative inverse unit 220 in the encryption procedure and the decryption procedure, the input state array and output state array of the encryption procedure are marked SBI and SBO respectively and the input state array and output state array of the decryption procedure are marked ISBI and ISBO respectively in the following explanation and description.
Referring to
In order to ensure the correctness of the encryption and decryption procedures executed by the encryption/decryption circuit 140 and to protect the key from the differential fault analysis (DFA) method, the encryption/decryption circuit 140 needs a powerful countermeasure to detect the occurrence of errors.
As shown in
The inverse affine transformation (i.e., AT−1) is performed on both sides of the equal sign of Eq. 1 to obtain Eq. 2.
Next, the left and right sides of the equal sign of Eq. 2 are both multiplied by the input state array SBI[7:0] to obtain Eq. 3.
According to an embodiment of the present invention, when the input state array SBI[7:0] is 0x0, result the binary field multiplication operation must be 0x0. According to another embodiment of the present invention, when the input state array SBI[7:0] is not 0x0, the result of the binary field multiplication operation must be 0x1. However, when the input state array SBI [7:0] is 0x0, no matter the attacker inserts any fault value into AT−1(SBO[7:0]), Eq. 3 is always true. In other words, Eq. 3 cannot detect the operation error that occurs when the input status array SBI[7:0] is 0x0.
In order to overcome the above shortcomings, when the input status array SBI[7:0] is 0x0, the output status array SBO[7:0] is set to 0x63 according to a lookup table. Therefore, we can modify the detection method of Eq. 3 to determine whether the input status array SBI[7:0] is 0x0. When the input status array SBI[7:0] is 0x0, it is determined whether the output status array SBO[7:0] is 0x63. When the output status array SBO[7:0] is 0x63, it means that the operation of the SubbBytes/InvSubBytes unit 200 is correct. When the output status array SBO[7:0] is not 0x63, it means that the operation of the SubbBytes/InvSubBytes unit 200 is incorrect.
When the input status array SBI[7:0] is not 0x0, determine whether the product of AT−1(SBO[7:0]) and the input status array SBI[7:0] is 0x1. When the product of AT−1(SBO[7:0]) and the input state array SBI[7:0] is 0x1, it indicates that the operation of the SubbBytes/InvSubBytes unit 200 is correct. When the product of AT−1(SBO[7:0]) and the input state array SBI[7:0] is not 0x1, it indicates that the operation of the SubbBytes/InvSubBytes unit 200 incorrect.
The above judgment can be described as Eq. 4, where Eq. 4 is as follows:
Among them, the question mark (i.e.,?) and colon (i.e.,: ) in Eq. 4 are combined into a ternary operator. The formula on the left side of the question mark is the condition of the ternary operator, and the equation on the right side is the corresponding result of whether the condition of the ternary operator is established or not. When the condition is met, the equation on the left side of the colon is returned as the result. When the condition is not met, the equation on the right side of the colon is returned as the result. Therefore, when the input state array SBI[7:0] is 0x0, Eq. 4 returns the result of whether the output state array SBO[7:0] is equal to 0x63. When the input state array SBI[7:0] is not 0x0, the result of whether the result of the binary field multiplication operation is equal to 0x1 is returned. Therefore, Eq. 4 can be used to detect whether an error occurs in the operation of the SubbBytes/InvSubBytes unit 200 during the encryption procedure.
As shown in
Both sides of the equal sign of Eq. 5 are multiplied by AT−1(ISBI[7:0]) to obtain Eq. 6.
When the input state array ISBI[7:0] is 0x63, the result of the binary field multiplication operation must be 0x0, otherwise it must be 0x1. In addition, this patent learns from
As shown in Eq. 7, when the input status array ISBI[7:0] is 0x63, the comparison result of whether the output status array ISBO[7:0] is equal to 0x0 is returned. On the contrary, the returned result of whether the binary field multiplication operation result is equal to 0x1. Therefore, Eq. 7 can be used to detect whether an error occurs in the transformation operation of the SubbBytes/InvSubBytes unit 200 during the decryption procedure.
In other words, whether an error occurs in the transformation operation of the SubbBytes/InvSubBytes unit 145 in
It is assumed that the inverse element INV[127:0], the round key RK[127:0], and the result data ARK[127:0] generated by the multiplicative inverse unit 220 in
The 4 bytes of the inverse element INV[127:0] (i.e., I0, I1, I2, I3) perform three binary field addition operations (i.e., exclusive-OR operation) to form a simplified inverse element INVXi[7:0] is shown in Eq. 9.
Eq. 10 performs three binary field addition operations on the 4 bytes of the round key RK[127:0] (i.e. R0, R1, R2, R3) to form a simplified round key RKXi[7:0].
Eq. 11 performs three iterations of binary field addition operations on the 4 bytes of the result data ARK[127:0] (i.e., A0, A1, A2, A3) to form the simplified result data ARKXi[7:0].
The affine transformation performed by the affine transformation unit 230 in
The simplified result data ARKXi[7:0] is as shown in Eq. 13.
Eq. 9 and Eq. 10 are substituted into Eq. 13 to obtain Eq. 14.
It is assumed that the variable MMI0 is the output byte of the affine transformation (i.e., the input byte of the MixColumns/InvMixColumns unit 146), as shown in Eq. 15.
In order to optimize software performance or hardware area, the binary field multiplied-by-2 operation will first perform a left shift on the multiplicand MMI0. If the most significant bit of MMI0 (i.e. MSB) is 0x1, then an irreducible polynomial (i.e. 0x11B) is used to get the remainder, as shown in Eq. 16.
As for the simplest method of the binary field multiplied-by-3 operation in Eq. 12, the result of the binary field multiplied-by-2 operation is added to MMI0, as shown in Eq. 17.
When the attacker can insert an error value Er into the binary field multiplied-by-2 operation, as shown in Eq. 18.
This will also cause an error value Er to be inserted into the result of the binary field multiplied-by-3 operation, as shown in Eq. 19.
According to Eq. 12, the above two error values Er will be accumulated to A0 and A3, thereby forming the variables A0′ and A3′ of Eq. 20.
When Eq. 14 is executed, the actual value of the information redundancy mechanism (i.e., ARKXi′) will cancel two error values Er, making the actual value equal to the estimated value (i.e., MM(INVXi)⊕RKXi), As shown in Eq. 21.
As shown in Eq. 21, since the two error values Er will cancel each other after the binary field addition operation, an effective verification method is needed to facilitate to detect the error in the binary field multiplied-by-2 operation.
In the encryption procedure, the output state array SBO generated by the byte replacement transformation of the SubbBytes/InvSubBytes unit 145 is as shown in Eq. 22.
Since the MixColumns/InvMixColumns unit 146 performs the mix column operation in 32-bit as a unit, SBO[127:0] of Eq. 22 is represented as being divided four sets of 32 bits. Eq. 23 performs three iterations of the binary field addition operations on SBO0, SBO1, SBO2 and SBO3 to generate a simplified output state array SBOXi[7:0].
As shown in
Finally, through the optimization procedure of Eq. 23, we can know that the simplified output state array SBOXi[7:0] is equal to MM (INVXi). The result of Eq. 23 is put into Eq. 14 to form Eq. 24. In addition, errors occurring in the mix column operation performed by the MixColumns/InvMixColumns unit 146 and the transformation performed by the addroundkey unit 147 can be detected through Eq. 24.
On the other hand, in the decryption procedure, the output state array ISBO generated by the inverse byte replacement transformation of the SubbBytes/InvSubBytes unit 145 is as shown in Eq. 25.
Since the MixColumns/InvMixColumns unit 146 performs inverse mix column operation in 32-bit as a unit, the ISBO[127:0] of Eq. 25 is divided into four 32-bit units. Eq. 26 performs three iterations of the binary field addition operations on ISBO0, ISBO1,ISBO2, and ISBO3 (i.e., Z0⊕Z1⊕Z2⊕Z3) to generate a simplified output state array ISBOXi[7:0].
Next, the inverse mix column operation performed by the MixColumns/InvMixColumns unit 146 is shown in Eq. 27.
It is known from Eq. 11 that the result of adding up A0, A1, A2, and A3 of Eq. 27 is equal to the simplified result data ARKXi[7:0], as shown in Eq. 28. The simplified result data ARKXi will be equal to the sum of the four output bytes of the simplified output state array ISBOXi[7:0] (i.e., ISBOXi=Z0⊕Z1⊕Z2⊕Z3) plus the sum of each byte of the simplified round key RKXi[7:0] (i.e., RKXi=R0⊕R1⊕R2⊕R3) shown in Eq. 10.
Therefore, Eq. 28 can detect errors in the inverse mix column operation performed by the MixColumns/InvMixColumns unit 146 and the transformation performed by the addroundkey unit 147.
In order to detect whether the binary field multiplied-by-2 operation, the binary field multiplied-by-4 operation, and the binary field multiplied-by-8 operation of the mix column operation/inverse mix column operation performed by the MixColumns/InvMixColumns unit 146 are correct, the binary filed multiplied-by-2 operation is shown in Eq. 29.
It is assumed that the multiplied-by-2 array MX2 is the result of performing the binary field multiplied-by-2 operation on the multiplicand array M. For optimization, the binary field multiplied-by-2 operation will first perform a left shift on the multiplicand array M. If the most significant bit of the multiplicand array M (i.e., M[7]) is 0x1, the irreducible polynomial (i.e., 0x11B) is used to take the remainder. Therefore, the multiplier array MX2 can be simplified to a value consisting only of the bits of the multiplicand array M, as shown in Eq. 29.
Among them, {9{MX2[7]}} in Eq. 29 refers to the 8th bit (that is, the most significant bit) of the multiplication-by-two array MX2 repeating 9 bits. In other words, {9{MX2[7]}} is equal to {MX2[7], MX2[7], MX2[7], MX2[7], MX2[7], MX [7], MX2[7], MX2[7], MX2[7]}. For the convenience of subsequent explanation, MUL2( ) is used below to represent the binary field multiplied-by-2 operation, as shown in Eq. 30.
As shown in Eq. 30, each bit of the multiplier array MX2 can be expressed as the bits of the multiplicand array M. In other words, each bit of the multiplicand array M can also be expressed as the bits of the multiplied by two array MX2.
First, in Eq. 31, the corresponding relationship between the value of the multiplicand array M and the value of the multiplier array MX2 is found out, which belongs to the part of one-to-one transformation. At this time we can know that the 7th, 6th, 5th, 2nd, and 8th bits of the multiplicand array M correspond to the 8th, 7th, 6th, 3rd, and 1st bits of the multiplier array MX2 respectively.
Next, the bits of the known multiplicand array M are brought into the non-one-to-one-transformation bits of Eq. 30 to obtain the bits of the remaining unknown multiplicand array M. From Eq. 30, we know MX2[4]=(M[3]⊕M[7]). Add M[7] to both sides of the equal sign to get M[3]=(MX2[4]⊕M[7]), as shown in Eq. 32.
M[2] is shown in Eq. 33.
M[0] is as shown in Eq. 34.
DIV2( ) represents the binary field divide-by-2 operation. Eq. 35 expresses each bit of DIV2(MX2) by the bits of the multiplied-by-2 array MX2 (that is, performing the divide-by-2 operation on the multiplied-by-2 array MX2).
In other words, Eq. 35 can be configured to detect whether the result of the binary field multiplied-by-2 operation (i.e., the binary field multiplied-by-2 array MX2) is correct.
It is assumed that the multiplied-by-4 array MX4 is the result of performing the multiplied-by-4 operation on the binary field multiplicand array M. As shown in Eq. 36, the multiplied-by-four array MX4 is the result of the multiplied-by-two array MX2 through MUL2( ) where MUL2( ) represents the binary field multiplied-by-2 operation.
Next, it is assumed that the multiplied-by-8 array MX8 is the result of performing the binary field multiplied-by-8 operation on the multiplicand array M. As shown in Eq. 37, the multiplied-by-8 array MX8 is the result of the four-array MX4 through MUL2( ) as shown in Eq. 37.
As shown in Eq. 38, the multiplied-by-8 array MX8 through DIV2( ) can obtain the value of the multiplied-by-4 array MX4.
In the same way, as shown in Eq. 39, the multiplied-by-4 array MX4 through DIV2( ) can obtain the value of the multiplied-by-2 array MX2.
In other words, whether the binary field multiplied-by-2 operation, the binary field multiplied-by-4 operation, and the binary field multiplied-by-8 operation are correct can be checked by Eq. 35, Eq. 38, and Eq. 39, as shown in Eq. 40.
The first divide-by-2 circuit 301 performs a divide-by-2 operation on the multiplied-by-2 array MX2 to generate a first result DIV2(MX2). The second divide-by-2 circuit 302 performs a divide-by-2 operation on the multiplied-by-4 array MX4 to generate a second result DIV2(MX4). The third divide-by-2 circuit 303 performs a divide-by-2 operation on the multiplied-by-8 array MX8 to generate a third result DIV2(MX8).
The first comparator CMP1 compares the multiplicand array M with the first result DIV2(MX2) to generate a first comparison result CM1. When the multiplicand array M and the first result DIV2(MX2) are equal, the first comparison result CM1 is the first logic level.
The second comparator CMP2 compares the multiplied-by-2 array MX2 and the second result DIV2 (MX4) to generate a second comparison result CM2. When the multiplied-by-2 array MX2 is equal to the second result DIV2 (MX4), the second comparison result CM2 is the first logic level.
The third comparator CMP3 compares the multiplied-by-4 array MX4 and the third result DIV2(MX8) to generate a third comparison result CM3. When the multiplied-by-4 array MX4 is equal to the third result DIV2(MX8), the third comparison result CM3 is the first logic level.
According to an embodiment of the present invention, when the first comparison result CM1, the second comparison result CM2, and the third comparison result CM3 are all the first logic level, the logic gate LG outputs the first verify signal VF1 at the first logic level. According to other embodiments of the present invention, when at least one of the first comparison result CM1, the second comparison result CM2, and the third comparison result CM3 is not at the first logic level, the first verification signal VF1 is not at the first logic level.
As shown in
The divide-by-2 circuit 400 takes the sixth bit IN[5] of the input array as the fifth bit OUT[4] of the output array; the first exclusive OR gate XOR1 of the divide-by-2 circuit 400 performs a mutually exclusive OR operation on the fifth bit IN[4] and the first bit IN[0] of the input array to obtain the fourth bit OUT[3] of the output array; the second exclusive-OR gate XOR2 of the divide-by-2 circuit 400 performs an exclusive-OR operation on the fourth bit IN[3] of the input array and the first bit IN [0] of the input array to obtain the third bit OUT[2] of the output array.
The divide-by-2 circuit 400 takes the third bit IN[2] of the input array as the second bit OUT[1] of the output array; the third exclusive-OR gate XOR3 of the divide-by-2 circuit 400 performs a mutually exclusive OR operation on the second bit IN[1] of the input array and the first bit IN[0] of the input array to obtain the first bit OUT[0] (i.e., the least significant bit) of the output array.
According to some embodiments of the present invention, Eq. 4 and Eq. 7 can be optimized. The first predetermined value CI[7:0] may be composed of the first value V1 and 0x0, as shown in Eq. 41.
The second predetermined value CO[7:0] may be composed of the second value V2 and 0x0, as shown in Eq. 42, in which the second value V2 is the inverse of the first value V1.
According to an embodiment of the present invention, when the encryption/decryption circuit 140 in
Next, as shown in
As shown in Eq. 43, when the second value V2 is 0x1, the first selection array SEL1 is the input state array SI; when the second value V2 is 0x0, the first selection array SEL1 is the output state array SO. In other words, when the encryption/decryption circuit 140 performs the encryption procedure, the second value V2 is 0x1, and the first selection array SEL1 is the input state array SI; when the encryption/decryption circuit 140 performs the decryption procedure, the second value V2 is 0x0, and the first selection array SEL1 is the output state array SO.
As shown in Eq. 44, when the second value V2 is 0x1, the second selection array SEL2 is the output state array SO; when the second value V2 is 0x0, the second selection array SEL2 is the input state array SI. In other words, when the encryption/decryption circuit 140 performs the encryption procedure, the second value V2 is 0x1, and the second selection array SEL2 is the output state array SO; when the encryption/decryption circuit 140 performs the decryption procedure, the second value V2 is 0x0, the second selection array SEL2 is the input status array SI.
According to Eq. 41 to Eq. 44, Eq. 4 and Eq. 7 can be optimized as Eq. 45.
Comparing Eq. 45 with Eq. 4 and Eq. 7, the encryption procedure and the decryption procedure can share the same binary field multiplier and the InvAffine transformation unit, thereby saving one binary field multiplier and one InvAffine transformation unit.
As shown in
The first value generator 501 is configured to execute Eq. 41 to generate a first predetermined value CI, in which the bits from the most significant bit to the least significant bit of the first predetermined value CI are 0x0, the first value V1, the first value V1, 0x0, 0x0, 0x0, a first value V1, and a first value V1 in sequence. The second value generator 502 is configured to execute Eq. 42 to generate a second predetermined value CO, in which the bits from the most significant bit to the least significant bit of the second predetermined value CO are 0x0, the second value V2, the second value V2, 0x0, 0x0, 0x0, the second value V2, and the second value V2 in sequence.
The fourth comparator CMP4 determines whether the input state array SI and the first predetermined value CI are equal to generate a fourth comparison result CM4. When the input state array SI is equal to the first predetermined value CI, the fourth comparison result CM4 is at the first logic level. The fifth comparator CMP5 compares the output state array SO with the second predetermined value CO to generate a fifth comparison result CM5. When the output state array SO is equal to the second predetermined value CO, the fifth comparison result CM5 is at the first logic level.
The fifth multiplexer MUX4 performs Eq. 43 and selects the input state array SI or the output state array SO as the first selection array SEL1 based on the second value V2. According to an embodiment of the present invention, when the encryption/decryption circuit 140 in
The sixth multiplexer MUX5 executes Eq. 44 and selects the input state array SI or the output state array SO as the second selection array SEL2 based on the second value V2. According to an embodiment of the present invention, when the encryption/decryption circuit 140 in
The InvAffine transformation unit 503 performs the inverse affine transformation (i.e., AT−1) on the second selection array SEL2 to generate a fourth result R4. The multiplier 504 multiplies the first selection array SEL1 by the fourth result R4 to generate a fifth result R5. The sixth comparator CMP6 compares the fifth result R5 and 0x1 to generate a sixth comparison result CM6. When the fifth result R5 is equal to 0x1, the sixth comparison result CM6 is the first logic level.
Based on the fourth comparison result CM4, the sixth multiplexer MUX6 outputs the fifth comparison result CM5 or the sixth comparison result CM6 as the second verification signal VF2. According to an embodiment of the present invention, when the second verification signal VF2 is at the first logic level, it indicates that the byte replacement transformation or inverse byte replacement transformation performed by the SubbBytes/InvSubBytes unit 145 in
Eq. 24 can detect errors in the mix column operation performed by the MixColumns/InvMixColumns unit 146 and the transformation performed by the addroundkey unit 147, and Eq. 28 can detect errors that occur in the mix column/inverse mix column operation performed by the MixColumns/InvMixColumns unit 146 and the transformation performed by the addroundkey unit 147, in which Eq. 24 and Eq. 28 can be optimized into Eq. 46.
As shown in
The first byte dividing device 601 divides the output state array SO (including SBO and ISBO) into bytes to generate divided output state arrays SO[7:0], SO[15:8], SO[23:16], SO[31:24]. The second byte dividing device 602 divides the round key RK into bytes to generate divided round keys RK[7:0], RK[15:8], RK[23:16], RK[31:24]. The third byte dividing device 603 divides the result data ARK into bytes to generate divided result data ARK[7:0], ARK[15:8], ARK[23:16], ARK[31:24].
The first logical operation unit 604 performs the exclusive-OR operation on the divided output state arrays SO[7:0], SO[15:8], SO[23:16], SO[31:24] to generate simplified output status array SBOXi[7:0]. The second logic operation unit 605 performs the exclusive-OR operation on the divided round keys RK[7:0], RK[15:8], RK[23:16], and RK[31:24] to generate a simplified round key RKXi[7:0]. The third logic operation unit 606 performs an exclusive-OR operation on the divided result data ARK[7:0], ARK[15:8], ARK[23:16], and ARK[31:24] to generate simplified result data ARKXi[7:0].
The fourth logic operation unit 607 performs the exclusive-OR operation on the simplified output state array SBOXi[7:0] and the simplified round key RKXi[7:0] to generate a sixth result R6. The seventh comparator CMP7 compares the sixth result R6 and the simplified result data ARKXi[7:0] to generate the third verification signal VF3.
According to an embodiment of the present invention, the first verification unit 701 corresponds to the first verification unit 300 in
According to an embodiment of the present invention, the second verification unit 702 corresponds to the second verification unit 500 in
According to an embodiment of the present invention, the third verification unit 703 corresponds to the third verification unit 600 in
The present invention proposes an encryption/decryption device having a verification mechanism, which is suitable for any implementation of byte replacement transformation. Although there are many ways to implement byte replacement transformation or inverse byte replacement transformation, the verification mechanism of the encryption/decryption device of the present invention can detect whether an error occurs in the operation when the input value of the multiplicative inverse element (Multiplicative Inverse) is 0x0, and detect whether an error occurs in the binary field multiplication operation in the mixed row operation and the inverse mix row operation. In addition, the verification mechanism proposed by the present invention can also protect the encryption procedure and the decryption procedure to ensure the security of the encrypted/decrypted data.
Although some embodiments of the present disclosure and their advantages have been described in detail, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the disclosure as defined by the appended claims. For example, it will be readily understood by those skilled in the art that many of the features, functions, processes, and materials described herein may be varied while remaining within the scope of the present disclosure. Moreover, the scope of the present application is not intended to be limited to the particular embodiments of the process, machine, manufacture, composition of matter, means, methods and steps described in the specification. As one of ordinary skill in the art will readily appreciate from the disclosure of the present disclosure, processes, machines, manufacture, compositions of matter, means, methods, or steps, presently existing or later to be developed, that perform substantially the same function or achieve substantially the same result as the corresponding embodiments described herein may be utilized according to the present disclosure. Accordingly, the appended claims are intended to include within their scope such processes, machines, manufacture, compositions of matter, means, methods, or steps.
| Number | Date | Country | Kind |
|---|---|---|---|
| 112148645 | Dec 2023 | TW | national |
This Application claims priority of Taiwan Patent Application No. 112148645, filed on Dec. 14, 2023, the entirety of which is incorporated by reference herein.