# Research on a Random Mask Infection Countermeasure against Double Fault Attacks
## 2 Preliminaries
### Principle and Deficiency of Existing Infection Countermeasures  
To perform fault attack on AES cryptographic circuits, the attacker first makes the cryptographic device perform some faulty operations by inducing faults (the precision and size of the induced faults are controllable) and, then, retrieves the key according to the faulty ciphertexts. Due to the diffusion mode of the AES being known, the adversary can accurately infer the fault spread according to the characteristics of the cryptographic algorithm, and, on this basis, derive the equation relationships between the faulty ciphertexts, correct ciphertexts, and the induced fault, and, finally, obtain the key by exhaustive search under these equation relationships. The infection countermeasure defends against fault attacks by amplifying the impact of the injection fault so that the fault information inside the cryptographic circuit spreads over a wider area rather than simply following the flow of the AES algorithm itself, thus making it impossible for an attacker to crack the key through the faulty ciphertexts. Figure 1 depicts the principle of the existing infection countermeasure. In Figure 1, the state matrices A and A' represent the intermediate states of the normal encrypted data and the encrypted data after inducing fault at the same moment in the AES circuit, respectively. The principle of resisting a single-fault injection attack based on the countermeasure in Figure 1 is as follows: two identical plaintexts P are encrypted simultaneously via two paths, and, when a certain encryption operation is executed, the difference M is calculated between matrices A and A'. And, then, utilizing the diffusion function \(F\) (\(F\) satisfies \(F(0)=0\)) to diffuse the difference M to obtain M', and, then, XOR A and A' with M', respectively, to achieve the purpose of diffusion fault, thus preventing the attacker from retrieving the key based on the output faulty ciphertext and correct ciphertext. Figure 1: Principle of the existing infection countermeasure. In [30], a general diffusion function \(F\) as shown in Expression (1) was presented, where M\({}_{ij}\) is denoted as the elements of the \(i\)-th row and \(j\)-th column of a 4 \(\times\) 4\(-\)byte matrix. \[F:\text{M}^{\prime}_{ij}=\sum\
olimits_{n=0}^{3}\text{M}_{in}\oplus\sum \
olimits_{n=0}^{3}\text{M}_{nj} \tag{1}\]  
A fault will spread to its row and column by the diffusion function \(F\) (as shown in Figure 1). However, there are two shortcomings in the above infection mechanisms. The infection countermeasure above cannot effectively defend against double-fault attacks. Double-fault attack refers to inducing a fault at the same location in each of the two paths of the circuit in Figure 1 to avoid the detection of mismatched intermediate values in the two paths. For example, after simultaneous injection of the same fault on both encryption paths of the cryptographic device, the state matrices A = A', so that the difference between A and A' is M =A\(\oplus\)A' = 0. And, since the diffusion function satisfies \(F(0)\) = 0, the value M' after diffusion by \(F()\) is still 0. Then, A and A' are XOR with M', respectively. In the final output results, neither S nor S' are changed. That is, the faults induced could not be diffused by \(F()\), and the defence against double-fault attacks by the infection mechanism in Figure 1 cannot be rendered by the infection countermeasure described in Figure 1.  
The diffusion mode of \(F(0)\) is fixed and is not resistant to fault attacks which are based on the byte fault model. When there is a single-byte fault attack, if \(F()\) is fixed, there will be only 256 (that is 28) different diffusion cases after diffusion by \(F()\). And, then, the attacker can retrieve the key according to the idea of DFA by enumerating and analyzing these 256 possible diffusion results. To address the problems above, what is called a random mask infection countermeasure is presented to defend against fault attacks.