<?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>ECDSA signing crashes when implemented with bluetooth</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70100/ecdsa-signing-crashes-when-implemented-with-bluetooth</link><description>Hello, 
 I have been trying to implement the tinycrypt ECDSA algorithm for our product. I had sampled the implementation in a sample project with ECDSA being the only implementation and everything works perfectly. But, after I tried implementing ECDSA</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 11 Jan 2021 22:52:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70100/ecdsa-signing-crashes-when-implemented-with-bluetooth" /><item><title>RE: ECDSA signing crashes when implemented with bluetooth</title><link>https://devzone.nordicsemi.com/thread/288494?ContentTypeID=1</link><pubDate>Mon, 11 Jan 2021 22:52:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b856f60-3a8a-4484-8c2e-c25056be3ce7</guid><dc:creator>sethu</dc:creator><description>&lt;p&gt;Hey Simon,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you for taking the time to figure this out for me, really appreciate it. While you were working on it I did&amp;nbsp;try the solution using the thread and semaphore which worked without any problem but wanted to know why it crashed when a thread wasn&amp;#39;t used.&lt;/p&gt;
&lt;p&gt;Regards,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sethu&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ECDSA signing crashes when implemented with bluetooth</title><link>https://devzone.nordicsemi.com/thread/288468?ContentTypeID=1</link><pubDate>Mon, 11 Jan 2021 17:47:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d51c2a8-d04d-4dba-9883-8b83d4673d25</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Forget my last comment, that assert triggered because I stopped the program using a breakpoint, before continuing.&lt;/p&gt;
&lt;p&gt;However,&lt;strong&gt; I was able to get rid of the memfault by setting these in prj.conf&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT_TINYCRYPT_ECC=n
CONFIG_BT_RX_STACK_SIZE=4096&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The top config was enabled by default, and would cause&amp;nbsp;zephyr\subsys\bluetooth\host\hci_ecc.c--&amp;gt;ecc_thread()--&amp;gt; emulate_le_p256_public_key_cmd() to run, and a stack overrflow--&amp;gt;memfault would happen.&lt;/p&gt;
&lt;p&gt;When I disabled it, I still got a memfault, which I think is due to stack overflow because the rx stack was too small. As you can see in the call stack below, the functions&amp;nbsp;notify_func()--&amp;gt;ecdsa_sign() are called within the rx thread(), and the call stack is quite large:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/7183.pastedimage1610386857924v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;One quick fix is to simply increase the BT RX stack size. A better solution is probably to create an own thread that runs ecdsa_sign() and just use&amp;nbsp;k_sem_take/k_sem_give to signal the thread.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ECDSA signing crashes when implemented with bluetooth</title><link>https://devzone.nordicsemi.com/thread/288105?ContentTypeID=1</link><pubDate>Fri, 08 Jan 2021 08:58:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c9574c0-cd78-436b-8d1d-98f088e4f87c</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;&lt;span style="text-decoration:line-through;"&gt;It seems like an assert in&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/6515a783e5e689f548bb943a2a53eb51107d28a8/subsys/mpsl/mpsl_init.c#L109"&gt;mpsl_init.c--&amp;gt;m_assert_handler()&lt;/a&gt;&amp;nbsp;makes the program crash. I&amp;#39;m not sure why this is, but will continue to investigate.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>