S32K144 CSEc CMAC Verify

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K144 CSEc CMAC Verify

ソリューションへジャンプ
930件の閲覧回数
soulyoung
Contributor I

Hello, I have encountered some issues here. When I was using CSEc's CMAC verification, I found that the message length I verified was 10500 or 105600. The CSEC_DRV_VerifyMAC function would tell me that there was an ERC_SQUENCE-ERROR, but my size changed to 105601105602 and I succeeded. What is the reason for this?

0 件の賞賛
返信
1 解決策
889件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @soulyoung 

I confirmed there's a bug in the SDK driver. 

It won't work if the message length is:

from 641 to 768

from 1537 to 1664

from 2433 to 2560

etc. 

There's wrong logic when writing MAC to CSEC PRAM memory. 

The SDK is not maintained anymore, so it won't be updated. But you can fix it like this:

Find CSEC_DRV_StartVerifMACCmd function in csec_driver.c and replace this line:

if ((macOffset + CSEC_PAGE_SIZE_IN_BYTES) < CSEC_DATA_BYTES_AVAILABLE)

with this line:

if ((g_csecStatePtr->fullSize - g_csecStatePtr->index) <= (CSEC_DATA_BYTES_AVAILABLE - CSEC_PAGE_SIZE_IN_BYTES))

Then it should work. 

Regards,

Lukas

 

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
890件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @soulyoung 

I confirmed there's a bug in the SDK driver. 

It won't work if the message length is:

from 641 to 768

from 1537 to 1664

from 2433 to 2560

etc. 

There's wrong logic when writing MAC to CSEC PRAM memory. 

The SDK is not maintained anymore, so it won't be updated. But you can fix it like this:

Find CSEC_DRV_StartVerifMACCmd function in csec_driver.c and replace this line:

if ((macOffset + CSEC_PAGE_SIZE_IN_BYTES) < CSEC_DATA_BYTES_AVAILABLE)

with this line:

if ((g_csecStatePtr->fullSize - g_csecStatePtr->index) <= (CSEC_DATA_BYTES_AVAILABLE - CSEC_PAGE_SIZE_IN_BYTES))

Then it should work. 

Regards,

Lukas

 

0 件の賞賛
返信