MCAL: S32K148: Getting ERC_KEY_INVALID for CSEC jobs(e.g Csec_EncryptEcb)

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

MCAL: S32K148: Getting ERC_KEY_INVALID for CSEC jobs(e.g Csec_EncryptEcb)

跳至解决方案
548 次查看
Pravin_Javalge
Contributor IV


Hello,

I am using MCAL 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

BR,
Pravin

0 项奖励
1 解答
539 次查看
namnguyenviet
NXP Employee
NXP Employee

Hello,

Please verify that your flag attributes were set correctly. Probably the bit was written to the KEY_USAGE flag instead of the WILDCARD field. 

namnguyenviet_0-1642415066880.png

You can try this way: write another key value with flag = 0 in all fields and different counter to a key, then use that key to encrypt. If it can be performed, then probably the key attributes were set incorrectly with previous key value.

Best Regards,

Nam

 

在原帖中查看解决方案

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

Hello,

Please verify that your flag attributes were set correctly. Probably the bit was written to the KEY_USAGE flag instead of the WILDCARD field. 

namnguyenviet_0-1642415066880.png

You can try this way: write another key value with flag = 0 in all fields and different counter to a key, then use that key to encrypt. If it can be performed, then probably the key attributes were set incorrectly with previous key value.

Best Regards,

Nam

 

0 项奖励