Hello,
I am using Csec driver which is received by NXP.
I have done the program partition and I am able to write Master key and keys(for e.g. KEY_2) using Csec APIs commands successfully but when I try to execute Csec_EncryptEcb(CSEC_KEY_2, aPlainText_Enc, 16U, aCipherText_Enc); then I am getting ERC_KEY_INVLAID.
aPlainText_Enc and aCipherText_Enc is array of 16 bytes
Can you please help what is the root cause here as I have taken care counter value(i.e set to 1 while writing first time) and flags (set to 1 i.e. only wild card is enable) while writing keys
Could you tell me which example-project you're using?
According to S32K-RM 36.5.13.3 User CSEc command interface and command set
• ERC_KEY_INVALID.
Example: key slot doesn't qualify per key map to command;KeyID[7:5] are set; kBS==0 & KeyIDx==0xE
This error code is returned by SHE whenever a funtion is called to perform an operation with key that is not allowed for the given operation.
Maybe you can take a look at AN5401,there are some example for your refernence in AN5401SW, and please take a look at the Example3_Basic_operations_SDK3.0.0.
This application note can be found in NXP website by seraching for AN5401.
BR!
Jim,
HI Jim,
Thank you for your reply.
I have taken reference from S32K14X_CSEC_MCAL4_0_RTM_1_0_4_Sample_Application to update the keys and I am using macros CSEC_KEY_2 from CSEc static code which is received from NxP so kBS and KeyIDx shall not be an issue. I have gone through AN5401SW but not found anything which can resolve my issue.
Can we have a debug session so I can show the issue and resolve it asap
I'm not familiar with MCAL, so sorry , I may not be able to help you.
Can you change your question title and re-post this question? I think experts in MCAL might be able to help you.
sorry again.
BR!
Jim,