Hi,
I am using the BIM example as a basis to test ECDSA functionality (using SDK 2.40.0.47)
I wrote a small test in the BIM project that uses ECSDA, just to check that it works as expected with my signing tool.
My application gets stuck in ECDSA_verif. If I look at the dissasembly, the application is in a permenant branch to the same address:
E7FE b #0x100020c0
This only happens when optimization is turned off.
My test function is quite simple also:
static void EcdsaTest()
{
char msg[] = "hello";
uint8_t tempWorkzone[ECDSA_SHA_TEMPWORKZONE_LEN];
memset(tempWorkzone, 0, ECDSA_SHA_TEMPWORKZONE_LEN);
int8_t verifyStatus = FAIL;
uint8_t *finalHash;
uint8_t sigr[32] = { 0xC9,0xEE,0x23,0x44,0xF4,0xAE,0x78,0xFC,0x6A,0x92,0x0C,0xEA,0xB8,0xC6,0x1F,0x85,0xF0,0xB2,0x04,0xE4,0x1A,0x3A,0x5C,0xF2,0x19,0xBA,0x0D,0xF6,0x52,0x5D,0x55,0x21};
uint8_t sigs[32] = {0x9F,0x83,0x6D,0x1D,0x38,0x56,0xBC,0x49,0x40,0xBF,0x78,0xA8,0x63,0x05,0xE5,0xAB,0x86,0xEA,0x16,0xCC,0xB7,0x60,0xD9,0xF2,0x0A,0x51,0xC5,0x4B,0xC6,0xD4,0xA1,0xDB};
finalHash = hash((uint8_t*)msg, sizeof(msg));
verifyStatus = bimVerifyImage_ecc(_secureCertElement.certPayload.eccKey.pubKeyX,
_secureCertElement.certPayload.eccKey.pubKeyY,
finalHash,
sigr,
sigs,
eccWorkzone,
tempWorkzone);
}
uint8_t *hash(uint8_t *data, uint32_t len)
{
SHA256_memory_t workzone;
SHA2CC26XX_initialize(&workzone);
SHA2CC26XX_execute(&workzone, data, len);
SHA2CC26XX_output(&workzone, finalHash);
return finalHash;
}
You could paste the above code into the BIM project and it should produce the same effects.
I also see that the ECDSA_verif functon expects the first 32 bit word to contain the length. This is not in any documentation that I can see, and its only understood by looking at the bimVerifyImage_ecc function. Is there any more documentation for these ROM functions?