<?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>Enabling CONFIG_PSA_CRYPTO_DRIVER_CC3XX causes incorrect tag when using AES-GCM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/103395/enabling-config_psa_crypto_driver_cc3xx-causes-incorrect-tag-when-using-aes-gcm</link><description>Hello, 
 Our devices utilize AES-GCM to establish a secure channel with our servers. The system works as expected without any issues when CONFIG_PSA_CRYPTO_DRIVER_CC3XX is disabled, but as soon as we enable that flag to take advantage of the cyrptocell</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 Sep 2023 13:02:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/103395/enabling-config_psa_crypto_driver_cc3xx-causes-incorrect-tag-when-using-aes-gcm" /><item><title>RE: Enabling CONFIG_PSA_CRYPTO_DRIVER_CC3XX causes incorrect tag when using AES-GCM</title><link>https://devzone.nordicsemi.com/thread/445643?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2023 13:02:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fffa7f7-0140-42ff-8c7a-a3a24a91ed9e</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi Diego,&lt;/p&gt;
[quote user="diegolt"]1. Is this an actual limitation with the hardware in the CryptoCell or with the driver for it provided by Nordic?[/quote]
&lt;p&gt;The limitation comes from CryptoCell low-level driver. We are investigating if the source of this limitation is in hardware or software.&amp;nbsp;&lt;/p&gt;
[quote user="diegolt"]2. In my opinion this is a bug since the nonce size is for the user to define as stated in section 8.2 here&amp;nbsp;&lt;a href="https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf"&gt;https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf&lt;/a&gt;. As long as it&amp;#39;s unique, the size doesn’t matter. Why would this be a limitation with CyrpoCell?[/quote]
&lt;p&gt;&lt;a href="https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf"&gt;NIST special publication for GCM&lt;/a&gt;&amp;nbsp;mentions the following &amp;quot;For IVs, it is recommended that implementations restrict support to the length of 96 bits, to promote interoperability, efficiency, and simplicity of design.&amp;quot;.&amp;nbsp;&amp;nbsp;&lt;a href="https://armmbed.github.io/mbed-crypto/PSA_Cryptography_API_Specification.pdf"&gt;PSA Crypto API Specification&lt;/a&gt;&amp;nbsp;mentions &amp;quot;GCM requires a nonce of at least 1 byte in length. The maximum supported nonce size is IMPLEMENTATION DEFINED. Calling psa_aead_generate_nonce() will generate a random 12-byte nonce.&amp;quot;. For CryptoCell the size of the nonce is hard-coded to 12 bytes (96 bits).&amp;nbsp;&lt;/p&gt;
[quote user="diegolt"]3. At a minimum I would expect the driver to return an error such as&amp;nbsp;PSA_ERROR_NOT_SUPPORTED if the nonce is not 12. With the current implementation there&amp;#39;s no indication that something went wrong until you&amp;#39;re testing against another valid implementation.[/quote]
&lt;p&gt;Returning error code will be fixed in the updated version of the CryptoCell runtime library.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling CONFIG_PSA_CRYPTO_DRIVER_CC3XX causes incorrect tag when using AES-GCM</title><link>https://devzone.nordicsemi.com/thread/445492?ContentTypeID=1</link><pubDate>Mon, 11 Sep 2023 22:24:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:748d1426-8804-4e62-b640-02a4290e8b99</guid><dc:creator>Diego</dc:creator><description>&lt;p&gt;Hi Dejan,&lt;/p&gt;
&lt;p&gt;Yes, that seems to be the issue. Using 12 bytes produces a consistent MAC across both. A couple of followup questions/notes:&lt;/p&gt;
&lt;p&gt;1. Is this an actual limitation with the hardware in the CryptoCell or with the driver for it provided by Nordic?&lt;/p&gt;
&lt;p&gt;2. In my opinion this is a bug since the nonce size is for the user to define as stated in section 8.2 here&amp;nbsp;&lt;a id="" href="https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf"&gt;https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf&lt;/a&gt;. As long as it&amp;#39;s unique, the size doesn&amp;rsquo;t matter. Why would this be a limitation with CyrpoCell?&lt;/p&gt;
&lt;p&gt;3. At a minimum I would expect the driver to return an error such as&amp;nbsp;PSA_ERROR_NOT_SUPPORTED if the nonce is not 12. With the current implementation there&amp;#39;s no indication that something went wrong until you&amp;#39;re testing against another valid implementation.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Diego&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling CONFIG_PSA_CRYPTO_DRIVER_CC3XX causes incorrect tag when using AES-GCM</title><link>https://devzone.nordicsemi.com/thread/444766?ContentTypeID=1</link><pubDate>Wed, 06 Sep 2023 15:40:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2339fca-0df5-4c3d-967e-7656a969f01b</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi Diego,&lt;br /&gt;&lt;br /&gt;This issue might be related to the nonce length. You should ensure that you use nonce of size 12 bytes. If you want to use nonce value other than 12 bytes you would need to use software for that (nrf_oberon).&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling CONFIG_PSA_CRYPTO_DRIVER_CC3XX causes incorrect tag when using AES-GCM</title><link>https://devzone.nordicsemi.com/thread/444607?ContentTypeID=1</link><pubDate>Wed, 06 Sep 2023 03:35:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ede39319-5834-466f-bad6-15ad9f014022</guid><dc:creator>Diego</dc:creator><description>&lt;p&gt;Hi Dejan&lt;/p&gt;
&lt;p&gt;NCS version 2.3.0&lt;/p&gt;
&lt;p&gt;We&amp;#39;re using the mbed psa crypto libray with calls like&amp;nbsp;psa_aead_encrypt&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the relevant Kconfig flags in our project&amp;nbsp;&lt;/p&gt;
&lt;p&gt;CONFIG_NRF_SECURITY=y&lt;br /&gt;CONFIG_MBEDTLS_PSA_CRYPTO_C=y&lt;br /&gt;CONFIG_MBEDTLS_ENABLE_HEAP=y&lt;br /&gt;CONFIG_MBEDTLS_HEAP_SIZE=8192&lt;br /&gt;CONFIG_MBEDTLS_PSA_CRYPTO_STORAGE_C=y&lt;br /&gt;CONFIG_PSA_NATIVE_ITS=y&lt;br /&gt;CONFIG_BASE64=y&lt;br /&gt;CONFIG_PSA_CRYPTO_DRIVER_OBERON=n&lt;br /&gt;CONFIG_PSA_CRYPTO_DRIVER_CC3XX=y&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;I don&amp;#39;t have access to a devkit this week but I can try to reproduce with one of the samples next.&lt;br /&gt;&lt;br /&gt;Please let me know if you have any other questions.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;Thanks,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;Diego&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling CONFIG_PSA_CRYPTO_DRIVER_CC3XX causes incorrect tag when using AES-GCM</title><link>https://devzone.nordicsemi.com/thread/444293?ContentTypeID=1</link><pubDate>Mon, 04 Sep 2023 10:57:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12da48b1-b192-4bb1-af41-d72d962e4ea4</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Which NCS version do you use?&lt;br /&gt;&lt;br /&gt;Which&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/crypto/README.html"&gt;crypto library&lt;/a&gt; do you use?&lt;br /&gt;&lt;br /&gt;Could you provide your project configuration file?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>