csec calculating M4/M5 OFF LINE

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

csec calculating M4/M5 OFF LINE

Jump to solution
1,679 Views
hajianik
Senior Contributor I

Hi,

The following questions is in regard to the application note AN5401 appendix A Generating M1 to M5,

In particular focusing on M4 and M5.

Just need to confirm it as I believe my assumption is correct.

  • To calculate the M4  for the key to be provisioned we need to know the counter value associated with the update.
  • To calculate the M5 for the key to be provisioned we need to know the value of the key to be provisioned.

Thanks,

Koorosh Hajiani

0 Kudos
1 Solution
1,606 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@hajianik

   You can’t calculate M4,M5 based only on values of M1,M2,M3 off-line! This calculation process is irreversible. I have confirmed this with our experts again. 

Senlent_0-1628837028633.png

      Sorry for the wrong understanding of your question, it is necessary to remind you not to try illegal cracking, you need to ask your supplier to provide a complete M value

BR!

Jim.

 

View solution in original post

0 Kudos
7 Replies
1,667 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@hajianik

Senlent_0-1628561561508.png

Senlent_2-1628561616925.png

I thank your assumption is correct.

Here are a few documents for reference, you can try to find them on the official website. 

Senlent_3-1628561716882.png

BR!

 Jim.

 

 

0 Kudos
1,660 Views
hajianik
Senior Contributor I

Thanks for your response.

So Could you tell me please;

The M1 and M2 and M3 numbers , particularly  M2 :

Will have the new key value and the counter( the new key is associated with) embedded in them?

and if so where are they?

M1[0],M2[1],M2[2],M3[3] which one?

Thanks

0 Kudos
1,649 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@hajianik

      I don’t quite understand what ‘numbers’ mean.

     This is a DEMO to calculate the value of M, you can refer to it.

Senlent_0-1628649420978.pngSenlent_1-1628649467357.png

2. I don't know if you have the DEMO project code, here I will post a link, if you don't have one, you can refer to it.

AN5401SW-

https://community.nxp.com/t5/S32K/Who-can-share-S32K-secure-boot-sample-AN5401SW-zip/td-p/797807 

How to use-

https://community.nxp.com/t5/S32-Design-Studio/How-to-compile-AN5401SW-zip-in-S32-Design-studio-for-... 

 

Hope these reference routines can help you.

BR!

Jim.

 

 

 

0 Kudos
1,638 Views
hajianik
Senior Contributor I

Hi,

using the code in the project, we will generate values for M1[4] and M2[8] and M3[4] based on the new key value and the counter and the key slot and authorizing key.

NOW MY QUESTION IS VERY SIMPLE;

the COUNTER VALUE and  THE NEW KEY VALUE  which was used to generate M1,M2,M3, are in any way reflected in the values for M1,M2,M3 ? Are they in a decrypted form embedded in M1,M2,M3.

Could you answer that?

You keep referring me to this document,I've read those ,and I couldn't find the answer, that's why I'm asking NXP.

Thanks

0 Kudos
1,628 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@hajianik

Both ‘COUNTER VALUE’ and ‘NEW KEY VAULE’ are used to generate M2.

CID : (COUNTER VALUE) Key Counter ,related to user key.

KEY(ID):NEW KEY VALUE.

Senlent_0-1628735833346.png

The counter value related to user key.

Senlent_1-1628735833367.png

Is this the answer you are looking for? 

Note:

Each time the KEY content is updated, the MCU will automatically update the CID value. Therefore, when calculating the M value offline, you need to record the number of times the KEY has been modified.

Example1:Update KEY_1

Senlent_2-1628735833471.png

Example2:Update KEY_1

Senlent_3-1628735833534.png

      Due to the geographical time difference, it was a bit late to reply to you. If I understand your question incorrectly, please let me know in time.

BR!

 Jim.

0 Kudos
1,621 Views
hajianik
Senior Contributor I

Hi,

I already know that,and I've stated this in my previous posts.

My  question for the last time is:

lets assume the following scenario:

Some customers will supply myself with the Values of M1,M2,M3 which are linked to a specific counter and a new key.

I have no other information, nothing else.

Can I calculate M4,M5 based only on values of M1,M2,M3 offline?

I KNOW HOW TO LOAD  A KEY BY USING THE NXP SUPPLIED FUNCTIONS:

uint16_t LOAD_KEY(uint32_t *M4_out, uint32_t *M5_out, uint32_t *M1_in, uint32_t *M2_in, uint32_t *M3_in, uint8_t key_id)

AS I HAVE DONE IT MYSELF AND GET M4/M5, I want to use the offline calculation as a check to LOAD_KEY routine.

 

I do appreciate your effort in answering my question, it could be my English which is misunderstood, but at this point I think you could share this with an expert colleague where he/she might know this.

 

BR

0 Kudos
1,607 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@hajianik

   You can’t calculate M4,M5 based only on values of M1,M2,M3 off-line! This calculation process is irreversible. I have confirmed this with our experts again. 

Senlent_0-1628837028633.png

      Sorry for the wrong understanding of your question, it is necessary to remind you not to try illegal cracking, you need to ask your supplier to provide a complete M value

BR!

Jim.

 

0 Kudos