I am using the code in the solution notebook for this lab and for the section AES guesser the reasults are a lot smaller than the expected values
This is the code i run
import numpy as np
mean_diffs = np.zeros(256)
guessed_byte = 0
for guess in range(0, 256):
import numpy as npmean_diffs = np.zeros(256)
guessed_byte = 0
for guess in range(0, 256):
one_list = []
zero_list = []
for trace_index in range(numtraces):
#Get a hypothetical leakage list - use aes_internal(guess, input_byte)
hypothetical_leakage = aes_internal(guess, textin_array[trace_index][guessed_byte])
#Mask off the lowest bit - is it 0 or 1? Depending on that add trace to array
if hypothetical_leakage & 0x01:
one_list.append(trace_array[trace_index])
else:
zero_list.append(trace_array[trace_index])
one_avg = np.asarray(one_list).mean(axis=0)
zero_avg = np.asarray(zero_list).mean(axis=0)
mean_diffs[guess] = np.max(abs(one_avg - zero_avg))
print("Guessing %02x: %f"%(guess, mean_diffs[guess]))
and the scores i get are
Guessing 24: 0.000746 Guessing 25: 0.000797 Guessing 26: 0.000699 Guessing 27: 0.000777 Guessing 28: 0.000792 Guessing 29: 0.000780 Guessing 2a: 0.000692 Guessing 2b: 0.000781
while the expected scores should be something like this
Guessing 28: 0.001397 Guessing 29: 0.000927 Guessing 2a: 0.001953 Guessing 2b: 0.005278 Guessing 2c: 0.000919 Guessing 2d: 0.002510 Guessing 2e: 0.001241 Guessing 2f: 0.001242
I believe that i am missing something in my chipwhisperer setup for the capturing of correct power traces
I use chipwhisperer husky with the sam4s target board and the chipwhisperer CW313 and i have connected the POS SMA cable to the J4 pin in the CW313