Hi Lukas, Thank you for your reply.
My project is a basic project, s32k312 HSE function has just started testing, I have not done any operations, such as advance LC, program ADPK key, and format HSE key catalogs, etc., so the chip status is default.
The test code and allowed results are shown in the following figure:
void hse_init()
{
hseStatus_t HseStatus;
hseSrvResponse_t HseSrvResponse;
OsIf_Init(NULL_PTR);
Crypto_Init(NULL_PTR);
HostFlash_Init();
/* read HSE FW Version */
HseSrvResponse = HSE_GetVersion(&HseFwVersion);
LOGI("HSE Version: %d.%d.%d.%d.%d.%d\r\n", HseFwVersion.reserved, HseFwVersion.socTypeId, HseFwVersion.fwTypeId,
HseFwVersion.majorVersion, HseFwVersion.minorVersion, HseFwVersion.patchVersion);
/* read Lifecycle */
HseSrvResponse = HSE_ReadLifecycle(&HseAttrSecureLifecycle);
LOGI("HseAttrSecureLifecycle: %d\r\n", HseAttrSecureLifecycle);
/* read AttrExtendCustSecurityPolicy */
HseSrvResponse = HSE_ReadAttrExtendCustSecurityPolicy(&HseAttrExtendCustSecurityPolicy);
LOGI("HseAttrExtendCustSecurityPolicy: enableADKm = %d, startAsUser = %d\r\n",
HseAttrExtendCustSecurityPolicy.enableADKm, HseAttrExtendCustSecurityPolicy.startAsUser);
/* copy active data to passive */
HostFlash_PassiveUpgradeTest();
LOGI("HostFlash_PassiveUpgrade success\r\n");
/* ab swap */
HseSrvResponse = HSE_ActivatePassiveBlock();
if (HSE_SRV_RSP_OK != HseSrvResponse)
LOGI("HSE_ActivatePassiveBlock fail [error_code: 0x%x]\r\n", HseSrvResponse);
else
LOGI("HSE_ActivatePassiveBlock success\r\n");
}
#define MU0 (0)
#define HSE_ADMIN_CHANNEL (0)
hseSrvResponse_t HSE_ActivatePassiveBlock(void)
{
hseSrvResponse_t hseStatus = HSE_SRV_RSP_GENERAL_ERROR;
uint8_t u8MuChannel = HSE_ADMIN_CHANNEL;
hseSrvDescriptor_t* pHseSrvDesc;
pHseSrvDesc = &gHseSrvDesc[MU0][u8MuChannel];
memset(pHseSrvDesc, 0, sizeof(hseSrvDescriptor_t));
pHseSrvDesc->srvId = HSE_SRV_ID_ACTIVATE_PASSIVE_BLOCK;
hseStatus = HSE_Send(MU0, u8MuChannel, gSyncTxOption, pHseSrvDesc);
/* wait for positive response */
ASSERT(HSE_SRV_RSP_OK == hseStatus);
return hseStatus;
}
