<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Secure boot issue on i.MX6Q in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Secure-boot-issue-on-i-MX6Q/m-p/1981663#M230129</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The word -&amp;nbsp;0x33 0x0c 0xa0 0x00 indicates an assertion event, which means one of the following required areas is not signed as documented in the operation section for authenticate_image() API.&lt;/P&gt;
&lt;P&gt;• IVT;&lt;BR /&gt;• DCD (if provided);&lt;BR /&gt;• Boot Data (initial byte - if provided);&lt;BR /&gt;• Entry point (initial word).&lt;/P&gt;
&lt;P&gt;To refer to the HABv4_API, you will get more explanations. and you can have a dump your image to check its IVT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Harvey&lt;/P&gt;</description>
    <pubDate>Fri, 25 Oct 2024 03:29:42 GMT</pubDate>
    <dc:creator>Harvey021</dc:creator>
    <dc:date>2024-10-25T03:29:42Z</dc:date>
    <item>
      <title>Secure boot issue on i.MX6Q</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Secure-boot-issue-on-i-MX6Q/m-p/1980101#M230034</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I'm trying to create a secure boot setup on a custom i.MX6Q board based on the Sabre design and have faced an issue with HAB error messages with a signed U-Boot image.&lt;/P&gt;&lt;P&gt;Here is what I did:&lt;/P&gt;&lt;P&gt;1. Generated secure keys using the CST 3.4.1 with the following command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;./hab4_pki_tree.sh -existing-ca n -kt rsa -kl 2048 -duration 100 -num-srk 4 -srk-ca y&lt;/LI-CODE&gt;&lt;P&gt;2. Created the hash table and fuse files:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;cd ../crts

../linux64/bin/srktool -h 4 -t SRK_1_2_3_4_table.bin -e SRK_1_2_3_4_fuse.bin -d sha256 -c SRK1_sha256_2048_65537_v3_usr_crt.pem,SRK2_sha256_2048_65537_v3_usr_crt.pem,SRK3_sha256_2048_65537_v3_usr_crt.pem,SRK4_sha256_2048_65537_v3_usr_crt.pem -f 1

Number of certificates = 4
SRK table binary filename = SRK_1_2_3_4_table.bin
SRK Fuse binary filename = SRK_1_2_3_4_fuse.bin
SRK Fuse binary dump:
SRK HASH[0] = 0x71807F6D
SRK HASH[1] = 0xC7712A7B
SRK HASH[2] = 0x4FD1F177
SRK HASH[3] = 0xD9B6A0BA
SRK HASH[4] = 0x6C68932D
SRK HASH[5] = 0xA39A2D5A
SRK HASH[6] = 0x31E7FE5E
SRK HASH[7] = 0x7E7146C7&lt;/LI-CODE&gt;&lt;P&gt;3. Programmed the fuses to the OTP. The OTP words match the one generated by srktool:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=&amp;gt; fuse read 3 0 8
Reading bank 3:

Word 0x00000000: 71807f6d c7712a7b 4fd1f177 d9b6a0ba
Word 0x00000004: 6c68932d a39a2d5a 31e7fe5e 7e7146c7&lt;/LI-CODE&gt;&lt;P&gt;4. Took the&amp;nbsp;u-boot-sd-2023.04-r0.imx file (size&amp;nbsp;748544 bytes) built in Yocto.&lt;/P&gt;&lt;P&gt;5. Edited a CST configuration example file&amp;nbsp;csf_image0-my.txt:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[Header]
        Version = 4.3
        Hash Algorithm = sha256
        Engine = CAAM
        Engine Configuration = 0
        Certificate Format = X509
        Signature Format = CMS
[Install SRK]
        File = "/home/dk/legrand/cst-3.4.1/crts/SRK_1_2_3_4_table.bin"
        Source index = 0
[Install CSFK]
        File = "/home/dk/legrand/cst-3.4.1/crts/CSF1_1_sha256_2048_65537_v3_usr_crt.pem"
[Authenticate CSF]
[Unlock]
&amp;lt;------&amp;gt;Engine = CAAM
&amp;lt;------&amp;gt;Features = RNG
[Install Key]
        Verification index = 0
        Target index = 2
        File = "/home/dk/legrand/cst-3.4.1/crts/IMG1_1_sha256_2048_65537_v3_usr_crt.pem"
[Authenticate Data]
        Verification index = 2
        Blocks = 0x177FF400 0x00000000 0x000B6C00 "u-boot-sd-2023.04-r0.imx"&lt;/LI-CODE&gt;&lt;P&gt;6. Signed the U-Boot image as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;cst --i csf_image0-my.txt --o csf_image0-my.bin &amp;amp;&amp;amp; cat u-boot-sd-2023.04-r0.imx csf_image0-my.bin &amp;gt; my-signed-u-boot&lt;/LI-CODE&gt;&lt;P&gt;7. When the my-signed-u-boot image is booted on the board from USB or EMMC, I get the following messages in hab_status:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=&amp;gt; hab_status                                                                                                                                                                                              
                                                                                                                                                                                                           
Secure boot disabled                                                                                                                                                                                       
                                                                                                                                                                                                           
HAB Configuration: 0xf0, HAB State: 0x66                                                                                                                                                                   
                                                                                                                                                                                                           
--------- HAB Event 1 -----------------                                                                                                                                                                    
event data:                                                                                                                                                                                                
        0xdb 0x00 0x14 0x41 0x33 0x0c 0xa0 0x00                                                                                                                                                            
        0x00 0x00 0x00 0x00 0x17 0x7f 0xf4 0x00                                                                                                                                                            
        0x00 0x00 0x00 0x20                                                                                                                                                                                
                                                                                                                                                                                                           
STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)


--------- HAB Event 2 -----------------
event data:
        0xdb 0x00 0x14 0x41 0x33 0x0c 0xa0 0x00
        0x00 0x00 0x00 0x00 0x17 0x7f 0xf4 0x20
        0x00 0x00 0x00 0x01

STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)


--------- HAB Event 3 -----------------
event data:
        0xdb 0x00 0x14 0x41 0x33 0x0c 0xa0 0x00
        0x00 0x00 0x00 0x00 0x17 0x80 0x00 0x00
        0x00 0x00 0x00 0x04

STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)


--------- HAB Event 4 -----------------
event data:
        0xdb 0x00 0x14 0x41 0x33 0x0c 0xa0 0x00
        0x00 0x00 0x00 0x00 0x00 0x91 0x00 0x00
        0x00 0x00 0x02 0xf8

STS = HAB_FAILURE (0x33)
RSN = HAB_INV_ASSERTION (0x0C)
CTX = HAB_CTX_ASSERT (0xA0)
ENG = HAB_ENG_ANY (0x00)


--------- HAB Event 5 -----------------
event data:
        0xdb 0x00 0x14 0x41 0x33 0x1d 0xc0 0x00
        0xbe 0x00 0x0c 0x00 0x03 0x17 0x00 0x00
        0x00 0x00 0x00 0x50

STS = HAB_FAILURE (0x33)
RSN = HAB_INV_KEY (0x1D)
CTX = HAB_CTX_COMMAND (0xC0)
ENG = HAB_ENG_ANY (0x00)&lt;/LI-CODE&gt;&lt;P&gt;Is there any mistake in my key generation/image signing procedure? What does the HAB failure message may indicate?&lt;/P&gt;&lt;P&gt;Any help with this issue is highly appreciated.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dmitry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 10:16:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Secure-boot-issue-on-i-MX6Q/m-p/1980101#M230034</guid>
      <dc:creator>Demc</dc:creator>
      <dc:date>2024-10-23T10:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Secure boot issue on i.MX6Q</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Secure-boot-issue-on-i-MX6Q/m-p/1981663#M230129</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The word -&amp;nbsp;0x33 0x0c 0xa0 0x00 indicates an assertion event, which means one of the following required areas is not signed as documented in the operation section for authenticate_image() API.&lt;/P&gt;
&lt;P&gt;• IVT;&lt;BR /&gt;• DCD (if provided);&lt;BR /&gt;• Boot Data (initial byte - if provided);&lt;BR /&gt;• Entry point (initial word).&lt;/P&gt;
&lt;P&gt;To refer to the HABv4_API, you will get more explanations. and you can have a dump your image to check its IVT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Harvey&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 03:29:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Secure-boot-issue-on-i-MX6Q/m-p/1981663#M230129</guid>
      <dc:creator>Harvey021</dc:creator>
      <dc:date>2024-10-25T03:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Secure boot issue on i.MX6Q</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Secure-boot-issue-on-i-MX6Q/m-p/1988037#M230525</link>
      <description>&lt;P&gt;Hi Harvey,&lt;/P&gt;&lt;P&gt;Thanks for the pointers, they helped. I was able to find out that the problem was with the SRK key as HAB complained about the key in&amp;nbsp;HAB Event 5 in the log.&lt;/P&gt;&lt;P&gt;I seem to find the cause of the issue and it looks like a bug in the srktool utility. In a third-party sample of usage of the utility I noticed that the&amp;nbsp;SRK certificate names are prepended with the "./" characters. When I modified the command as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;../linux64/bin/srktool -h 4 -t SRK_1_2_3_4_table.bin -e SRK_1_2_3_4_fuse.bin -d sha256 -c ./SRK1_sha256_2048_65537_v3_usr_crt.pem,./SRK2_sha256_2048_65537_v3_usr_crt.pem,./SRK3_sha256_2048_65537_v3_usr_crt.pem,./SRK4_sha256_2048_65537_v3_usr_crt.pem -f 1&lt;/LI-CODE&gt;&lt;P&gt;I got different&amp;nbsp;SRK_1_2_3_4_table.bin and&amp;nbsp;SRK_1_2_3_4_fuse.bin files which made the signed image pass the HAB signature check (on another board, obviously, as the SRK hash changed and the first board is programmed with a wrong hash).&lt;/P&gt;&lt;P&gt;In the help strings printed by srktool there are no mentions that the "./" characters are mandatory. It only mentions that a file name can be prepended with the # sign to include the hash digest in the table file:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; -c, --certs &amp;lt;srk1&amp;gt;,&amp;lt;srk2&amp;gt;,...,&amp;lt;srk4&amp;gt;:
      X.509v3 certificate filenames.
        - Certificates may be either DER or PEM encoded format
        - Certificate filenames must be separated by a ','with no spaces
        - A maximum of 4 certificate filenames may be provided. Additional
          certificate names are ignored
        - Placing a % in front of a filename replaces the public
          key data in the SRK table with a corresponding hash digest&lt;/LI-CODE&gt;&lt;P&gt;Also, there are no "./" in the samples in the help strings:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    srktool --hab_ver 4 --table table.bin  --efuses fuses.bin \ 
            --digest sha256 \ 
            --certs srk1_crt.pem,srk2_crt.pem,%srk3_crt.pem&lt;/LI-CODE&gt;&lt;P&gt;Shouldn't this be fixed in srktool?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 14:56:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Secure-boot-issue-on-i-MX6Q/m-p/1988037#M230525</guid>
      <dc:creator>Demc</dc:creator>
      <dc:date>2024-11-05T14:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Secure boot issue on i.MX6Q</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Secure-boot-issue-on-i-MX6Q/m-p/1988654#M230558</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I usually use the srktool for SRK table and fuse generation by following up the format as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;$ ../linux64/bin/srktool -h 4 -t SRK_1_2_3_4_table.bin -e \&lt;BR /&gt;  SRK_1_2_3_4_fuse.bin -d sha256 -c \&lt;BR /&gt;  SRK1_sha256_2048_65537_v3_ca_crt.pem,\&lt;BR /&gt;  SRK2_sha256_2048_65537_v3_ca_crt.pem,\&lt;BR /&gt;  SRK3_sha256_2048_65537_v3_ca_crt.pem,\&lt;BR /&gt;  SRK4_sha256_2048_65537_v3_ca_crt.pem&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Which can be found from here&amp;nbsp;&lt;A href="https://github.com/nxp-imx/uboot-imx/blob/lf_v2024.04/doc/imx/habv4/introduction_habv4.txt" target="_self"&gt;introduction_habv4.txt&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;One thing to be noted, No space between certificate filenames and just the ",". Otherwise, the different fuse values would be expected.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Harvey&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 08:41:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Secure-boot-issue-on-i-MX6Q/m-p/1988654#M230558</guid>
      <dc:creator>Harvey021</dc:creator>
      <dc:date>2024-11-06T08:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Secure boot issue on i.MX6Q</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Secure-boot-issue-on-i-MX6Q/m-p/1989807#M230600</link>
      <description>Hi Harvey,&lt;BR /&gt;&lt;BR /&gt;It turned out that I initially used wrong USR (SRK1_sha256_2048_65537_v3_usr_crt.pem) keys instead of the CA (SRK1_sha256_2048_65537_v3_ca_crt.pem). The old key files might have stayed from some previous key generation attempt.&lt;BR /&gt;&lt;BR /&gt;So, no issues with srktool, just my mistake.&lt;BR /&gt;&lt;BR /&gt;Thanks for your help!</description>
      <pubDate>Thu, 07 Nov 2024 06:06:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Secure-boot-issue-on-i-MX6Q/m-p/1989807#M230600</guid>
      <dc:creator>Demc</dc:creator>
      <dc:date>2024-11-07T06:06:50Z</dc:date>
    </item>
  </channel>
</rss>

