S32K144 CSEc Calculate M1~M5

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

S32K144 CSEc Calculate M1~M5

ソリューションへジャンプ
1,618件の閲覧回数
wangmingming
Contributor III

It is mentioned in the document that loading the secret key is to first calculate M1~M5, and then call the interface to load the secret key. M4_out and M5_out will be returned. By comparing M4, M5 and M4_out M5_out, If both are consistent, it indicates that the key has been successfully loaded, otherwise the loading fails. I found in actual testing that the loading interface returns 0, but M4, M5, M4_out, and M5_out are quite inconsistent. Is this considered a successful or failed loading?1.png

0 件の賞賛
返信
1 解決策
1,543件の閲覧回数
wangmingming
Contributor III

Yes, I made a mistake before and printed their addresses, so the values are different. Modify to print numerical values, their values are the same. thank you5.png

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,596件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @wangmingming 

CSEc always uses UID when calculating M4 and M5 values which are returned after loading a key. It's given by SHE specification - it says that UID should be used for M4 and M5 calculation. It does not talk about wildcard in case of this functionality. This behavior cannot be changed.
So, if you used attribute WILDCARD = 0 when calculating M1-M5 values, the M4 and M5 will be really different.
If 0 was returned, the key was loaded. If you want to double checked that also by comparing M4 and M5, it would be necessary to use UID.

Regards,
Lukas

0 件の賞賛
返信
1,585件の閲覧回数
wangmingming
Contributor III

As shown in the figure below, when I set WILDCARD to 1 and plug it into the calculation interface, the M4 and M4_out, M5 and M5_out obtained are still different. How do I configure them to make them the same?2.png

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

There's one more option. Please take a look at code examples in application note AN5401.

In calculate_M1_to_M5() function, wildcard and UID=0 is used for M1-M3 calculation. However, M4 and M5 is calculated with UID:

lukaszadrapa_0-1736164234091.png

The result is that M4-M5 values are the same after key load even if wildcard is used:

lukaszadrapa_1-1736164276387.png

Regards,

Lukas

0 件の賞賛
返信
1,544件の閲覧回数
wangmingming
Contributor III

Yes, I made a mistake before and printed their addresses, so the values are different. Modify to print numerical values, their values are the same. thank you5.png

0 件の賞賛
返信