@jpthibault Regarding fast capturing
scope.adc.samples = 50
scope.adc.segments = 1000
target.simpleserial_write('k', bytearray(16))
target.simpleserial_wait_ack()
target.simpleserial_write('n', list(int.to_bytes(scope.adc.segments, length=2, byteorder='big')))
target.simpleserial_wait_ack()
scope.arm()
starttime = datetime.datetime.now()
target.simpleserial_write('f', bytearray(16))
#target.flush()
ret = scope.capture(poll_done=True)
wave = scope.get_last_trace()
resp = target.simpleserial_read('r', 16)
elapsed = datetime.datetime.now() - starttime
print('Elapsed time: %1.3f seconds; %5.1f captures/second' % (elapsed.total_seconds(), scope.adc.segments/elapsed.total_seconds()))
Looking at the above set of commands, the “n“ command is absent in the simple serial v1 protocol. I think the ‘s‘ command should be used instead:
#if SS_VER == SS_VER_2_1
simpleserial_addcmd(0x01, 16, aes);
#else
simpleserial_addcmd('k', 16, get_key);
//simpleserial_addcmd('k', 32, get_key);
simpleserial_addcmd('p', 16, get_pt);
simpleserial_addcmd('x', 0, reset);
simpleserial_addcmd_flags('m', 18, get_mask, CMD_FLAG_LEN);
simpleserial_addcmd('s', 2, enc_multi_setnum);
simpleserial_addcmd('f', 16, enc_multi_getpt);
#endif
Also, I think this approach will work for the known key only assuming implementation of the “f“ handler:
uint8_t enc_multi_getpt(uint8_t* pt, uint8_t len)
{
aes_indep_enc_pretrigger(pt);
for(unsigned int i = 0; i < num_encryption_rounds; i++){
trigger_high();
aes_indep_enc(pt);
trigger_low();
}
aes_indep_enc_posttrigger(pt);
simpleserial_put('r', 16, pt);
return 0;
}
I can recover the whole plaintext bunch from the single received ciphertext( in the case if the key is known). But if the key is unknown, it will be impossible to do it.