<?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: HAB4 and externally generated keys/certificates in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/HAB4-and-externally-generated-keys-certificates/m-p/1689287#M209409</link>
    <description>&lt;P&gt;For future reference, I'll reply to my own question, as this issue is resolved now. The certificates we were using had a few x509v3 extensions added. The extension "ExtendedKeyUsage" was set to codeSigning and was marked as critical. As it turns out, this means the certificate cannot be used to create a signed digest for the SPL/FIT images. Recreating certificates for the IMG and CSF keys without the "ExtendedKeyUsage" extension and having the "KeyUsage" extension set to digitalSignature only and marked critical removes the hab_events (that unfortunately give no information as to why a certificate is rejected).&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jul 2023 09:42:32 GMT</pubDate>
    <dc:creator>Eric-Moors</dc:creator>
    <dc:date>2023-07-20T09:42:32Z</dc:date>
    <item>
      <title>HAB4 and externally generated keys/certificates</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/HAB4-and-externally-generated-keys-certificates/m-p/1688562#M209334</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I'm trying to enforce high assurance boot on an iMX8MP based system and for this I need to sign the SPL/FIT images. To ensure the keys and certificates are treated with enough care, these are generated and stored in an externally hosted PKI system. From this system I managed to generate the SRK hash and fused it into the chip.&lt;/P&gt;&lt;P&gt;So far no problems.&lt;/P&gt;&lt;P&gt;When I however sign the SPL and FIT images with the img/csf keys (of which the public key certificates are signed using the SRK keys in the hosted PKI environment) the HAB code throws events.&lt;/P&gt;&lt;P&gt;There are several events, I can provide all if needed, but it seems to start with:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="courier new,courier"&gt;u-boot=&amp;gt; hab_status&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="courier new,courier"&gt;Secure boot disabled&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="courier new,courier"&gt;HAB Configuration: 0xf0, HAB State: 0x66&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="courier new,courier"&gt;--------- HAB Event 1 -----------------&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;event data:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0xdb 0x00 0x14 0x45 0x33 0x21 0xc0 0x00&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0xbe 0x00 0x0c 0x02 0x09 0x00 0x00 0x01&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0x00 0x00 0x08 0xa8&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="courier new,courier"&gt;STS = HAB_FAILURE (0x33)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;RSN = HAB_INV_CERTIFICATE (0x21)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;CTX = HAB_CTX_COMMAND (0xC0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;ENG = HAB_ENG_ANY (0x00)&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;--------- HAB Event 2 -----------------&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;event data:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0xdb 0x00 0x14 0x45 0x33 0x0c 0xa0 0x00&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0x00 0x00 0x00 0x00 0x40 0x1f 0xdd 0xc0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;0x00 0x00 0x00 0x20&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="courier new,courier"&gt;STS = HAB_FAILURE (0x33)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;RSN = HAB_INV_ASSERTION (0x0C)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;CTX = HAB_CTX_ASSERT (0xA0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;ENG = HAB_ENG_ANY (0x00)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I'm trying to analyze what could be wrong, and one of the suspects is the public key certificate for these signing keys. The openssl configuration in the cst tooling seems to prescribe some constraints for the certificate extension (eg. CA:false) but I cannot find any conclusive information on this topic.&lt;/P&gt;&lt;P&gt;The x509v3 extensions our certificates contain, include e.g the "(extended) key usage" fields, to limit the usage of the key to digital signatures and codesigning. Also the CRL distribution point extensions is part of the certificate. Are there any checks the HAB4 code performs on the certificates that could be causing the behavior I'm seeing?&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2023 13:20:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/HAB4-and-externally-generated-keys-certificates/m-p/1688562#M209334</guid>
      <dc:creator>Eric-Moors</dc:creator>
      <dc:date>2023-07-14T13:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: HAB4 and externally generated keys/certificates</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/HAB4-and-externally-generated-keys-certificates/m-p/1689287#M209409</link>
      <description>&lt;P&gt;For future reference, I'll reply to my own question, as this issue is resolved now. The certificates we were using had a few x509v3 extensions added. The extension "ExtendedKeyUsage" was set to codeSigning and was marked as critical. As it turns out, this means the certificate cannot be used to create a signed digest for the SPL/FIT images. Recreating certificates for the IMG and CSF keys without the "ExtendedKeyUsage" extension and having the "KeyUsage" extension set to digitalSignature only and marked critical removes the hab_events (that unfortunately give no information as to why a certificate is rejected).&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 09:42:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/HAB4-and-externally-generated-keys-certificates/m-p/1689287#M209409</guid>
      <dc:creator>Eric-Moors</dc:creator>
      <dc:date>2023-07-20T09:42:32Z</dc:date>
    </item>
  </channel>
</rss>

