S32K116 - CSEC_DRV_GenerateMAC Calculates Signature Different than other sources

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

S32K116 - CSEC_DRV_GenerateMAC Calculates Signature Different than other sources

跳至解决方案
533 次查看
muhammetkalayci
Contributor II

uint8_t plainKey[] = {0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB,0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB, 0xAB};

CSEC_DRV_Init(&csecState);
CSEC_DRV_LoadPlainKey(plainKey);

CSEC_DRV_GenerateMAC(CSEC_RAM_KEY, msg, msg_len, cmac, &timeout);

*I use 179 byte message as msg, so msg_len=179.

*16 byte output buffer as cmac.

*timout = 0;

 

I used same parameters in different libraries to confirm if SDK calculates the right value;

mbedtls calculated a different cmac signature than SDK.

python cryptography library calculated same cmac signature with mbedtls.

a web tool calculated the same signature with mbedtls.

 

What could be the problem here? 

What am I possibly doing wrong?

 

标记 (2)
0 项奖励
回复
1 解答
513 次查看
muhammetkalayci
Contributor II

alright I solved it.

msg_len must be in bits... so in my case it must be 179*8...

在原帖中查看解决方案

0 项奖励
回复
1 回复
514 次查看
muhammetkalayci
Contributor II

alright I solved it.

msg_len must be in bits... so in my case it must be 179*8...

0 项奖励
回复