I want build another algorithm in Chipwhisperer but it had problem

hello Dear forum
I came to you with a question.
i want build Another algortihm(Post Quantum Cryptography - SABER) in chipwhisperer for SCA Study
but i faced a problem

saber algorithm’s indcpa_public key byte is 992 bytes

first question, i operated SS_VER_1, of course ver_1 can’t read that size
Similarly, I know that SS_VER_2 can only transmit up to 249Bytes per packet.

so i typed

and return this error

second question it is SS-saber(alias) code


and it is indcpa_kem_keypair() function

and i had this error

My guess is that this error is returned because the packet is oversized (992bytes). that’s right?

I thought 128 bytes would be returned, but it wasn’t.

And is it possible to split the packet and receive the ack?

thanks

gskim

Here’s some issue’s I’ve identified:

  1. SS_VER_2_0 is deprecated. You should use SS_VER_2_1 instead.
  2. Your %%bash command is missing "$SS_VER" after "$CRYPTO_TARGET".
  3. You shouldn’t use non ASCII characters with putch()
  4. If SABER_INDCPA_PUBLICKEYBYTES is larger than 192 bytes, you’ll write past the buffer of pt and start corrupting other parts of memory. I’d recommend breaking the key into chunks and sending those over. Once you receive them, you can store them in a separate array.

Alex

hi
Thanks alex, i understand your advice 1,2,3

but 4 is yet, Is there any document I can refer to on the 4th?

thanks

gskim

Sorry, there’s no document for sending a long message. Do you need to change the key out often? If not, you could just hard code it into the firmware, which saves you from having to worry about transferring it.

Alex

I got it. I want to analyze the part that generates the key with DPA attack, but the size of the key needs to be large due to the security level of the algorithm.

so if i can’t DPA attack keypair operation this reason, I want to DPA attack for decoding / encoding function.

hard-coding (declare internally) don’t care size of the key, plaintext or ciphertext?

for example the size of the key

uint8_t sk[CRYPTO_SECRETKEYBYTES] = {0x0f, 0x1f, 0x2f, 0x3f, 0x4f, 0x5f, 0x6f, 0x7f,
0x0e, 0x1e, 0x2e, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e,
0x0a, 0x1a, 0x2a, 0x3a, 0x4a, 0x5a, 0x6a, 0x7a
0x0d, 0x1d, 0x2d, 0x3d, 0x4d, 0x5d, 0x6d, 0x7d
… , 992th };

thanks

gskim

Yup, declaring like that should work fine. The size of the key will ultimately be limited by the amount of memory on the device, but you won’t run into any issues with keys like the one you’re using.

Alex

thanks
and i have one more question
why i had this error?

gskim

What chipwhisperer version are you on (cw.__version__)? That command runs fine for me on the latest CW.

it’s ‘5.5.0’ my CW

gskim

There’s been some fixes for SimpleSerial V2 stuff since 5.5.0. You can try updating if you want by grabbing the latest installer (Release Blackhat 2021 · newaetech/chipwhisperer · GitHub), but it’ll probably be easiest just to use SimpleSerial V1 instead.

Alex

thanks reply
but i used SS V1

i got the same error

gskim

You need to use SSV1 from python as well. Your target is still SSV2

Thx i change SSV1

hmm… but i can’t receive ack from target board

What is the problem in this case?
Algorithm problem?

Try removing the algorithm call to see if the communication works. You should also remove the wait_ack call, as that’s already covered by the simpleserial_read call

thx communication work is very good, It’s probably an algorithm problem.

ok i have another question

i checked my algorithm operating in simpleserial, between putch code like :

    putch('H');
indcpa_kem_dec(sk, ciphertext, m);
    putch('a');
putch('L');
putch('\n');

it printed HaL without interruption

and i tried this work , all array value is zero

and i returned

data size, 32 bytes
but returned error message.

why it was operated in main function, but not in get_pt

gskim

It could be that your algorithm takes a few seconds to run, so the read is timing out before you receive any data.

Alex

u mean like

time.sleep(); upper value ? ex) time.sleep(60);

but Even if I increase it , an same error pops up

Is it meaningless to use the Python delay function? or Is there something wrong with inserting the delay?

delay function input simpleserial code?

i knew that algorithm operating within milliseconds second in windows & python

gskim