When using Csec module, the key failed to be loaded, please help to see what the problem is

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

When using Csec module, the key failed to be loaded, please help to see what the problem is

Jump to solution
2,161 Views
ZEROOO
Contributor IV

Hi

    When I use Csec module, I fail to update the loading key. After executing setAuthKey, I directly load the key using loadKey (line 184, line 185). In this case, the loading of the key is successful, and the return value is 1. Call loadKey, and the load will continue to fail, return the value of 0, what is the problem?

ZEROooo_0-1680512083879.png

The following is a case where the loadKey return value is not success when debugging with IC5000.

ZEROooo_1-1680512180100.png

 

 

0 Kudos
Reply
1 Solution
2,117 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Yes, after loading of MASTER_ECU_KEY by setAuthKey function, you can load or update other keys by loadKey only with correct parameters.

Regards,

Lukas

View solution in original post

0 Kudos
Reply
5 Replies
2,145 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @ZEROOO 

do you mean that loadkey at line 184 and 185 is working and loadkey at 189 and 196 is not working? If yes, it makes sense because the counters need to be updated.

lukaszadrapa_0-1680627432797.png

But there's also next point - I really do not recommend to mix SDK and AN5401 together. More rework would be necessary in this case. For example, M1-M3 values are calculated inside the loadkey function. The calculate_M1_to_M5 won't have effect here at all.

Regards,

Lukas

 

0 Kudos
Reply
2,134 Views
ZEROOO
Contributor IV

Hi Lukas

    I still don't understand something about the key update. In AN5401, calculate_M1_to_M5 is used to update the key first, which is to obtain the value of M1-M3, so LOAD_KEY is used to load and update the key. This is the idea of AN5401, right? In SDK, firstly, setAuthKey is used to load MASTER_ECU_KEY and set it as authorization Key, and then loadKey is used to update key. Is it because loadKey in SDK already includes M1-M3 calculation? So after setting setAuthKey, you can load updates directly using loadKey? loadKey in SDK only calculates M1-M3, M4-M5 is not needed in the process of updating key, then what is the function of computeM4M5 used for?

AN5401:

ZEROooo_0-1680674247578.png

SDK:

ZEROooo_1-1680674260101.pngZEROooo_2-1680674313146.png

 

0 Kudos
Reply
2,130 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @ZEROOO 

LOAD_KEY and loadKey are not the same functions. Just open the functions in SDK example to see what's inside:

lukaszadrapa_0-1680677996920.png

lukaszadrapa_1-1680678004056.png

 Regards,

Lukas

 

 

0 Kudos
Reply
2,127 Views
ZEROOO
Contributor IV

Hi

    I seem to understand how to update the secret key, I can simply think that after setting the authorization secret key, if I use SDK, I can directly complete the update of the secret key through loadKey function, need to pay attention to the parameter Settings, is that right?

0 Kudos
Reply
2,118 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Yes, after loading of MASTER_ECU_KEY by setAuthKey function, you can load or update other keys by loadKey only with correct parameters.

Regards,

Lukas

0 Kudos
Reply