CSEc can not load key repeat

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

CSEc can not load key repeat

跳至解决方案
865 次查看
BigJulie
Contributor II

Hi,

when i debugging CSEc part in S32K146,load master key in master ecu keyslot after initialization CSEc ,the first time the command CMD_LOAD_KEY function return to OK,the second time the command CMD_LOAD_KEY function return to Not OK,i loaded same key in these two time,and then i can not load key success after that.

how can i load key repeatedly? the function in the below.

FUNC(Crypto_Cse_ErrorCodeType, CRYPTO_CODE) Crypto_Cse_LoadKey(VAR(Crypto_Cse_KeyIdType, AUTOMATIC) keyId, P2CONST(uint8, AUTOMATIC, CRYPTO_APPL_CONST) keyM1Ptr,
P2CONST(uint8, AUTOMATIC, CRYPTO_APPL_CONST) keyM2Ptr, P2CONST(uint8, AUTOMATIC, CRYPTO_APPL_CONST) keyM3Ptr
)
{
VAR(Crypto_Cse_ErrorCodeType, AUTOMATIC) eOutResponse = CRYPTO_CSE_ERC_GENERAL_ERROR;

Crypto_Cse_eState = CRYPTO_CSE_BUSY;

/* clear ACCERR and FPVIOL flags before entering any operation */
Crypto_Cse_ClearErrorFlags();
/* write keyM1Ptr, keyM2Ptr, keyM3Ptr to CRYPTO_CSE_PRAM */
Crypto_Cse_WritePagesToPRAM(keyM1Ptr, CRYPTO_PRAM_PAGE1_ADDR32, CRYPTO_M1_SIZE_IN_PAGES_U16);
Crypto_Cse_WritePagesToPRAM(keyM2Ptr, CRYPTO_PRAM_PAGE2_ADDR32, CRYPTO_M2_SIZE_IN_PAGES_U16);
Crypto_Cse_WritePagesToPRAM(keyM3Ptr, CRYPTO_PRAM_PAGE4_ADDR32, CRYPTO_M3_SIZE_IN_PAGES_U16);

/* write command header to CRYPTO_CSE_PRAM, wait for the completion of the command, read and process error code */
eOutResponse = Crypto_Cse_SendCommand(CRYPTO_CSE_CMD_LOAD_KEY, CRYPTO_CSE_FUNC_FORMAT_COPY, CRYPTO_CSE_CALL_SEQ_FIRST, keyId);
eOutResponse = Crypto_Cse_WaitCommandComplete();

Crypto_Cse_eState = CRYPTO_CSE_IDLE;

return eOutResponse;
}

标记 (2)
0 项奖励
1 解答
836 次查看
namnguyenviet
NXP Employee
NXP Employee

Hello @BigJulie ,

As my understanding, it's not possible to load the same key into CSEc PRAM. Either load another key, or erase the old key and load again is possible.

Best Regards,

Nam

在原帖中查看解决方案

0 项奖励
1 回复
837 次查看
namnguyenviet
NXP Employee
NXP Employee

Hello @BigJulie ,

As my understanding, it's not possible to load the same key into CSEc PRAM. Either load another key, or erase the old key and load again is possible.

Best Regards,

Nam

0 项奖励