<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/31129/cryptocell-cc310-aes-ccm-crys_fatal_error-after-2nd-decrypt-operation</link><description>Hello guys, 
 During implementation of a test set for CryptoCell AES CCM* functionality i&amp;#39;m facing some issue with the CryptoCell. 
 Encryption works fine without any issue. When it comes to the decryption parts only first test set passed whereas the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Mar 2018 12:28:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/31129/cryptocell-cc310-aes-ccm-crys_fatal_error-after-2nd-decrypt-operation" /><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123659?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 12:28:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b9b9401-7a39-4df0-a27a-45e0e07491a4</guid><dc:creator>chris-ho</dc:creator><description>&lt;p&gt;I will check that with memory alignement.&lt;/p&gt;
&lt;p&gt;The example vectors have been taken from an AES CCM implementation, which according to the specification of CCM* coincides. But is not able to handle encryption without authentication.&lt;/p&gt;
&lt;p&gt;The test vectors from IEEE802.15.4-2015 i couln&amp;#39;t test see:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/31216/cryptocell-cc310-aes-ccm-arbitrary-nonce"&gt;devzone.nordicsemi.com/.../cryptocell-cc310-aes-ccm-arbitrary-nonce&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123642?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 11:38:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1827022d-f22a-4099-95cb-a03f56aff752</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;OK, I found a bug in the code - you have bad memory alignment!&lt;/p&gt;
&lt;p&gt;CRYS_AESCCMStar expect to have 16 byte for&amp;nbsp;Mac_Res. You are not passing that.&lt;/p&gt;
&lt;p&gt;So you need to increase your arrays in structures aes_ccms_enc_suite_t and aes_ccms_dec_suite_t:&lt;/p&gt;
&lt;p&gt;uint8_t m[20 + 16];&lt;/p&gt;
&lt;p&gt;and&amp;nbsp;&lt;/p&gt;
&lt;p&gt;uint8_t c[20 + 16];&lt;/p&gt;
&lt;p&gt;Once this is done you will observe that your encryption test vector (suit[0]) is broken. Cipher text is not matching expected ciper text.&lt;/p&gt;
&lt;p&gt;Test vector suit[1] is fine for encryption and decryption.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123638?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 11:23:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e08c368d-3822-4f68-b290-c36d9fa74b80</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Ok,&lt;/p&gt;
&lt;p&gt;This is much complex problem. In fact you are NOT checking if first test suit was sucessfully encrypted. And... it was not. I don&amp;#39;t know why yet but len_m == 0 when using memory compare function. I am trying to investigate that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123628?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 10:48:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d46855b-1245-48f9-b0a2-56033feffacb</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Second test suit is decrypting fine (success++). I am checking first one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123621?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 10:34:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c487e4ce-6cc3-4aa3-aae3-ac7439c0a4ed</guid><dc:creator>chris-ho</dc:creator><description>&lt;p&gt;okay understood,&amp;nbsp;meanwhile i came to the same thought &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;what is then the reason why decryption fails for suite[0] where tag_len is 0 and cipher text length is 20 which i posted above?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123617?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 10:30:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f905fd8f-7197-4f1f-b046-6a22cd7176dd</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;But when len was set to 24 you were passing &lt;strong&gt;cipher text length&lt;/strong&gt; == 24 to crypto library and in addition you were passing tag_len = &lt;strong&gt;4&lt;/strong&gt;. So 28 bytes in total.&lt;/p&gt;
&lt;p&gt;So&amp;nbsp;CRYS_AESCCMStar were using 28 bytes on 24 bytes array. This might cause some memory corruption.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123611?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 10:21:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e84f400f-3c8a-499f-b182-cca9cad88f8f</guid><dc:creator>chris-ho</dc:creator><description>&lt;p&gt;&lt;span&gt;CRYS_FATAL_ERROR&lt;/span&gt; is gone &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123610?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 10:20:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60905371-79b0-494b-85ce-2f87478dd7fa</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Before going further, please let me know if you still see&amp;nbsp;&lt;span&gt;CRYS_FATAL_ERROR ?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123607?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 10:18:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61f3fe16-33e8-4d4b-974d-69c69d87db0e</guid><dc:creator>chris-ho</dc:creator><description>&lt;p&gt;applying your solution works. But I have some follow up question. Cutting the length of the input cyphertext means that we cut off the MAC, is that desired as input vector?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123599?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 10:08:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c82819ca-f52d-4e1f-8ecd-9b2699143bb6</guid><dc:creator>chris-ho</dc:creator><description>&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1040x666/__key/communityserver-discussions-components-files/4/suite_5F00_0_5F00_cyphertext.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1040x666/__key/communityserver-discussions-components-files/4/suite_5F00_0_5F00_plaintext.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;compare fails because inverse transformation seems not delivering the expected plaintext.&lt;/p&gt;
&lt;p&gt;which is in fact the reverse input data from the encryption tets set&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123596?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 09:59:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f90639c9-2682-49b3-a280-2e62e95ed40f</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Please use test vectors&amp;nbsp;from attached file and let me know if you still see&amp;nbsp;&lt;span&gt;CRYS_FATAL_ERROR.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In my case updating second decryption vector in decryption&amp;nbsp; suit helped and I don&amp;#39;t see&amp;nbsp;CRYS_FATAL_ERROR any more.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can leave interation as you have it.&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/01bsp_5F00_cryptoengine.c"&gt;devzone.nordicsemi.com/.../01bsp_5F00_cryptoengine.c&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123589?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 09:51:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4812863b-1fd8-4dd8-ad4b-ee23d2848b88</guid><dc:creator>chris-ho</dc:creator><description>&lt;p&gt;suite iteration works fine for me. Your right the memcmp fails because of array size.&lt;/p&gt;
&lt;p&gt;using:&lt;/p&gt;
&lt;p&gt;if(memcmp(suite[i].c, suite[i].expected_plaintext, (suite[i].len_c - suite[i].len_tag)) == 0)&lt;/p&gt;
&lt;p&gt;compares the wished context&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123588?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 09:40:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ea9da3d-1065-4295-b799-87c7599ce469</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Maybe I am wrong but I think you shall update second test suit:&lt;br /&gt;24, /* len_c */&amp;nbsp; to&amp;nbsp; 20, /* len_c */.&lt;/p&gt;
&lt;p&gt;With this modification it is working fine with suite iteration.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123584?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 09:25:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:927c59c6-2975-425c-ab4f-95d714cdd6e6</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Please do test with modification I&amp;#39;ve proposed and let me know if there is any difference. So all arguments to function&amp;nbsp;cryptoengine_aes_ccms_dec shall be changed&amp;nbsp;from suite[i] to suite[0]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123583?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 09:22:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc9e80fa-1379-450d-b910-3aab4f933478</guid><dc:creator>chris-ho</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/jarz"&gt;Jakub Rzeszutko&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;Sorry for the inconvinience, when I packed the project i deleted to much files. Thanks also for clarification regarding the intialisation process.&lt;/p&gt;
&lt;p&gt;this is the state running the 2nd test set for decrypt, thats is cause why run_aes_ccms_dec_suite fails later&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1040x1040/__key/communityserver-discussions-components-files/4/Error_5F00_Code_5F00_2nd_5F00_decrypt_5F00_run.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123580?ContentTypeID=1</link><pubDate>Fri, 09 Mar 2018 09:20:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b3f1743-0a40-47af-81a6-b897d6c61f03</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Problem looks to be in your decryption test suit.&lt;/p&gt;
&lt;p&gt;When you will update function&amp;nbsp;run_aes_ccms_dec_suite to not iterate suit:&lt;/p&gt;
&lt;p&gt;suit[i] -&amp;gt; suit[0]&lt;/p&gt;
&lt;p&gt;Problem will gone.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123450?ContentTypeID=1</link><pubDate>Thu, 08 Mar 2018 13:45:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c690ec5-6ffd-4c82-bffa-d2f8a0129625</guid><dc:creator>chris-ho</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/martinbl"&gt;MartinBL&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;thanks for taking care about this issue please find attached my project.&lt;/p&gt;
&lt;p&gt;Note: I&amp;#39;m using the nrf52840 PrevDK and IAR Workbench Version 8.20.1&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrf52840_5F00_cryptocell.zip"&gt;devzone.nordicsemi.com/.../nrf52840_5F00_cryptocell.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Chris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CryptoCell CC310 AES CCM* CRYS_FATAL_ERROR after 2nd decrypt operation</title><link>https://devzone.nordicsemi.com/thread/123404?ContentTypeID=1</link><pubDate>Thu, 08 Mar 2018 10:57:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a32deb7-d761-4132-804e-3c1d0237ac01</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;We are unable to reproduce this. Can you please zip your project files and upload them?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>