CSEc can not load key repeat

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CSEc can not load key repeat

Jump to solution
1,123 Views
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;
}

Tags (2)
0 Kudos
Reply
1 Solution
1,094 Views
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

View solution in original post

0 Kudos
Reply
1 Reply
1,095 Views
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 Kudos
Reply