<?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>Runtime error for ECDSA demo code</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43457/runtime-error-for-ecdsa-demo-code</link><description>Hi 
 I have successfully added the nrf_crypto files to the UART project. It compiles without any issue. Now I was trying to run the ECDSA example code in the UART project. It seems to crash on attempting to generate an ECDSA signature. 
 I get the following</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Aug 2024 05:37:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43457/runtime-error-for-ecdsa-demo-code" /><item><title>RE: Runtime error for ECDSA demo code</title><link>https://devzone.nordicsemi.com/thread/498160?ContentTypeID=1</link><pubDate>Wed, 14 Aug 2024 05:37:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a79e5a73-1fde-4ec9-8d6f-87b0e9be9926</guid><dc:creator>Yong</dc:creator><description>&lt;p&gt;&lt;i&gt;#ifndef NRF_CRYPTO_RNG_STATIC_MEMORY_BUFFERS_ENABLED #define NRF_CRYPTO_RNG_STATIC_MEMORY_BUFFERS_ENABLED 1 #endif&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;#ifndef NRF_CRYPTO_RNG_AUTO_INIT_ENABLED #define NRF_CRYPTO_RNG_AUTO_INIT_ENABLED 1 #endif&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;I enabled both configurations, but still returned 0x8516;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;nrf_crypto_ecdh_secp256r1_shared_secret_t shared;&lt;br /&gt; size_t shared_size = sizeof(shared);&lt;br /&gt; nrf_crypto_ecdh_context_t ecdh_context;&lt;/p&gt;
&lt;p&gt;// 计算共享密钥&lt;br /&gt; ret_code_t err_code = nrf_crypto_ecdh_compute(&lt;br /&gt; &amp;amp;ecdh_context,&lt;br /&gt; &amp;amp;ctl_private_key,&lt;br /&gt; &amp;amp;other_public_key,&lt;br /&gt; shared, &amp;amp;shared_size);&lt;br /&gt; if (err_code != NRF_SUCCESS)&lt;br /&gt; {&lt;br /&gt; NRF_LOG_ERROR(&amp;quot;Failed to compute shared secret. Error: 0x%X&amp;quot;, err_code);&lt;br /&gt; DEMO_ERROR_CHECK(err_code);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;br /&gt; }&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Runtime error for ECDSA demo code</title><link>https://devzone.nordicsemi.com/thread/170051?ContentTypeID=1</link><pubDate>Fri, 08 Feb 2019 07:55:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:296d9708-4d56-4f51-9c34-d651b3bd3ffa</guid><dc:creator>abhibera</dc:creator><description>&lt;p&gt;Found a fix. I was missing #defines from the sdk_config.h file&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;//  nrf_crypto_rng - RNG Configuration

//==========================================================
// &lt;q&gt; NRF_CRYPTO_RNG_STATIC_MEMORY_BUFFERS_ENABLED  - Use static memory buffers for context and temporary init buffer.
 

// &lt;i&gt; Always recommended when using the nRF HW RNG as the context and temporary buffers are small. Consider disabling if using the CC310 RNG in a RAM constrained application. In this case, memory must be provided to nrf_crypto_rng_init, or it can be allocated internally provided that NRF_CRYPTO_ALLOCATOR does not allocate memory on the stack.

#ifndef NRF_CRYPTO_RNG_STATIC_MEMORY_BUFFERS_ENABLED
#define NRF_CRYPTO_RNG_STATIC_MEMORY_BUFFERS_ENABLED 1
#endif

//  NRF_CRYPTO_RNG_AUTO_INIT_ENABLED  - Initialize the RNG module automatically when nrf_crypto is initialized.
 

//  Automatic initialization is only supported with static or internally allocated context and temporary memory.

#ifndef NRF_CRYPTO_RNG_AUTO_INIT_ENABLED
#define NRF_CRYPTO_RNG_AUTO_INIT_ENABLED 1
#endif&lt;/i&gt;&lt;/q&gt;&lt;/pre&gt;
&lt;p&gt;Tip for Nordic SDK Team: Please don&amp;#39;t make such a long and confusing sdk_config.h file with #defines we cannot possibly know about in advance. A better way would be to split sdk_config.h into multiple header files and include all necessary defines for each module. This way we will not miss out.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Runtime error for ECDSA demo code</title><link>https://devzone.nordicsemi.com/thread/170044?ContentTypeID=1</link><pubDate>Fri, 08 Feb 2019 07:24:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6432555e-992c-45d9-a241-cf8eb89d854d</guid><dc:creator>abhibera</dc:creator><description>&lt;p&gt;Found that the error is taking place in nrf_crypto_ecdsa.c at Line 386&lt;/p&gt;
&lt;pre&gt;result = backend_implementation(p_context, p_private_key, p_hash, hash_size, p_signature);&lt;br /&gt;&lt;br /&gt;The call to the backend_implementation function is returning error code 0x8516. I haven&amp;#39;t been able to find any description for this.&lt;br /&gt;&lt;br /&gt;Am I missing something in sdk_config.h that is causing this error?&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>