# Is it possible to perform CPA(Correlation Power Analysis) when attacker has only specific round's waveform?

But most of them, assuming that attacker has the first or last round of the waveform(trace) and exploit SubBytes.

My question is if the AES-128 (or AES-256) can be attacked even if attacker has only a certain round of waveform, not the first and last.

Even if attacker has the multiple pairs of plaintext and ciphertext, Is it impossible to figure out the encryption key using only a specific round's waveform?

• The quality of the waveform is important. The attack is straight forward but the acquisition of the information is not. If you are looking at power attacks, you can lose the data into the noise on larger dies. Also, you can use duel rail encoding to mask information on the power level. There are a lot of mundane details that are required to successfully carry out this attack. – b degnan May 11 '20 at 12:21

Yes, in general you can perform a key-recovery DPA attack on certain inner rounds of AES. Most of the attacks in public literature target leakage from first or last rounds (the outer rounds) after a highly non-linear operation (such as SubBytes) just for convenience. This attack is very easy to implement. Exploiting leakage from inner rounds becomes a bit trickier and slightly more cumbersome to implement, but it's certainly possible for the second round of AES (or second to last) and further in DES.

Let's recap a bit. One main ingredient of DPA attacks is divide and conquer. Say we are targeting AES-128. We essentially chop one intractable problem (performing key recovery on 128 bits) into 16 much smaller and attainable problems (16x 8-bit DPAs that recover each byte of the first or last round subkey). The DPA attack itself is basically comparing predictions for leakage when handling an intermediate $$V$$ against actual measurements. A vanilla DPA targets leakage from an intermediate $$V_i=F(X_i, K_i)$$ that is a function of:

• data $$X_i$$ that the DPA practitioner knows (such as a portion of the plaintext or ciphertext), and
• a portion $$K_i$$ of the (unknown) subkey. The main condition on $$K_i$$ is that the DPA practitioner can efficiently go over every possible value of $$K_i$$. This ensures the running time of the DPA attack stays manageable and the whole attack is practical.

Now we can see the reason we find DPA attacks on outer rounds easier: there are plenty of intermediates $$V$$ that satisfy these two conditions. In your example, the output of SubBytes makes an excellent choice: the practitioner needs to enumerate just $$2^8$$ subkeys. (There are other additional, unrelated reasons that make this a good choice; namely, it's the output of a highly non-linear operation, which helps in the process of weeding out wrong subkey hypothesis, but this is not important now.)

Note if we chose an intermediate $$V$$ that depends on too many key bits (in a way that the condition on $$K_i$$ above does not hold), then the DPA attack would just take too much time and not be practical, or even pose an advantage over plain cryptanalysis (including brute force).

Back to the original question, you can find intermediates in the second round in AES that satisfy these two properties. For example, a very, very naive attack could target the SubBytes output of the second round. The attack needs to enumerate $$2^{40}$$ keys. This is certainly a much heavier computation than $$2^8$$, but not the end of the world.

This hassle can be circumvented if the practitioner can deactivate portions of input texts by fixing them to a constant value. Say we're targeting an intermediate $$V$$ that is the xor of four S-box outputs: $$V=S(P_1 + K_1) + S(P_2 + K_2) + S(P_3 + K_3) + S(P_4 + K_4)$$. Naively, this would mean that we've to enumerate $$2^{4w}$$ $$w$$-bit subkeys to jointly recover $$(K_1,K_2,K_3,K_4)$$. If we fix $$P_2$$, $$P_3$$ and $$P_4$$ to constant values, the intermediate $$V$$ can be rewritten as $$V=S(P_1 + K_1) + c$$ for some unknown constant $$c$$. We can perform the DPA on the "key hypothesis" $$(K_1, c)$$ taking $$2^{2w}$$ effort (and then repeat to recover $$K_2$$, and so on). Overall this takes roughly $$2^{2w+2}$$ time, less than jointly recovering all subkeys. (I've oversimplified a bit for the sake of the explanation, but you can find intermediates in AES where this technique applies.)

From here, there are other tricks you can use to target inner rounds. They are slightly more complicated and combine DPA with more traditional symmetric cryptanalysis. Although they are described in a very narrow and specific setting, usually they can be ported to different algorithms or scenarios. Here are some examples: