<?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>Trying to implement ECDH key exchange using tinycrypt but the random num gen keeps crashing</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68985/trying-to-implement-ecdh-key-exchange-using-tinycrypt-but-the-random-num-gen-keeps-crashing</link><description>Hello, 
 I have been trying to implement the Elliptic-curve Diffie–Hellman key exchange using tiny crypt. 
 As per the API, a random number generator function needs to be passed to create the public and private keys. The random gen function is passed</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 11 Dec 2020 14:19:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68985/trying-to-implement-ecdh-key-exchange-using-tinycrypt-but-the-random-num-gen-keeps-crashing" /><item><title>RE: Trying to implement ECDH key exchange using tinycrypt but the random num gen keeps crashing</title><link>https://devzone.nordicsemi.com/thread/284564?ContentTypeID=1</link><pubDate>Fri, 11 Dec 2020 14:19:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f00c347-99ae-45c5-814d-e1d01cf0ca6c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for your patience. I finally have a working example I can share, please see attached below.&lt;/p&gt;
&lt;p&gt;I used the \tests\crypto\ project from the nrf repo along with this example I found on Github (&lt;a href="https://github.com/tleonhardt/practical_cryptography_engineering/blob/master/ecdh.c"&gt;link&lt;/a&gt;) as a reference when I implement this demo sample. But as I indicated earlier, I&amp;#39;m not an expert on this topic, so please keep that in mind when you review the code.&amp;nbsp; The github example did for instance include some additional steps which I&amp;#39;m not really sure if are needed or not.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ECDH with mbedtls&amp;nbsp; (tested with NCS v1.4.0) &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mbedtls_5F00_ecdh.zip"&gt;devzone.nordicsemi.com/.../mbedtls_5F00_ecdh.zip&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update: &lt;/strong&gt;I made a new version that uses the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/random/index.html"&gt;entropy driver &lt;/a&gt;as the entropy source.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mbedtls_5F00_ecdh_5F00_with_5F00_entropy_5F00_driver.zip"&gt;devzone.nordicsemi.com/.../mbedtls_5F00_ecdh_5F00_with_5F00_entropy_5F00_driver.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trying to implement ECDH key exchange using tinycrypt but the random num gen keeps crashing</title><link>https://devzone.nordicsemi.com/thread/284219?ContentTypeID=1</link><pubDate>Thu, 10 Dec 2020 04:07:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5b72761-8c1c-477b-b03c-da2218bdb962</guid><dc:creator>sethu</dc:creator><description>&lt;p&gt;Hey,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you for letting me know. I can wait for the answer.&lt;/p&gt;
&lt;p&gt;I have added cryptocell support to the project.&lt;/p&gt;
&lt;p&gt;Cheers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trying to implement ECDH key exchange using tinycrypt but the random num gen keeps crashing</title><link>https://devzone.nordicsemi.com/thread/284134?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2020 15:12:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c51f648b-5533-4d44-807a-a707bdb502f3</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for sharing your projects! Unfortunately, I have not been able to identify the problem yet.&amp;nbsp; I have to admit that I&amp;#39;m a bit new to the crypto implementation in this SDK, and this took a bit more time to figure out than what I had anticipated. I&amp;#39;ll ask my colleagues for some assistance and get back to you.&lt;/p&gt;
&lt;p&gt;Also, as you may have seen, mbedtls enables HW accellerated crypto if you select the Cryptocell cc310 backend. So it&amp;#39;s likely a better choice than tinycrypt, assuming performance is a factor.&lt;/p&gt;
&lt;p&gt;Our &amp;quot;Nordic Security module&amp;quot; documentation for reference:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/nrf_security/README.html#nordic-security-module"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/nrf_security/README.html#nordic-security-module&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trying to implement ECDH key exchange using tinycrypt but the random num gen keeps crashing</title><link>https://devzone.nordicsemi.com/thread/283672?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 22:47:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09d1f3d7-1064-4b93-aec2-40f2eda38894</guid><dc:creator>sethu</dc:creator><description>&lt;p&gt;Hey,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;No problem, Please find attached the project file. I have attached two projects, one is the project that implements ECDH using Tinycrypt and the other using mbedtls library, both have similar problems, they crash out at some point due to the random number generator. If you could help with getting either one of them to work, it would be great. The mbedtls project is based on an ECDH sample that was provided in their Github. I&amp;#39;m using the latest SDK v1.4.0 with the latest nRF command-line tools with the nRF52840-DK board.&lt;/p&gt;
&lt;p&gt;Thanks for your time.&lt;/p&gt;
&lt;p&gt;.&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Tinycrypt_2D00_ECDH_2D00_sample.zip"&gt;devzone.nordicsemi.com/.../Tinycrypt_2D00_ECDH_2D00_sample.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/crypto.zip"&gt;devzone.nordicsemi.com/.../crypto.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trying to implement ECDH key exchange using tinycrypt but the random num gen keeps crashing</title><link>https://devzone.nordicsemi.com/thread/283589?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 14:34:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8eb4c1b2-39b0-419d-8ba7-7daa7f0e0512</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry for the delayed response. Is there any chance you could share relevant project configuration settings as well? It would be helpful if I could compile and debug this here.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>