Hi,
I connect the CW1173 ChipWhisperer-Lite through the CW308 UFO to control the STM32F303.
I follow CW308T-STM32F - NewAE Hardware Product Documentation
to programming via ChipWhisperer bootloader.
If I use the following code:
import chipwhisperer as cw
scope = cw.scope
target = cw.target(scope)
scope.default_setup()
I would encouter some problem :
AttributeError: 'function' object has no attribute '_get_usart'
However, I change to use provided file Setup_Generic.ipynb and program with firmware.hex, the board can be programed successfully.
Verified flash OK, 6247 bytes
Firmware uploaded successfully.
After the setup is complete, I want to write the key and plaintext and trigger AES start.
- set AES key
# Set the AES key
key = bytearray([0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c])
response = target.simpleserial_write('k', key)
# Waits for an ack from the target for timeout ms
response = target.simpleserial_wait_ack
print("AES key set response:", response)
Get response:
AES key set response: <bound method SimpleSerial.simpleserial_wait_ack of SimpleSerial Settings =
output_len = 16
baud = 38400
simpleserial_last_read =
simpleserial_last_sent = k2b7e151628aed2a6abf7158809cf4f3c
>
- Set Plaintext and trigger start
plaintext = bytearray([0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a])
response = target.simpleserial_write('p', plaintext)
# Waits for an ack from the target for timeout ms
response = target.simpleserial_wait_ack
print("AES plaintext set response:", response)
Get response:
AES plaintext set response: <bound method SimpleSerial.simpleserial_wait_ack of SimpleSerial Settings =
output_len = 16
baud = 38400
simpleserial_last_read =
simpleserial_last_sent = p6bc1bee22e409f96e93d7e117393172a
>
- Read ciphertext
print(target.simpleserial_read('r', 16))
print(target.simpleserial_read_witherrors('r', 16))
print(target)
Get response:
None
{'valid': False, 'payload': None, 'full_response': '', 'rv': None}
SimpleSerial Settings =
output_len = 16
baud = 38400
simpleserial_last_read =
simpleserial_last_sent = p6bc1bee22e409f96e93d7e117393172a
It seems fail to read the result from simpleserial.
How can I solve the problem?
Thanks!
ZT