<?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>i.MX ProcessorsのトピックRe: i.MX6 CAAM : sm_test.c in 3.0.35 kernel broken</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452117#M70262</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;&amp;nbsp; Please look at the following threads in Community, that can help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;“Testing imx6 CAAM module in kernel”&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;&lt;A class="jive-link-message-small" data-containerid="2004" data-containertype="14" data-objectid="379592" data-objecttype="2" href="https://community.freescale.com/message/379592#379592"&gt;https://community.freescale.com/message/379592#379592&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;“How to Create Blob”&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;&lt;A class="jive-link-message-small" data-containerid="2004" data-containertype="14" data-objectid="341251" data-objecttype="2" href="https://community.freescale.com/message/341251#341251"&gt;https://community.freescale.com/message/341251#341251&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;Note, in order to generate a blob with the CAAM OTPMK, a secure boot with HAB should be&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;in closed config [...], otherwise in open config the blob will be created using the known CAAM &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;default master key.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&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>Thu, 30 Apr 2015 03:33:35 GMT</pubDate>
    <dc:creator>Yuri</dc:creator>
    <dc:date>2015-04-30T03:33:35Z</dc:date>
    <item>
      <title>i.MX6 CAAM : sm_test.c in 3.0.35 kernel broken</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452116#M70261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wanted to use this file as an example of how to use black keys (and hopefully to extend that to black blobs).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I kept looking more and more closely at the example, because when it goes to use the black key to encrypt the data, it doesn't specify anything about that the key it wants to use is a black key.&amp;nbsp; So why does it work?&amp;nbsp; Does the CAAM automatically recognize a black key?&amp;nbsp; The documentation doesn't say it does that. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, the explanation appears to be that it doesn't work.&amp;nbsp; The sm_keystore_slot_encapsulate() and sm_keystore_decapsulate() calls fail with a generic "DMA error".&amp;nbsp; So what happens is test loads in the clear text key, encapsulates it in place (which fails), then decapsulates it in place (which also fails), the result being that the clear text key is stored in the black key buffer.&amp;nbsp; Then the procedure goes on to encrypt the data using the supposed black key (which explains why it works without specifying that it's a black key -- it's not a black key, and nobody tells the CAAM to load a black key, so of course it just does a normal encryption using the clear text key left in the buffer).&amp;nbsp; Then it decrypts the data using the correct cleartext key, and reports "test match OK".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is NO error checking on the encapsulate/decapsulate operations themselves.&amp;nbsp; The tail end of int sm_keystore_slot_encapsulate() has the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #ff6600;"&gt;jstat = sm_key_job(dev, encapdesc);&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dma_unmap_single(dev, keymod_dma, keymodlen, DMA_TO_DEVICE);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; kfree(encapdesc);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;i.e. nothing ever checks "jstat".&amp;nbsp; In my version, I added code to call caam_jr_strstatus(), which is how I determined the generic "DMA error".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a result, the entire test "succeeds" because it uses cleartext keys throughout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;So my question is this: does anyone know how to make the sm_test.c example work the way it's supposed to, with actually using black keys?&amp;nbsp; I really wanted to use it as a concrete example!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Apr 2015 00:55:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452116#M70261</guid>
      <dc:creator>deanmatsen</dc:creator>
      <dc:date>2015-04-29T00:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 CAAM : sm_test.c in 3.0.35 kernel broken</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452117#M70262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;&amp;nbsp; Please look at the following threads in Community, that can help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;“Testing imx6 CAAM module in kernel”&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;&lt;A class="jive-link-message-small" data-containerid="2004" data-containertype="14" data-objectid="379592" data-objecttype="2" href="https://community.freescale.com/message/379592#379592"&gt;https://community.freescale.com/message/379592#379592&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;“How to Create Blob”&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;&lt;A class="jive-link-message-small" data-containerid="2004" data-containertype="14" data-objectid="341251" data-objecttype="2" href="https://community.freescale.com/message/341251#341251"&gt;https://community.freescale.com/message/341251#341251&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;Note, in order to generate a blob with the CAAM OTPMK, a secure boot with HAB should be&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;in closed config [...], otherwise in open config the blob will be created using the known CAAM &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Verdana','sans-serif';"&gt;default master key.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&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>Thu, 30 Apr 2015 03:33:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452117#M70262</guid>
      <dc:creator>Yuri</dc:creator>
      <dc:date>2015-04-30T03:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 CAAM : sm_test.c in 3.0.35 kernel broken</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452118#M70263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a Nitrogen6X board. I have tried sm_test.c in kernel 3.10.17 and I have got the same DMA errors as Dean. In addition, I have tried the SM patch proposed by Yuri:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ENGR00290444: Need to update CAAM driver with SM patches from STC&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;So, I added the &lt;EM&gt;sm_keystore_cover_key&lt;/EM&gt;, &lt;EM&gt;sm_keystore_slot_import&lt;/EM&gt; and &lt;EM&gt;sm_keystore_slot_export &lt;/EM&gt;and &lt;EM&gt;slot_get_physical &lt;/EM&gt;functions to &lt;EM&gt;sm_store.c&lt;/EM&gt;. Then, I tried to make the &lt;EM&gt;sm_test.c&lt;/EM&gt; work. However, I got the following error: &lt;STRONG&gt;caam 2100000.caam: can't detect secure memory base address&lt;/STRONG&gt; which is related to a NULL&amp;nbsp; &lt;EM&gt;res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "iobase_caam_sm"); &lt;/EM&gt;defined in &lt;EM&gt;caam_sm_startup()&lt;/EM&gt; function in &lt;EM&gt;sm_store.c&lt;/EM&gt;. Normally, &lt;EM&gt;res&lt;/EM&gt; must not be NULL in order to get a valid physical address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you any idea concerning this issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help,&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Aymen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 13:08:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452118#M70263</guid>
      <dc:creator>Aymen_IRT</dc:creator>
      <dc:date>2015-07-07T13:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 CAAM : sm_test.c in 3.0.35 kernel broken</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452119#M70264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aymen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I did get it working after applying the patch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It sounds like your board support is not registering the CAAM.&amp;nbsp; Make sure your board C file is calling imx6q_add_imx_caam().&amp;nbsp; I see that is in the board-mx6q_sabrelite.c file, but it requires caam_enabled = 1.&amp;nbsp; I took that out of my board C file and make it call this unconditionally (my board C file is a copy of the sabrelite one). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did all of the patches, not just 290444.&amp;nbsp; I doubt that will make a difference for you, but it might.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I still have the problem of my system hanging after a while if I use the CAAM for things like disk encryption or SSL.&amp;nbsp; There are posted fixes for this, which (I think) can be found in &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/thread/303229"&gt;https://community.freescale.com/thread/303229&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but I have not tried applying them yet.&amp;nbsp; As such, for now I have CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API disabled for now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 17:52:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452119#M70264</guid>
      <dc:creator>deanmatsen</dc:creator>
      <dc:date>2015-07-07T17:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 CAAM : sm_test.c in 3.0.35 kernel broken</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452120#M70265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dean,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;Actually, I was also able to apply the patch to kernel v3.0.35 and successfully used secure blobs. However, I got the aforementioned problems when adapting the patch to kernel v3.10.17. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, you are right concerning the activation of CAAM: either you do it by setting caam_enabled = 1 or by adding caam (or caam = 1) to your kernel bootargs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aymen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 07:26:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452120#M70265</guid>
      <dc:creator>Aymen_IRT</dc:creator>
      <dc:date>2015-07-08T07:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 CAAM : sm_test.c in 3.0.35 kernel broken</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452121#M70266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, I succeeded in applying the patch &lt;EM&gt;ENGR00290444 (Need to update CAAM driver with SM patches from STC) &lt;/EM&gt;to kernel 3.10.17. The main difference between the patch for kernel 3.0.35 and kernel 3.10.17 consists in replacing the following block in function &lt;EM&gt;caam_sm_startup(struct platform_device *pdev)&lt;/EM&gt; in &lt;EM&gt;sm_store.c&lt;/EM&gt;: &lt;/P&gt;&lt;P&gt;&lt;EM&gt;struct resource *res;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "iobase_caam_sm");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (res == NULL) {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dev_err(ctrldev, "can't detect secure memory base address\n");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return -ENOMEM;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By this code:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;struct resource res;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;ret = of_address_to_resource(np, 0, &amp;amp;res);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (ret) {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dev_err(ctrldev, "can't detect secure memory base address\n");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; kfree (smpriv);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return -ENOMEM;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aymen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 11:41:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-CAAM-sm-test-c-in-3-0-35-kernel-broken/m-p/452121#M70266</guid>
      <dc:creator>Aymen_IRT</dc:creator>
      <dc:date>2015-07-10T11:41:20Z</dc:date>
    </item>
  </channel>
</rss>

