2026-05-20 1:15 AM - last edited on 2026-05-20 1:27 AM by Andrew Neil
Hello everyone,
I am currently working with the Aliro software expansion for STM32Cube using the new STEVAL-ALOCKCB board (Aliro access control reference design based on STM32WBA65RI, ST25R300, and STSAFE-A120).
Both the hardware and software are in their original, unmodified state from ST. The nfc12ble project builds successfully without any issues.
However, I am encountering a consistent problem:
the function CryptoInit() always returns false.
From debugging, I can see that the failure originates from the CheckReaderPubK() function, which internally calls isValidProvisioning(). This function also returns false, causing the entire initialization to fail.
It seems that the provisioning structure is not considered valid. In particular:
From my understanding, this indicates that the board is not provisioned, even though I am using it in its default state.
My questions are:
Any guidance or suggestions would be greatly appreciated.
Thank you in advance for your support.
bool CryptoInit()
{
PLATFORM_LOG(VERB_NORMAL, "CryptoInit() start\r\n");
PLATFORM_LOG(VERB_NORMAL, "SM_initCryptoMCU()\r\n");
SM_initCryptoMCU(&hrng, &hpka, &hhash, &hcryp);
extern bool CheckReaderPubK(void);
if(!CheckReaderPubK())
{
return false;
}
return true;
}
bool CheckReaderPubK(void)
{
showJsonStatus();
if (!isValidProvisioning(getProvisioningFromFlash()))
{
PLATFORM_LOG(VERB_NORMAL, TEXT_COLOR_RED);
PROVISIONING_LOG("\r\nBoard is not provisioned\r\n");
PLATFORM_LOG(VERB_NORMAL, TEXT_COLOR_DEFAULT);
PROVISIONING_LOG("Use 's' command to load default keys\r\n");
PROVISIONING_LOG("Use 'c' command to convert keys from embedded json\r\n");
PROVISIONING_LOG("Use '?' for help\r\n\r\n");
return false;
}
else
{
PROVISIONING_LOG("Board provisioning ok\r\n");
return true;
}
}
bool isValidProvisioning(provstruct_t *prov)
{
if(prov->isValid == DEVICE_PROVISIONING_STRUCT_IS_VALID)
{
//is valid
if(prov->struct_size == sizeof(provstruct_t))
{
PROVISIONING_LOG(TEXT_COLOR_GREEN);
PROVISIONING_LOG("Provisioning info is valid\r\n");
PROVISIONING_LOG(TEXT_COLOR_DEFAULT);
//print b1VendorSpecificExtension
PROVISIONING_LOG("b1VendorSpecificExtension: \"%s\"\r\n", prov->b1VendorSpecificExtension);
return true;
}
else
{
PROVISIONING_LOG(TEXT_COLOR_RED);
PROVISIONING_LOG("Provisioning info is present, but wrong version\r\n");
PROVISIONING_LOG(TEXT_COLOR_DEFAULT);
return false;
}
}
else
{
PROVISIONING_LOG(TEXT_COLOR_RED);
PROVISIONING_LOG("Provisioning info is not valid\r\n");
PROVISIONING_LOG(TEXT_COLOR_DEFAULT);
return false;
}
}