About reporting errors related to the implementation of the Dilithium algorithm on Chipwhisperer

Good afternoon
Hello, I am a Chipwhisperer newbie and I am trying to implement the Dilithium algorithm using CW308_STM32F3.
I’m getting the following error message when trying to power harvest the algorithm. I’m guessing it’s a timeout that’s causing the error message. Again, I have attached my capture code below.

I have simulated and verified the correctness of the algorithm in keil5. And the algorithm takes just two seconds to complete during simulation. So I’m not quite sure where there is an error in the algorithm that prevents it from running correctly in the cw308 suite.

In the meantime I attach my code within simpleserial, this code I changed from simpleserial-base, I don’t know if it’s all wrong. In this code, I don’t input data from the board first, but call the algorithm directly at the algorithm niskat.

uint8_t get_pt(uint8_t* pt, uint8_t len)
{
size_t mlen = DEFAULT_msg_len;
size_t smlen = DEFAULT_msg_len + PQCLEAN_MLDSA44_CLEAN_CRYPTO_BYTES;
uint8_t m[DEFAULT_msg_len]= { DEFAULT_msg };
uint8_t a[DEFAULT_msg_len + PQCLEAN_MLDSA44_CLEAN_CRYPTO_BYTES];
trigger_high();

niskat();

trigger_low();
simpleserial_put('r', 16, a);

return 0x00;
}

int main(void)
{
platform_init();
init_uart();
trigger_setup();
simpleserial_init();
simpleserial_addcmd(‘k’, 16, get_key);
simpleserial_addcmd(‘p’, 16, get_pt);
while(1)
simpleserial_get();
}

I’m currently guessing at three possibilities for errors in my algorithm:

  1. stack and heap are set incorrectly. Because my simulation success in keil is to modify the stack to 0x2000 and the heap to 0x7000. but I can’t find a place to modify it in chipwhisperer. keil uses clang for compilation, so you can modify the startup file directly.
  2. Algorithm running timeout. But my simulation result only takes two seconds, it seems unlikely.
  3. simpleserial_put(‘r’, 16, a); error. But I don’t seem to have called this function yet, I just write this function in the simpleserial file of the algorithm as a padding for passing the data in the next step.

Do you know what could be causing this error?

Thanks in advance

If there is anything else you need from me to facilitate this, please talk to me. I would greatly appreciate your help, it is very important to me. I have been stuck on this issue for a month now.