Set own AES keys on Chipwhisperer lite

Hi all !
I’m currently trying to implement the Ascon cipher on Chipwhisperer Lite. I’m having a bit of trouble doing that so I’m trying to understand how AES is done on it to apply the same things on Ascon.

I’m currently trying to set my own keys for encryption instead of using the bacis ones.
I wrote my keys as bytearrays and sent them to the chip but got a “Device failed to ack” error.

When getting the type of the response I noticed their type was CWbytearray. I’m now supsecting this to be the reason behind the error.
Do you have information/ressources on this data type ? or do you know how to convert my bytearrays into this type ?

Thanks in advance

Hi,

Can you post your code? CWbytearray is just a normal byte array that has its string conversion method overrided so that its output is easier to interpret when you print it.

Alex

Of course ! Here it is:
key=bytearray(b’000102030405060708090a0b0c0d0e0f’)
text=bytearray(b’00112233445566778899aabbccddeeff’)

target.set_key(key)
scope.arm()
target.simpleserial_write(‘p’, text)
ret = scope.capture()
if ret:
print(“Target timed out!”)

response = target.simpleserial_read(‘r’, 16)
print(response)

Oh ok thanks ! So I can just call it ?

Nathan

Hi Nathan,

Try doing

key=bytearray([0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f])

Instead and the same for text. Python can get a bit confusing with this stuff, but basically bytes (b'...') behaves more like a string and bytearray behaves more like a list.

Alex

Hi Alex,

Thank you so much that worked !
Oh I understand now thanks !
Have a great evening !

Nathan

1 Like