<?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>nRF5340 Development Kit board: ECDH implementation (found in nrf/samples/crypto/ecdh) using hardware (cc3xx) is significantly slower than when using software (oberon)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/121440/nrf5340-development-kit-board-ecdh-implementation-found-in-nrf-samples-crypto-ecdh-using-hardware-cc3xx-is-significantly-slower-than-when-using-software-oberon</link><description>Performance on hardware (cc3xx) is significantly slower than performance on software (oberon). Does anyone have a good explanation for this? I have also tested ECDSA and can see that hardware is faster. I also tried a different elliptic curve, but the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 21 May 2025 08:24:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/121440/nrf5340-development-kit-board-ecdh-implementation-found-in-nrf-samples-crypto-ecdh-using-hardware-cc3xx-is-significantly-slower-than-when-using-software-oberon" /><item><title>RE: nRF5340 Development Kit board: ECDH implementation (found in nrf/samples/crypto/ecdh) using hardware (cc3xx) is significantly slower than when using software (oberon)</title><link>https://devzone.nordicsemi.com/thread/536346?ContentTypeID=1</link><pubDate>Wed, 21 May 2025 08:24:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8743d23e-d4a6-426c-a504-f3d6598ead98</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Unfortunately, there is no purpose. It&amp;#39;s a mismatch&amp;nbsp;between the CC31X driver design and the PSA API design.&lt;/p&gt;
&lt;p&gt;The saving grace is that the key generation operation&amp;nbsp;is one that is seldomly run, so the impact&amp;nbsp;of this issue hasn&amp;#39;t been too big.&lt;/p&gt;
&lt;p&gt;Nonetheless, we agree it should&amp;nbsp;be improved. It is a part of the improvement that I mentioned has been&amp;nbsp;queued.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 Development Kit board: ECDH implementation (found in nrf/samples/crypto/ecdh) using hardware (cc3xx) is significantly slower than when using software (oberon)</title><link>https://devzone.nordicsemi.com/thread/536263?ContentTypeID=1</link><pubDate>Tue, 20 May 2025 15:34:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4d76793-ac7e-489f-9a08-f481080a564c</guid><dc:creator>Emil Lenngren</dc:creator><description>&lt;p&gt;Thanks for the info!&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;However, the key isn&amp;#39;t kept to be used in a later export, but discarded.&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What is the purpose of the public key derivation then, if it is immediately discarded? It&amp;#39;s not useful to do expensive computations if the result will be immediately discarded, right?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 Development Kit board: ECDH implementation (found in nrf/samples/crypto/ecdh) using hardware (cc3xx) is significantly slower than when using software (oberon)</title><link>https://devzone.nordicsemi.com/thread/536261?ContentTypeID=1</link><pubDate>Tue, 20 May 2025 15:26:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4fda752-caf2-4be9-bf80-b67b3118e374</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Emil&amp;#39;s guess that the CC31X implementations generate both private and public key is right. However, the key isn&amp;#39;t kept to be used in a later export, but discarded. For an apple-to-apple performance comparison, then the test should be only generating the private key with the CC31X backend, while doing both private key generation and public key export with the Oberon backend.&lt;/p&gt;
&lt;p&gt;Even then, the CC31X performance will still be significantly weaker than the Oberon library due to aforementioned current state of the driver.&amp;nbsp;Our engineers have put&amp;nbsp;considerations for improvement into our backlog.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 Development Kit board: ECDH implementation (found in nrf/samples/crypto/ecdh) using hardware (cc3xx) is significantly slower than when using software (oberon)</title><link>https://devzone.nordicsemi.com/thread/535865?ContentTypeID=1</link><pubDate>Sat, 17 May 2025 14:25:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e5e9a85-1c50-4cdc-8260-8e9c02a00261</guid><dc:creator>Emil Lenngren</dc:creator><description>&lt;p&gt;Hmm something is very weird with the generation on cryptocell then, as it should definitely not take a million cycles (16 milliseconds) to simply generate 32 random bytes...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 Development Kit board: ECDH implementation (found in nrf/samples/crypto/ecdh) using hardware (cc3xx) is significantly slower than when using software (oberon)</title><link>https://devzone.nordicsemi.com/thread/535862?ContentTypeID=1</link><pubDate>Sat, 17 May 2025 09:53:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17397f6c-a4ac-4c34-bc1a-1af43f0423d1</guid><dc:creator>achi77</dc:creator><description>&lt;p&gt;Hi Emil&lt;/p&gt;
&lt;p&gt;Here is the comparison between HW and SW for public key export after key generation:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HW:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="code highlight" lang="plaintext"&gt;&lt;span&gt;&lt;span class=""&gt;Starting ECDH KEY PAIR GENERATION benchmark (100 runs)...&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;Frequency: 64 MHz&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;ECDH KEY PAIR GENERATION benchmark results:&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Runs:    100&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Total:   97356680 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Average: 973566.000 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Minimum: 943227 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Maximum: 1013147 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Std:     13392.071 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;Starting ECDH PUBLIC KEY EXPORT benchmark (100 runs)...&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;Frequency: 64 MHz&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;ECDH PUBLIC KEY EXPORT benchmark results:&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Runs:    100&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Total:   90703453 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Average: 907034.000 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Minimum: 906987 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Maximum: 907036 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Std:     4.796 cycles&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SW:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="code highlight" lang="plaintext"&gt;&lt;span&gt;&lt;span class=""&gt;Starting ECDH KEY PAIR GENERATION benchmark (100 runs)...&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;Frequency: 64 MHz&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;ECDH KEY PAIR GENERATION benchmark results:&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Runs:    100&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Total:   1107485 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Average: 11074.000 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Minimum: 11074 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Maximum: 11153 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Std:     7.874 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;Starting ECDH PUBLIC KEY EXPORT benchmark (100 runs)...&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;Frequency: 64 MHz&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;ECDH PUBLIC KEY EXPORT benchmark results:&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Runs:    100&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Total:   147704871 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Average: 1477048.000 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Minimum: 1477031 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Maximum: 1477049 cycles&lt;/span&gt;&lt;/span&gt;
&lt;span&gt;&lt;span class=""&gt;   Std:     2.000 cycles&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;&lt;span&gt;&lt;span class=""&gt;&lt;br /&gt;I use the nRF5340 DK and according to&amp;nbsp;&lt;a id="" href="https://www.nordicsemi.com/Products/nRF5340,"&gt;https://www.nordicsemi.com/Products/nRF5340,&lt;/a&gt;&amp;nbsp;it should use the&amp;nbsp;Arm CryptoCell-312. I have seen that Cracen is also a possibility, but not on nRF5340 devices.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 Development Kit board: ECDH implementation (found in nrf/samples/crypto/ecdh) using hardware (cc3xx) is significantly slower than when using software (oberon)</title><link>https://devzone.nordicsemi.com/thread/535846?ContentTypeID=1</link><pubDate>Fri, 16 May 2025 22:54:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f021d7c-8049-4ecc-b1bf-a99d8a22774d</guid><dc:creator>Emil Lenngren</dc:creator><description>&lt;p&gt;I put my bet on that the answer by Hieu is wrong.&lt;/p&gt;
&lt;p&gt;I think it&amp;#39;s different behaviour in the two implementations how they each define &amp;quot;keypair generation&amp;quot;. The oberon lib only generates some random numbers which constitute the private key, while I think CC310 also derives the public key internally (which is the operation that actually costs). Please try to redo your benchmark by performing key pair generation followed by public key export to make an apples by apples comparison.&lt;/p&gt;
&lt;p&gt;In any case, the CC310 is quite slow when it comes to big number arithmetic (as is used in public key cryptography) for being a hw accelerator. The multiplier internally is not so fast and it uses the generic Barrett reduction algorithm, while software implementations can be optimized better for &amp;quot;special prime moduli&amp;quot; such as the ones typically used for elliptic curves. The Cracen found in nRF54L is several times faster.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 Development Kit board: ECDH implementation (found in nrf/samples/crypto/ecdh) using hardware (cc3xx) is significantly slower than when using software (oberon)</title><link>https://devzone.nordicsemi.com/thread/535802?ContentTypeID=1</link><pubDate>Fri, 16 May 2025 13:27:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4f1acfd-7127-4b7f-aaae-63a3c96f25a9</guid><dc:creator>achi77</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;Thank you very much for the fast reply!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;achi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 Development Kit board: ECDH implementation (found in nrf/samples/crypto/ecdh) using hardware (cc3xx) is significantly slower than when using software (oberon)</title><link>https://devzone.nordicsemi.com/thread/535595?ContentTypeID=1</link><pubDate>Thu, 15 May 2025 12:50:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdd1f7b5-2f97-426b-9f23-ebe9c141882c</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hello achi77,&lt;/p&gt;
&lt;p&gt;I got feedback from our engineers that this&amp;nbsp;is the state of the CC3XX driver right now with ECDH key generation. It is meant to have better security than the Oberon library, but at the cost of performance.&lt;/p&gt;
&lt;p&gt;I was also tipped that you can improve the performance a little by changing the access lock strategy here:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrfxlib/blob/v3.0.1/crypto/Kconfig#L35-L71"&gt;sdk-nrfxlib/crypto/Kconfig at v3.0.1 · nrfconnect/sdk-nrfxlib&lt;/a&gt;.&lt;br /&gt;Please note that this change will make CryptoCell access not thread-safe.&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 Development Kit board: ECDH implementation (found in nrf/samples/crypto/ecdh) using hardware (cc3xx) is significantly slower than when using software (oberon)</title><link>https://devzone.nordicsemi.com/thread/535352?ContentTypeID=1</link><pubDate>Wed, 14 May 2025 13:35:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8812c20-20f4-43a4-a25c-11ccbf141e1d</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hello achi77,&lt;/p&gt;
&lt;p&gt;I will look into this and follow-up with you this week.&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>