How to customize input and output length?


I need to implement a symmetric crypto which has 64-bit input and output and 128-bit key.
So, I change ‘simpleserial-aes.c’ like below:

uint8_t get_pt(uint8_t* pt)
	ENC(pt); /* encrypting the data block */

	simpleserial_put('r', 8, pt);
	return 0x00;

int main(void)
	uint8_t tmp[KEY_LENGTH] = {DEFAULT_KEY};



    simpleserial_addcmd('k', 16, get_key);
    simpleserial_addcmd('p', 8, get_pt);

Moreover, I changed jupyter notebook.

How can I solve this problem?

Try changing target.setOutuptLen = 8 to target.output_len = 8. As far as I can tell, setOutputLen and setTextLen are not properties, values, or methods of SimpleSerial.


I changed as you told me.

target.textlength = 8
target.output_len = 8

However, the problem does not solved.
Isn’t there any example to change text length?

I’d recommend just bypassing capture trace and doing the steps (sending key, arming, sending plaintext, capturing, creating trace) of capture_trace instead.


I have a question on this section.It is that how can I receive or send data whose length is larger than 256 like 1024, is there a method to complete this operation directly ?

Thanks a lot!

You’ll need to break it into multiple packets. We do something similar in the Fault201 RSA lab in SimpleSerial v1, except we do it on the target->PC end:

if SS_VER!='SS_VER_2_0':
    target.simpleserial_write("1", bytearray())
    output = target.simpleserial_read_witherrors('r', 48, timeout=10)
    if output['valid']:

    target.simpleserial_write("2", bytearray())
    output = target.simpleserial_read_witherrors('r', 32, timeout=10)
    if output['valid']:



Thanks for your answer!
I have known how to do that, but I saw that the len is set to 48, and when I took a try , 128 is wrong for it.What’s the reason?
The parameter type is uint8_t, it means that it allows value from 0-255, isn’t it?

Thanks a lot!

IIRC we ran into consistency issues with longer packets. There’s a limited serial buffer on the capture board as well and if you overrun that data will be lost. We did increase the size of that buffer between when I wrote the code I posted, so longer data strings will probably work better now.

For SimpleSerialV1, the absolute max for data commands will be 192 data bytes - this is in the target code. SimpleSerialV2 will let you transmit more data, since it’s sent in binary instead of being ASCII encoded.