<?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>Kinetis Software Development Kit中的主题 Re: mmcau_aes_set_key problem</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/mmcau-aes-set-key-problem/m-p/400511#M1464</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It appears that the buffer passed in to &lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;mmcau_aes_set_key for the key schedule output MUST have an address that is 4 byte aligned.&amp;nbsp; Adding __attribute__ ((aligned (4))) to my array definition solved my problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;The mmcau documentation states something that hints at this, but does not specify it as a requirement:&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;For best performance, input and output data blocks must be aligned on 0‐modulo‐4 byte addresses&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;This is funny actually, because I tested the encrypt/decrypt calls with unaligned memory addresses and there is no issue (aside from maybe slower performance).&amp;nbsp; The only call that has a problem is &lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;mmcau_aes_set_key.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jul 2015 15:39:38 GMT</pubDate>
    <dc:creator>kalden_srcinc</dc:creator>
    <dc:date>2015-07-10T15:39:38Z</dc:date>
    <item>
      <title>mmcau_aes_set_key problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/mmcau-aes-set-key-problem/m-p/400509#M1462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using KSDK 1.2 on a TWR-K64F120M.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having a strange issue with mmcau_aes_set_key.&amp;nbsp; When I store my key at certain program flash addresses the processor faults at mmcau_aes_functions.s line 104:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;P&gt;stmia&amp;nbsp;&amp;nbsp; r2!, {r1,r3,r8-r9}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't been able to find any kind of pattern, but so far these addresses work:&lt;/P&gt;&lt;P&gt;0005f32c&lt;/P&gt;&lt;P&gt;0005f354&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And these do not:&lt;/P&gt;&lt;P&gt;0005f34c&lt;/P&gt;&lt;P&gt;0005f374&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can copy the key to an array in SRAM to work around this, but I just wanted to understand the root cause of this issue.&amp;nbsp; Is there a limitation to where we can store the key in memory?&amp;nbsp; Does the memory need to be aligned in a certain way?&amp;nbsp; The header file defines the key as const, so i don't expect the read only nature of program flash to be an issue.&amp;nbsp; Something is going wrong though.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 14:25:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/mmcau-aes-set-key-problem/m-p/400509#M1462</guid>
      <dc:creator>kalden_srcinc</dc:creator>
      <dc:date>2015-07-10T14:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: mmcau_aes_set_key problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/mmcau-aes-set-key-problem/m-p/400510#M1463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I was mistaken about this.&amp;nbsp; The key in flash is not the issue.&amp;nbsp; The problem relates to the memory location of the output keyschedule.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good address: 1fff58e8 &lt;/P&gt;&lt;P&gt;Bad Address: 1fff60ce &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, the bad address is divisible by 2, but not 4 or 8.&amp;nbsp; The good address is divisible by 2, 4, and 8.&amp;nbsp; Is there just an undocumented memory alignment requirement?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 14:48:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/mmcau-aes-set-key-problem/m-p/400510#M1463</guid>
      <dc:creator>kalden_srcinc</dc:creator>
      <dc:date>2015-07-10T14:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: mmcau_aes_set_key problem</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/mmcau-aes-set-key-problem/m-p/400511#M1464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It appears that the buffer passed in to &lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;mmcau_aes_set_key for the key schedule output MUST have an address that is 4 byte aligned.&amp;nbsp; Adding __attribute__ ((aligned (4))) to my array definition solved my problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;The mmcau documentation states something that hints at this, but does not specify it as a requirement:&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;For best performance, input and output data blocks must be aligned on 0‐modulo‐4 byte addresses&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;This is funny actually, because I tested the encrypt/decrypt calls with unaligned memory addresses and there is no issue (aside from maybe slower performance).&amp;nbsp; The only call that has a problem is &lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;mmcau_aes_set_key.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 15:39:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/mmcau-aes-set-key-problem/m-p/400511#M1464</guid>
      <dc:creator>kalden_srcinc</dc:creator>
      <dc:date>2015-07-10T15:39:38Z</dc:date>
    </item>
  </channel>
</rss>

