scope.arm()
target.simpleserial_write('p', msg)
## fill in the rest...
What do i fill in the rest ?
tried to write few scripts but nothing worked.
%%bash
cd ../firmware/mcu/simpleserial-aes/
make PLATFORM=CWLITEARM CRYPTO_TARGET=TINYAES128C SS_VER=SS_VER_2_1
msg = bytearray([0x43]*16) #simpleserial uses bytearrays
target.simpleserial_write(‘p’, msg)
print(target.simpleserial_read(‘r’, 16))
msg = bytearray([0x42]*16) #simpleserial uses bytearrays
target.simpleserial_write(‘k’, msg)
print(target.simpleserial_wait_ack()) #should return 0
target.write(‘p’ + “00”*16) #fill in the rest here
recv_msg = “”
recv_msg += target.read() #you might have to run this block a few times to get the full message
print(recv_msg)
import chipwhisperer as cw
scope = cw.scope()
target = cw.target(scope, cw.targets.SimpleSerial2)
scope.default_setup()
Example key and plaintext
key = bytearray([0x00]*16)
msg = bytearray([0x42]*16)
Sending the key first
target.simpleserial_write(‘k’, key)
Arm the scope
scope.arm()
Send plaintext (this triggers encryption + scope capture)
target.simpleserial_write(‘p’, msg)
Wait for capture to complete
ret = scope.capture()
if ret:
print(“Timeout happened during capture”)
else:
Get the captured waveform
trace = scope.get_last_trace()
# Read back ciphertext from target
ciphertext = target.simpleserial_read('r', 16)
# Print results
print("Plaintext:", msg)
print("Ciphertext:", ciphertext)
print("Trace length:", len(trace))
print("First 10 samples:", trace\[:10\])