How to Load SHE Master ECU Key using NXP S32K144 and Autosar Crypto MCAL Driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Load SHE Master ECU Key using NXP S32K144 and Autosar Crypto MCAL Driver

1,458 Views
Kunal_Gettobyte
Contributor III

I am using NXP S32K144 MCU and using Autosar MCAL Crypto Driver.

I want to import AES ECB Key's in Key Slot: KEY_1, but doing so i need to at first load MASTER ECU KEY.

So does in configure Master ECU Key in MCAL Crypto GUI window.

Kunal_Gettobyte_1-1750784569047.png

 

But on using the API() Crypto_KeyElementSet(), i find our that  Crypto_Ipw_ImportKey() which is used inside this function for importing the key, have a if else condition :

Kunal_Gettobyte_0-1750784426783.png

 

Now in the case of MASTER ECU KEY ID, it doesnt fall in this if-else... so my master ecu key doesnt get loaded in CSEc SHE Peripheral IP!!!


Because of which am not able to import any key data on key slot's 1 to n.

So is the Crypto driver has bug!?? or is it some wrong at my end??

I basically want to import AES ECB and CBC key's at Key Slot 1 to n, but via Autosar MCAL Crypto Driver. How to do that!????

0 Kudos
Reply
3 Replies

1,421 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @Kunal_Gettobyte 

You are supposed to set CryptoKeyElementWriteAccess as CRYPTO_WA_ENCRYPTED. 

Per SHE specification, only RAM key can be imported in plain. NVM keys must be imported encrypted via secure memory update protocol defined by SHE spec. 

lukaszadrapa_0-1751022496743.png

Then the "if" condition will pass:

lukaszadrapa_1-1751022549768.png

Regards,

Lukas

 

0 Kudos
Reply

1,418 Views
kual_gettobyte
Contributor III

So in that case calculation and value's of m1, m2, m3 also need to be done. Is their any function available in Crypto MCAL API's for calculation m1, m2 and m3??

 

Like their is computerm1m2m3() avaliale for Non autosar SDK of S32K144:

kual_gettobyte_0-1751026349322.png

 

 

In the case of using Autosar Crypto MCAL APIs we have to create function for m1m2m3 by ourselves?

0 Kudos
Reply

1,414 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

There's no CRYPTO MCAL API because this is not defined in Autosar specification. 

In RTD drivers, you can find function App_LoadCsecKey called from App_EraseCsecKeys which shows how to calculate the M1-M3 values using Ip layer. The example can be found at path like this:

c:\NXP\S32DS.3.5\S32DS\software\PlatformSDK_S32K1_S32M24\RTD\Crypto_TS_T40D2M20I0R0\examples\S32DS\S32K1\Crypto_AesEncDec_S32K144\src\main.c

But anyway, this is usually not done in application. Keys are never distributed in plain form, the keys are always distributed in encrypted format as M1-M3 values. So, there's no reason to have such function in Crypto driver. 

Regards,

Lukas

 

0 Kudos
Reply