2024-10-22 06:17 AM - last edited on 2024-10-22 06:27 AM by Andrew Neil
Hi,
I am currently working on migrating a project from STM32 Crypto Library version 3.1.5 to version 4.2.1. I would greatly appreciate your assistance with the following queries:
Compatibility Inquiry: Is version 4.2.1 compatible with version 3.1.5? Specifically, Device ‘A’ is operating on version 3.1.5, while Device ‘B’ is on version 4.2.0. Are there any known compatibility issues between these versions?
Function Replacement Issue: After importing the v4.2.0 library, I encountered an error with the HKDF_SHA512() function call. I replaced this function as follows:
In v3.1.5:
HKDF_SHA512(&StHkdfInput, Aru8HkdfOut, sizeof(Aru8HkdfOut));
In v4.2.0:
if (cmox_initialize(NULL) != CMOX_INIT_SUCCESS) {
#ifdef APP_DEBUG
printf("cmox_initialize failed\n");
#endif
}
if(HASH_SUCCESS == HMAC_SHA512_Init(&SHA512ctx_st))
{
if(HASH_SUCCESS == HMAC_SHA512_Append(&SHA512ctx_st, Aru8HkdfInput, sizeof(Aru8HkdfInput)))
{
if(HASH_SUCCESS == HMAC_SHA512_Finish(&SHA512ctx_st, Aru8HkdfOut, &Aru8HkdfOutSize))
{
//Create session key, initial vector and hamc key
memcpy(m_Aru8AesKey , Aru8HkdfOut, AES_KEY_ARRAY_SIZE );
memcpy(m_Aru8InitVect, Aru8HkdfOut + AES_KEY_ARRAY_SIZE, INIT_VECT_SIZE );
memcpy(m_Aru8HmacKey, Aru8HkdfOut + AES_KEY_ARRAY_SIZE + INIT_VECT_SIZE, HMAC_KEY_SIZE );
bReturnStatus = true;
}
}
}
if (HAL_OK == HAL_HASH_Init(&HashHandle))
{
if (HAL_OK == HAL_HMAC_SHA1_Start(&HashHandle, (uint8_t *)pu8InputMessage, u32InputMessageLength, pu8MessageDigest, 0xFF))
{
bStatus = true;
}
}
Your support in resolving these issues would be highly appreciated.
Thank you in advance for your assistance.
2024-10-24 09:11 AM
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.