This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3220S-LAUNCHXL: Repeated Attempts to Sign the Same Buffer Cause Error

Part Number: CC3220S-LAUNCHXL
Other Parts Discussed in Thread: CC3220S

I am an educator working on creating a lab based on the CC3220S Launchpad. Students are going to be doing some analysis on the timing of the device's built-in cryptographic tools.

I've noticed that attempting to sign the same buffer multiple times (which we are doing to get a consistent value for the timing) results in an error code (-2001) often after the first signing. I have yet to see the first one fail, though.

I'm calling the ecdsaVerifyDigest() function from the SimpleLink Academy, here: https://dev.ti.com/tirex/explore/node?node=AEXjVaoT2bagxJxkb2dJ0g__fc2e6sr__LATEST

The code snippet that I use to call this is below:

uint32_t d1, d2, del;
char testString[512];
uint8_t result[256];
uint16_t resultLen = 256;
int i, j;

for (i = 0; i < 512; i++)
    testString[i] = i % 256;
        
UART_PRINT("Signing\n\r");

ret = 0;

memset(result, 0, 256);

d1 = Timestamp_get32();

for (i = 0; i < num_iterations; i++)
{
    ret = ecdsaSignBuffer((uint8_t*) testString, 512, result, &resultLen);
    
    if (ret != 0)
        UART_PRINT("Failed on iteration %d with error %d\r\n", i, ret);

    UART_PRINT("Signature len: %d\r\n", resultLen);
}

d2 = Timestamp_get32();

So far, I've tried a few things. Namely, increasing the size of all buffers, removing some of the printing code in the crypto_utils code, and re-initializing all buffers on each iteration. Any ideas?