Secure boot pakcage on LPC55S69 ?

cancel
Showing results for 
Search instead for 
Did you mean: 

Secure boot pakcage on LPC55S69 ?

1,745 Views
mohammed_aitben
Contributor II

Hello evryone

I am following the AN12283 document but this is not enough.

Any help to find a package example please ?

best regards 

Labels (1)
21 Replies

973 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Mohammed AIT-BENDAOUD

secure boot is not as same as mcu boot. mcu boot has source code, but secure boot doesn't have.

Secure boot code is burned in to LPC5569 ROM before out-of-factory. It won't be shared to public anyway.

For secure boot users, we just need enable and use command of AN12283, thus we can use the secure boot feature.

the demo of command usage is attached.

Have a great day,
Jun Zhang

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

973 Views
mohammed_aitben
Contributor II

Thank for your reply,

I was talking about the package demo. I know that secure boot has secure immutable code not like mcu boot source code.

I am following the AN12283 doc.

I am in SB2 file loading.

 i get this error when i enter command with blhost under ISP: 

   Ping responded in 1 attempt(s)
   Inject command 'receive-sb-file'
   Preparing to send 12528 (0x30f0) bytes to the target.
   Successful generic response to command 'receive-sb-file'
   Error: read_start_byte() timeout after 5.095 seconds
   Data phase write aborted by status 0x5 kStatus_Timeout
   Error: read_start_byte() timeout after 5.113 seconds
   Response status = 10004 (0x2714) No response packet from target device.
   Wrote 0 of 12528 bytes.

Any help please.

Best Regards 

0 Kudos

973 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi

What's your LPC55S69 version? 1B or 0A? 

If you don't know. follow this link to check it

https://community.nxp.com/docs/DOC-345272?sr=search&searchId=88e882b8-242c-4ab4-90ce-080a13db669e&se... 

Thanks,

Jun Zhang

0 Kudos

973 Views
mohammed_aitben
Contributor II

I am using LC55S69 version 1B.

Now i have this error :

   Ping responded in 1 attempt(s)
   Inject command 'receive-sb-file'
   Preparing to send 4720 (0x1270) bytes to the target.
   Successful generic response to command 'receive-sb-file'
   (1/1)32%Data phase write aborted by status 0x2712 kStatus_AbortDataPhase
   Possible JUMP or RESET command received.
   Response status = 10101 (0x2775) kStatusRomLdrSignature
   Wrote 1536 of 4720 bytes.

Thanks

0 Kudos

973 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Mohammed

The 0A version of the LPC55S6xx silicon supports version 2.0 of the SB image format.

The 1B version of the LPC55S6xx silicon supports version 2.1 of the SB image format.

The main difference between version 2.0 and version 2.1 is in the usage of the digital signature.

SB 2.0 is encrypted and SB2.1 is encrypted + signed.

So please make sure the SB file is correctly set.

I suggest you also check this discussion

https://community.nxp.com/thread/521046 

Have a great day,
Jun Zhang

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

973 Views
mohammed_aitben
Contributor II

Thanks for details.

The main difference is in the commande.bd file ?

 

options {
flags = 0x8; // 0x4 //encrypted // 0x8 encrypted + signed
buildNumber = 0x1;
productVersion = "1.00.00";
componentVersion = "1.00.00";
secureBinaryVersion = "2.1";
}

sources {
mainImage = "path_o_signed_image.bin";
}

section (0) {
erase 0x0000..0x40000;
load mainImage > 0x0;
//call mainImage;
//reset;
}

I tried with this config but not better !

The AN12283 doesn't differentiate between SB2.0 and SB2.1 !

Can you confirm that the CFPA binary and others files into the demo package don't change for both SB2 versions ?

Thanks

0 Kudos

973 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

I prepared a post, which includes an answer of your questions. I hope the next version of AN12283 will have it update.

SB File Preparation and Usage on LPC556xx 1B Version 

Hope this will help you.

Have a great day,
Jun Zhang

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

973 Views
mohammed_aitben
Contributor II

Thank you for your post. It works as well on 1B revision.

BUT

Questions : 

you don't explain why SB2.1 version have to be encrypted and signed before loading ? can we have we have a diagram for secure boot chain ?

Other question please :

Debug don't work on 1B revision chip. I can't display hello world after SB2.1 loading. I tried without SB2 but debug still don't work ? Any idea ?

Thanks

Best regards 

0 Kudos

973 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

For the security reason, SB2.1 version have to be encrypted and signed, this format is same as CPMA definition.

Once Secure boot is enabled, for each power on, secure boot check will process. and we can't connect and debug code with debugger.  

 

0 Kudos

973 Views
mohammed_aitben
Contributor II

Hey,

If i enabled secure boot in my chip, and i want debug my application after, it's possible or not ? 

If yes, in this case for each appli i have to bring new chip for debug ?

Thanks 

best regards 

0 Kudos

973 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

>>If i enabled secure boot in my chip, and i want debug my application after, it's possible or not ? 

if you enable secure boot, it's NOT possible to debug. secure boot is enabled in the last step when product gets out of factory. 

0 Kudos

973 Views
mohammed_aitben
Contributor II

Understood. 

But it seems weird to not be able to debug or display in hyper terminal after secure boot enabled !

it's possible to disable SB ?

In the other hand when i want to write another image to the device i can't, i did an erase-all flash memory but i get this : Response status = 10001 (0x2711) Command disallowed when security is enabled.

 

blhost -p COM13 get-property 17
Ping responded in 1 attempt(s)
Inject command 'get-property'
Response status = 0 (0x0) Success.
Response word 1 = -1019428036 (0xc33cc33c)
Security State = SECURE

have you an idea please ?

Thanks fro support.

best regards

0 Kudos

973 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Unfortunately, Once secure boot is enabled, we can't disable it.

did you download sb file with "blhost -p COMxx receive-sb-file " successfully?  If yes, I just consult your problem with my SE colleague, it can print to uart without issue.

0 Kudos

973 Views
mohammed_aitben
Contributor II

Hey,

Thank your for reply.

My answers/questions in blue below.

Unfortunately, Once secure boot is enabled, we can't disable it.

OK for that.

did you download sb file with "blhost -p COMxx receive-sb-file " successfully?  If yes, I just consult your problem with my SE colleague, it can print to uart without issue.

Yes it worked for the first time but once i want to update another image (write-memory) i can't, usually to fix it i erase-all memory and i unlock the write-memory but this time i get this error : "Response status = 10001 (0x2711) Command disallowed when security is enabled." ?

I will take the opportunity to ask you some others questions that I ask myself for the moment :

      1- If I understood correctly, we can't debug once secure boot is enabled, therefore we can't talk about secure debug too ?

      2- I don't know how secure boot ROM it works because i don't have access, but in this sense can you confirm that the ROM code doesn't enable TZEN for SB security features ?

      3- Last question but not least, in your SDK last release you provide TFM implementation ? Can you please explain the perspectives of this implem and the eventual use cases ? 

            I mean today your SB doesn't relies to PSA-RoT so i can't understand if your are planing to integer in SB or others appli ?

0 Kudos

973 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

>>Yes it worked for the first time but once i want to update another image (write-memory) i can't, usually to fix it i erase-all memory and i unlock the write-memory but this time i get this error : "Response status = 10001 (0x2711) Command disallowed when security is enabled." ?

how did you write another image? can you check if this "another image" is a correct one that can be well-recognized by secure boot? this problem ever happened if the SB2 file is incorrect.  if the SB2 incorrect, it can not print to uart, neither execute other image functions.

Once SB is enabled, we can't mass flash with debugger tool.

Regarding to your additional question, please create a new thread. this thread is already too long. Thanks for your understanding.

 

0 Kudos

973 Views
mohammed_aitben
Contributor II

Okay i created a new thread for my questions.

how did you write another image? can you check if this "another image" is a correct one that can be well-recognized by secure boot? this problem ever happened if the SB2 file is incorrect.  if the SB2 incorrect, it can not print to uart, neither execute other image functions.

What do you mean by a correct image ? i have a new image with .bin format and i signed by elftosb with new keys !

Once SB is enabled, we can't mass flash with debugger tool.

OK So, how we can write a new image to the device ?

Thanks

Best regards

0 Kudos

973 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

How did you burn the image first time? what command did you use?

if you are referring an12283,  first time download we can use bin file but the second time download we must use capsuled SB2 file. 

Did you do so?

0 Kudos

973 Views
mohammed_aitben
Contributor II

For the first time i used this command in blhost : blhost -p COMX write-memory 0 path_to_signed_image.bin

If you are referring an12283,  first time download we can use bin file but the second time download we must use capsuled SB2 file. 

I agree with you. 

But if i decide to change private key and certificates to write a new image signed with new keys, it should work ?

Thanks

0 Kudos

973 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

>>But if i decide to change private key and certificates to write a new image signed with new keys, it should work ?

Yes, it still work.

BTY, to using the SB2 file, please refer this article.  AN12283 5.6.2 and 5.6.3 needs to be updated, it was for 0A version not for 1B

SB File Preparation and Usage on LPC556xx 1B Version 

0 Kudos

970 Views
mohammed_aitben
Contributor II

Ok, referring to your post :

Example of use (Encrypted + Signed SB):

1 root key

elftosb.exe -f lpc55xx -k "sbkek.txt" -c "commandFile.bd" -o "output.sb2" -s "selfsign_privatekey_rsa2048.pem" -S "selfsign_v3.der.crt" -R "selfsign_v3.der.crt" -h "RKTH.bin" "input.bin"

What i do :

>elftosb -V -f lpc55xx -k \sbkek.txt" -c \commandFile.bd" -o \output.sb2" -s \private_key_1_2048.pem -S \certificate_1_2048.der.crt -R \certificate_1_2048.der.crt -h \hello_world.bin

return :
   Boot Section 0x00000000:
   ERAS | adr=0x00000000 | cnt=0x00040000 | flg=0x0000
   LOAD | adr=0x00000000 | len=0x00003414 | crc=0x234d19db | flg=0x0000

   RKTH: 8fd6e82bbdaddb003f4f0547ded828575fa7abb763404f08b4e428609b42ca49

This command return me the same RKTH i generated with signature previously.

What wrong ?

thanks 

0 Kudos