<?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: imx6 secure boot with encryption in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609466#M91901</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/YuriMuhin_ng"&gt;YuriMuhin_ng&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I worked all of your information through and I still get this HAB event mentioned eralier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the help of "HAB4_API.pdf" I identificated the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So most likely my error says that I use a "Proprietary AEAD MAC format"...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please explain, what this means?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance and have a grat day,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Frieder&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 31 Oct 2016 07:26:55 GMT</pubDate>
    <dc:creator>friederbaumgrat</dc:creator>
    <dc:date>2016-10-31T07:26:55Z</dc:date>
    <item>
      <title>imx6 secure boot with encryption</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609463#M91898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear NXP community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a board with an imx6 processor set in closed configuration (for secure boot).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Signing an image (or more) works perfectly fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to encrypt an image. That's where all the trouble begins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all, I have to mention, that I don't want to encrypt the first image loaded after the ROM boot loader, but that shouldn't be a problem (or am I wrong?).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to use the encryption with the Code Signing Tool provided by nxp, I linked the tool with following commands:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;cd ~/cst-2.3.2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;gcc -o cst_encrypt -I ../hdr -L ../../../linux64/lib *.c -lfrontend -lcrypto&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There were no errors reported.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the tool is able to encrypt my image.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this I created a command sequence file with following content:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;----- Beginn file.csf -----&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[Header]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Version = 4.1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hash Algorithm = sha256&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Certificate Format = X509&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Signature Format = CMS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Engine = ANY&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Engine Configuration = 0&lt;BR /&gt;[Install SRK]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; File = "./crts/SRK_Table.bin"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Source index = 0&lt;BR /&gt;[Install CSFK]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; File = "./crts/CSF1_1_sha256_2048_65537_v3_usr_crt.pem"&lt;BR /&gt;[Authenticate CSF]&lt;BR /&gt;[Unlock]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Engine = CAAM&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Features = RNG&lt;BR /&gt;[Install Key]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; File = "./crts/IMG1_1_sha256_2048_65537_v3_usr_crt.pem"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Verification index = 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Target index = 2&lt;BR /&gt;[Authenticate Data]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Verification index = 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Blocks =&amp;nbsp; 0x10100000 0x0 0x1000 "image_to_be_encrypted"&lt;BR /&gt;[Install Secret Key]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Verification index = 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Target index = 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Key = "dek.bin"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Key Length = 256&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Blob address = 0x1017FFA0&lt;BR /&gt;[Decrypt Data]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Verification index = 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mac Bytes = 16&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Blocks = 0x10101000 0x1000 0xF000 "image_to_be_encrypted"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;----- end file.csf -----&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I am running:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;./linux64/cst_encrypt --o encrypted.bin --i file.csf --cert ./crts/dek_protection_key.pem&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output is my signed and encrypted image. After this, I transfer the generated &lt;STRONG&gt;dek.bin&lt;/STRONG&gt; to the imx6 board and create the key using the &lt;STRONG&gt;dek_blob&lt;/STRONG&gt; function provided by uboot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This output is attached to the image at the address 0x1017FFA0 and then padded to 0x80000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I transfer the image to my board, I have a little check function which checks whether the image is signed or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For this function I use the HAB function &lt;STRONG&gt;hab_status_t(* hab_rvt::run_csf)(const uint8_t *csf, uint8_t cid). &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using this function, I get no errors, but when I want to save the image I get this HAB event:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HAB Configuration: 0xcc HAB State: 0x99&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;---------- HAB EVENT 1 ----------&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;event data:&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; 0xdb 0x00 0x1c 0x41 0x33 0x18 0xc0 0x1d&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; 0xca 0x00 0x14 0x00 0x00 0xa3 0x00 0x00&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; 0x00 0x00 0x0f 0x64 0x10 0x10 0x10 0x00&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; 0x00 0x00 0xf0 0x00&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am pretty lost right now, I don't have any more ideas what I can do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The image has a length of 0x80000 and is loaded to 0x10100000 in the boards RAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to mention, everything works smootly when I only use signed images.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope someone can help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best wishes,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Frieder&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Oct 2016 13:13:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609463#M91898</guid>
      <dc:creator>friederbaumgrat</dc:creator>
      <dc:date>2016-10-27T13:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: imx6 secure boot with encryption</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609464#M91899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; The following may be helpful :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/docs/DOC-332147"&gt;Encrypted U-boot Example&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/docs/DOC-330622"&gt;Encrypted boot loader on SabreSD i.MX6q board&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://boundarydevices.com/high-assurance-boot-hab-dummies/" title="https://boundarydevices.com/high-assurance-boot-hab-dummies/"&gt;https://boundarydevices.com/high-assurance-boot-hab-dummies/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Please use Appendix A (Interpreting HAB Event Data from Report_Event() API) of the &lt;BR /&gt;“HAB4_API.pdf” in the CST package to define the HAB event reason. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;Yuri&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Oct 2016 06:58:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609464#M91899</guid>
      <dc:creator>Yuri</dc:creator>
      <dc:date>2016-10-28T06:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: imx6 secure boot with encryption</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609465#M91900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Yuri,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I already saw these examples and read them carefully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I forgot to mention earlier,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;encrypting the first image after the ROM boot loader works perfectly fine. My only problem is encrypting a second image.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Frieder&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Oct 2016 07:16:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609465#M91900</guid>
      <dc:creator>friederbaumgrat</dc:creator>
      <dc:date>2016-10-28T07:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: imx6 secure boot with encryption</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609466#M91901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/YuriMuhin_ng"&gt;YuriMuhin_ng&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I worked all of your information through and I still get this HAB event mentioned eralier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the help of "HAB4_API.pdf" I identificated the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So most likely my error says that I use a "Proprietary AEAD MAC format"...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please explain, what this means?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance and have a grat day,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Frieder&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Oct 2016 07:26:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609466#M91901</guid>
      <dc:creator>friederbaumgrat</dc:creator>
      <dc:date>2016-10-31T07:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: imx6 secure boot with encryption</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609467#M91902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Please try using parameter&amp;nbsp;&lt;SPAN class=""&gt;Engine = CAAM &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;in [Header] section of Your .csf file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #f6f6f6; font-size: 16px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;Regards,&lt;/P&gt;&lt;P&gt;Yuri.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Nov 2016 04:08:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609467#M91902</guid>
      <dc:creator>Yuri</dc:creator>
      <dc:date>2016-11-01T04:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: imx6 secure boot with encryption</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609468#M91903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;unfortunately the error still occurs....&lt;/P&gt;&lt;P&gt;The only thing that changed is the engine in the engine field (from 0x00 = ANY to 0x1d =CAAM)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do have an other question:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is i possible to encrypt more than one image or is the encryption limited to the first image after the ROM bootloader?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Frieder&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Nov 2016 07:23:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609468#M91903</guid>
      <dc:creator>friederbaumgrat</dc:creator>
      <dc:date>2016-11-02T07:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: imx6 secure boot with encryption</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609469#M91904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Please create request to get more details about the issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/docs/DOC-329745"&gt;https://community.nxp.com/docs/DOC-329745&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Yuri.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Nov 2016 05:10:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609469#M91904</guid>
      <dc:creator>Yuri</dc:creator>
      <dc:date>2016-11-03T05:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: imx6 secure boot with encryption</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609470#M91905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So for all of those in need, I share my solution to given problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all I checked the IVT if all the entries are correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I switched from using the function run_csf to authenticate_image.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Last but not least it is important to know, that (when using encryption) once the image is authentcated it is decrypted. So my error was that I checked the encrypted image &lt;STRONG&gt;bevor&lt;/STRONG&gt; saving to NAND flash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I always saved an decrypted image to my flash and during boot there was an other function call of authenticate image.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gave me HAB events, because the image which was loaded from nand flash was already decrypted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bevor testing the transmitted image I copied the image to an other address in RAM and tested the image. When there were no errers detected I copied the original (encrypted) image back to my loadaddress and saved this image.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&amp;gt; Problem solved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps someone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Frieder&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Nov 2016 07:54:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/imx6-secure-boot-with-encryption/m-p/609470#M91905</guid>
      <dc:creator>friederbaumgrat</dc:creator>
      <dc:date>2016-11-16T07:54:27Z</dc:date>
    </item>
  </channel>
</rss>

