This Application claims priority of Taiwan Patent Application No. 110149562, filed on Dec. 30, 2021, the entirety of which is incorporated by reference herein.
The invention relates to a cipher accelerator, and more particularly to a cryptographic accelerator capable of differential fault analysis.
In recent years, encryption and decryption applications have been widely used in various electronic products, and great importance is placed on how to protect confidential information, so as to avoid computing data being stolen and analyzed.
A voltage glitch attack involves rapidly changing the voltage input to the integrated circuit (IC), so that some transistors in the IC will be affected and generate wrong output values in the process of encryption and decryption. This results in the processor operating incorrectly or processing incorrect data. In addition, the information hidden in the IC may also be leaked by the error of the processor.
Therefore, analyzing whether the data in the operation is being attacked is one of the issues that need to be solved in the application of encryption and decryption.
A cipher accelerator and a differential fault analysis method of an encryption and decryption operation are provided. An embodiment of a cipher accelerator is provided. The cipher accelerator includes an encryption and decryption circuit, a controller, a first storage device and a second storage device. The encryption and decryption circuit is configured to perform an encryption and decryption operation according to a control signal. The encryption and decryption operation includes a plurality of normal rounds and a plurality of redundant rounds. The controller is configured to provide the control signal to the encryption and decryption circuit according to a first variable value and a second variable value, so as to control the execution order of the normal rounds and the redundant rounds in the encryption and decryption circuit. The first storage device is configured to store the state of executing the normal rounds. The second storage device is configured to store the state of executing the redundant rounds. The encryption and decryption circuit is configured to divide the normal rounds into a first normal section and a second normal section according to the first variable value of the control signal, and divide the redundant rounds into a first redundant section and a second redundant section according to the second variable value of the control signal. The encryption and decryption circuit is configured to sequentially perform the first normal section, the first redundant section, the second normal section, and the second redundant section.
Moreover, an embodiment of a differential fault analysis method of an encryption and decryption operation is provided. The encryption and decryption operation includes a plurality of normal rounds and a plurality of redundant rounds. A first variable value and a second variable value are obtained from a random number generator. The normal rounds are divided into a first normal section and a second normal section according to the first variable value, and the redundant rounds are divided into a first redundant section and a second redundant section according to the second variable value. The first normal section, the first redundant section, the second normal section and the second redundant section are executed in sequence according to a clock cycle. It is determined whether the encryption and decryption operation was successful based on the first state that is from a first storage device and corresponds to the second normal section and the second state that is from a second storage device and corresponds to the second redundant section.
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:
The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims.
In
In the process of performing encryption and decryption operations in the integrated circuit (IC), differential fault analysis is performed in the normal rounds R1 through R10 and the redundant rounds R1 through R10, so as to determine whether the encryption and decryption process is subject to malicious attacks (such as voltage glitch attacks). First, the normal rounds R1 through R10 (hereinafter referred to as normal rounds NR1-NR10) are executed according to the initial state of the input data, and the normal round output NO10 generated by the normal round NR10 is obtained. Next, the redundant rounds R1-R10 (hereinafter referred to as the redundant rounds RR1-RR10) are executed according to the initial state of the input data, and a redundant round output RO10 generated by the redundant round RR10 is obtained. Next, it is determined whether the normal round output NO10 and the redundant round output RO10 are the same. If the normal round output NO10 is consistent with the redundant round output RO10, it means that the encryption and decryption operation has not failed (that is, the encryption and decryption process has not been attacked). Thus, the normal round output NO10 can be sent to other circuits for subsequent operations. Conversely, if the normal round output NO10 is different from the redundant round output RO10, it means that the encryption and decryption operation is faulty (that is, the encryption and decryption process is attacked). Therefore, the IC will re-execute the normal rounds NR1 through NR10 and the redundant rounds RR1 through RR10 until the normal round output NO10 and the redundant round output RO10 are consistent. In some embodiments, when the normal round output NO10 is different from the redundant round output RO10, the IC will directly finish the encryption and decryption operation, and notify other circuits (e.g., by sending a specific value) that the encryption and decryption process is attacked and the operation fails.
The cipher accelerator 20 includes a bus interface 30, an input/output buffer 40, a controller 50, an encryption and decryption (encryption/decryption) circuit 60, a storage device 70, and a storage device 80. In some embodiments, the storage devices 70 and 80 may be memories or registers. The bus interface 30 is coupled to the bus 10. The bus interface 30 is configured to transmit the commands of other circuits on the bus 10 to the controller 50, and transmit the response provided by the controller 50 to the bus 10. In addition, the bus interface 30 is configured to transmit data to be encrypted or decrypted to the input/output buffer 40 and transmit the encrypted or decrypted data from the input/output buffer 40 to the bus 10.
In response to the command from the bus interface 30, the controller 50 is configured to provide a control signal CTRL to the encryption and decryption circuit 60, and the control signal CTRL includes finite state machine (FSM) information related to encryption and decryption operations. In some embodiments, the controller 50 is configured to provide the control signal CTRL with the FSM information corresponding to the normal mode or the FSM information corresponding to the differential fault analysis mode to the encryption and decryption circuit 60.
In the normal mode, the control signal CTRL is configured to only instruct the encryption and decryption circuit 60 to perform the normal encryption and decryption operations without performing redundant encryption and decryption operations, i.e., only the normal rounds NR are performed by the encryption and decryption circuit 60. Therefore, after completing the normal rounds NR, the encryption and decryption circuit 60 obtains the encrypted/decrypted data, and transmits the encrypted/decrypted data to the input/output buffer 40. Next, the encrypted/decrypted data is provided to the bus 10 via the bus interface 30 for other circuits to perform subsequent procedures.
In the differential fault analysis mode, in addition to the normal encryption and decryption operations, the control signal CTRL is configured to further instruct the encryption and decryption circuit 60 to perform the redundant encryption and decryption operations, i.e., the encryption and decryption circuit 60 is configured to further perform the redundant rounds RR. After completing the normal encryption and decryption operations and the redundant encryption and decryption operations, the encryption and decryption circuit 60 is configured to compare the operation results to determine whether the operation results of the normal encryption and decryption operations and the redundant encryption and decryption operations are the same. If the operation results of the normal encryption and decryption operations and the redundant encryption and decryption operations are inconsistent, the encryption and decryption circuit 60 is configured to provide the signal Comp_State to the controller 50, so as to notify the controller 50 that a fault occurs. On the contrary, if the operation results of the normal encryption and decryption operations and the redundant encryption and decryption operations are the same, the encryption and decryption circuit 60 is configured to transmit the encrypted/decrypted data to the input/output buffer 40. Therefore, the encrypted/decrypted data is provided to the bus 10 via the bus interface 30 for other circuits to perform subsequent procedures.
In the differential fault analysis mode, the result (state) generated during the normal encryption and decryption operations performed by the cipher accelerator 20 is stored in the storage device 70, and the result (state) generated during the redundant encryption and decryption operations performed by the cipher accelerator 20 is stored in the storage device 80. In addition, the number of redundant rounds RR required to perform the redundant encryption and decryption operations is less than the number of normal rounds NR required to perform normal encryption and decryption operations. In other words, the time required to perform the redundant encryption and decryption operations (i.e., the number of clock cycles) is less than the time required to perform the normal encryption and decryption operations (i.e., the number of clock cycles). Therefore, using the cipher accelerator 20 can speed up the differential fault analysis operation and reduce the required analysis time.
In the normal mode, the processor 110 is configured to control the normal mode FSM unit 120 to generate the FSM information Normal_FSM corresponding to the normal encryption and decryption operations. Moreover, in the differential fault analysis mode, the processor 110 is configured to control the analysis mode FSM unit 130 to generate FSM information TRRSM_FSM corresponding to the normal encryption and decryption operations combined with the redundant encryption and decryption operations. It should be noted that the analysis mode FSM unit 130 is configured to provide the FSM information TRRSM_FSM according to the random variable value RNG from the random number generator 140. In addition, the number of redundant rounds RR required to perform the redundant encryption and decryption operations is determined by the random variable value RNG. In other words, the number of redundant rounds RR required to perform the redundant encryption and decryption operations each time is variable.
Referring to
As described above, in the differential fault analysis mode, the encryption and decryption circuit 60 is configured to determine whether the operation results of the normal encryption and decryption operations and the redundant encryption and decryption operations are consistent, and provide the signal Comp_State to the controller 50 to notify the controller 50 whether a fault occurs. When the signal Comp_State indicates that a fault occurs, the processor 110 is configured to control the analysis mode FSM unit 130 to generate the FSM information TRRSM_FSM again, so as to control the encryption and decryption circuit 60 to perform the normal encryption and decryption operations and the redundant encryption and decryption operations again. In some embodiments, when the signal Comp_State indicates that a fault occurs, the processor 110 is configured to directly finish the encryption and decryption operations, and inform other circuits (e.g., by sending a specific value) that the encryption and decryption processes are attacked and the operation fails.
Referring to
In step S220, according to the first variable value x, the normal rounds NR1 through NR10 are divided into a first normal section NR_SEC1 and a second normal section NR_SEC2. As shown in
Next, according to the second variable value y, the redundant rounds RR6 through RR10 are divided into a first redundant section RR_SEC1 and a second redundant section RR_SEC2. As shown in
In step S230, the analysis mode FSM unit 130 is configured to generate the FSM information TRRSM_FSM, so as to control the encryption and decryption circuit 60 to sequentially execute the first normal section NR_SEC1, the first redundant section RR_SEC1, the second normal section NR_SEC2 and the second redundant section RR_SEC2.
As shown in
In some embodiments, after completing the normal round NR5, in addition to storing the output NO5 in the storage device 70, the encryption and decryption circuit 60 is configured to further store the output NO5 in the storage device 80.
After completing the first normal section NR_SEC1, the encryption and decryption circuit 60 is configured to substitute the output NO5 into the redundant round RR6 of the first redundant section RR_SEC1 for operation to obtain the output RO6, and store the output RO6 in the storage device 80. Thus, the state stored in the storage device 80 is updated to the output RO6. Next, the output RO6 of the redundant round RR6 is substituted into the redundant round RR7 for calculation to obtain the output ROT and the output RO7 is stored in the storage device 80. Thus, the state stored in the storage device 80 resulting from the redundant encryption and decryption operations is updated to the output RO7. Thus, the first redundant section RR_SEC1 is completed.
After completing the first redundant section RR_SEC1, the encryption and decryption circuit 60 is configured to substitute the output NO5 stored in the storage device 70 into the normal round NR6 of the second normal section NR_SEC2 for operation to obtain the output NO6, and the output NO6 is stored in the storage device 70. Next, the output NO6 of the normal round NR6 is substituted into the normal round NR7 for calculation to obtain the output NO7, and the output NO7 is stored in storage device 70. By analogy, the normal rounds NR8 to NR10 are executed in sequence, and outputs NO8 to NO10 are generated respectively. In addition, the state stored in the storage device 70 generated by performing normal encryption and decryption operations is sequentially updated to the output NO8, NO9 and NO10. Then, the second normal section NR_SEC2 is completed, and the state stored in the storage device 70 resulting from performing the normal encryption and decryption operations is finally updated to output NO10.
After the second normal section NR_SEC2 is completed, the encryption and decryption circuit 60 is configured to substitute the output RO7 stored in the storage device 80 into the redundant round RR8 of the second redundant section RR_SEC2 for operation to obtain the output RO8, and the output RO8 is stored in the storage device 80. Next, the output RO8 of the redundant round RR8 is substituted into the redundant round RR9 for calculation to obtain the output RO9, and the output RO9 is stored in the storage device 80. Next, the output RO9 of the redundant round RR9 is substituted into the redundant round RR10 for calculation to obtain the output RO10, and the output RO10 is stored in the storage device 80. Thus, the state stored in the storage 80 and generated by the redundant encryption and decryption operations is finally updated to the output RO00. Thus, the second redundant section RR_SEC2 is completed.
Referring back to the differential fault analysis method 200, in step S240, the encryption and decryption circuit 60 is configured to compare whether the last output NR10 of the normal round NR stored in the storage device 70 with the last output RR10 of the redundant round RR stored in the storage device 80 are consistent. If the output NR10 is the same as the output RR10, the encryption and decryption circuit 60 is configured to complete the encryption and decryption operations according to the output NR10, and provide the encrypted/decrypted data to the input/output buffer 40 for transmission to the bus 10 via the bus interface 30. Conversely, if the output NR10 is different from the output RR10, the encryption and decryption circuit 60 is configured to provide the signal Comp_State to the controller 50 to notify the controller 50 that a fault has occurred.
In
In the embodiments of the invention, the respective end times of the normal round NR and the redundant round RR are protected by the random variable value RNG. For example, the first variable value x is used to protect the end time of the redundant round RR (e.g., the end time of the redundant round RR10), and the second variable value y is used to protect the end time of the normal round NR (e.g., the end time of the normal round NR10). Since the end time of the redundant round RR and the end time of the normal round NR are determined by different variable values (such as the first variable value x and the second variable value y), the difficulty of the attack is increased. Compared with the traditional differential fault analysis in which the redundant rounds RR and/or the normal rounds NR have a fixed end time, it is avoided that the attacker can create the same fault at the critical time point of the normal rounds NR and the redundant rounds RR in the embodiments of the invention, thereby improving time redundancy mechanism.
While the invention has been described by way of example and in terms of the preferred embodiments, it should be understood that the invention is not limited to the disclosed embodiments. On the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements.
Number | Date | Country | Kind |
---|---|---|---|
110149562 | Dec 2021 | TW | national |