Masked AES implementation for CW targets

1- This is strange since scope.adc.trig_count returns an integer, not a float. Was the capture_trace() successful? What’s the actual value of scope.adc.trig_count?

2- I’m not familiar with that particular AES implementation. Follow what gets compiled when you run make. In our own AES implementation, you can find the trigger_high() calls in hardware/victims/firmware/simpleserial-aes/simpleserial-aes.c



Sorry about the float. I had initalized an np.array just to collect the trig counts in a loop for multiple traces, and didn’t define it as an int. It returns an int. However, scope.adc.trig_count returns 49450 regardless of whether I call it before or after the cw.capture_trace() function. The latter seems to work, I try with two different plaintexts and get the following:


which is what you’d expect (I used the plaintexts from ...\chipwhisperer\hardware\victims\firmware\crypto\tiny-AES128-C\aes.c for easy reference.

Hmm that’s strange. What’s the full print(scope) output for your setup?

The output is:

cwlite Device
sn         = 442031204c5032433130312030313032
fw_version = 
    major = 0
    minor = 52
    debug = 0
gain = 
    mode = high
    gain = 30
    db   = 24.8359375
adc = 
    state          = False
    basic_mode     = rising_edge
    timeout        = 2
    offset         = 0
    presamples     = 0
    samples        = 24000
    decimate       = 5
    trig_count     = 49450
    fifo_fill_mode = normal
clock = 
    adc_src       = clkgen_x1
    adc_phase     = 0
    adc_freq      = 7384609
    adc_rate      = 1476921.8
    adc_locked    = True
    freq_ctr      = 0
    freq_ctr_src  = extclk
    clkgen_src    = system
    extclk_freq   = 10000000
    clkgen_mul    = 2
    clkgen_div    = 26
    clkgen_freq   = 7384615.384615385
    clkgen_locked = True
trigger = 
    triggers = tio4
    module   = basic
io = 
    tio1         = serial_rx
    tio2         = serial_tx
    tio3         = high_z
    tio4         = high_z
    pdid         = high_z
    pdic         = high_z
    nrst         = high_z
    glitch_hp    = False
    glitch_lp    = False
    extclk_src   = hs1
    hs2          = clkgen
    target_pwr   = True
    tio_states   = (1, 1, 0, 0)
    cdc_settings = array('B', [0, 0])
glitch = 
    clk_src     = target
    width       = 10.15625
    width_fine  = 0
    offset      = 10.15625
    offset_fine = 0
    trigger_src = manual
    arm_timing  = after_scope
    ext_offset  = 0
    repeat      = 1
    output      = clock_xor

"To pull it in, go to hardware/victims/firmware/crypto/ and run:
git submodule update --init secAES-ATmega8515/"

I ran the above work and used PLATFORM='CWLITEXMEGA ',CRYPTO_ TARGET=‘MASKEDAES’ was successfully compiled and run, but after I passed in the mask, the power consumption obtained indicates that the mask did not run inside the chip. What is the situation.

I used to run and collect power successfully, but now I haven’t made any changes, but the mask can’t run internally. These two pictures show the power consumption of AES-128MASK collected before and the power consumption of AES-128MASK now.

I hope I can get your help. This problem has bothered me for four days. I can guarantee that the mask array can be transferred to the microcontroller, but it is not useful in the encryption process after it is transferred. Plaintext and key can be transferred to the chip and successfully encrypted.

Hi, could you please show me the screenshot of your jupyter file? My file does not work as expected. Did I miss something else? Thank you very much.

It worked! Thank you.