<?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>Cannot run MBEDTLS Example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52352/cannot-run-mbedtls-example</link><description>I am trying to run the example of generating a random string from MBEDTLS website , below is my code , before running this code I have done the following changes. 
 Set MBEDTLS_CONFIG_FILE to nrf_mbedtls_config_file.h , included the necessary library</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 30 Jul 2020 18:06:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52352/cannot-run-mbedtls-example" /><item><title>RE: Cannot run MBEDTLS Example</title><link>https://devzone.nordicsemi.com/thread/262463?ContentTypeID=1</link><pubDate>Thu, 30 Jul 2020 18:06:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb58f0f6-a5db-4b35-b8cf-850822092341</guid><dc:creator>Chinguu</dc:creator><description>&lt;p&gt;Hello, has this thread been solved i m getting the same error, it tells me:&lt;/p&gt;
&lt;p&gt;#error &amp;quot;Platform entropy sources only work on Unix and Windows, see MBEDTLS_NO_PLATFORM_ENTROPY in config.h&amp;quot;&lt;/p&gt;
&lt;p&gt;However, i am using Windows.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot run MBEDTLS Example</title><link>https://devzone.nordicsemi.com/thread/210998?ContentTypeID=1</link><pubDate>Fri, 20 Sep 2019 15:17:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7907f19-c248-40a4-8ef6-eb0adff38e99</guid><dc:creator>Sigurd</dc:creator><description>[quote userid="83091" url="~/f/nordic-q-a/52352/cannot-run-mbedtls-example/210878"]so all my functions are like mbedtls_***() I wanna keep them that way[/quote]
&lt;p&gt;I understand, but it might be useful to see how nrf_crypto uses&amp;nbsp;&lt;span&gt;mbedtls_* functions. E.g. we are seeding and adding the rng backend like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;// Callback function used by mbed TLS to seed and reseed.
static int entropy_callback(void * p_entropy, unsigned char * p_buffer, size_t size)
{
    UNUSED_PARAMETER(p_entropy);

    nrf_drv_rng_block_rand(p_buffer, size);

    return 0;
}


ret_code_t nrf_crypto_rng_backend_init(void * const p_context, void * const p_temp_buffer)
{
    ret_code_t                  ret_val;
    int                         mbedtls_ret_val;
    mbedtls_ctr_drbg_context  * p_mbedtls_context =
        &amp;amp;((nrf_crypto_backend_rng_context_t *)p_context)-&amp;gt;mbedtls_context;

    UNUSED_PARAMETER(p_temp_buffer);

    ret_val = nrf_drv_rng_init(NULL);

    if (ret_val != NRF_SUCCESS)
    {
        return ret_val;
    }

    mbedtls_ctr_drbg_init(p_mbedtls_context);

    // Initial seeding. The nrf_crypto_rng API does not support additional entropy in the initial
    // seeding. Additional entropy can be provided using nrf_crypto_rng_backend_reseed(),
    // which calls mbedtls_ctr_drbg_reseed().
    mbedtls_ret_val = mbedtls_ctr_drbg_seed(p_mbedtls_context,
                                            entropy_callback,
                                            NULL,
                                            NULL,
                                            0);

    ret_val = result_get(mbedtls_ret_val);

    return ret_val;
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Anyways, if you upload the project, I could take a closer look at the issue. I could convert this to a private case, if you don&amp;#39;t want to share the project publicly.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot run MBEDTLS Example</title><link>https://devzone.nordicsemi.com/thread/210878?ContentTypeID=1</link><pubDate>Fri, 20 Sep 2019 09:07:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3ea654b-6cc7-4226-8834-221759679c5c</guid><dc:creator>german_wings</dc:creator><description>&lt;p&gt;Hey, There Thank you for responding&lt;/p&gt;
&lt;p&gt;I am using the latest and the greatest SDK 15.3.0. all my previous code uses lmbedcrypto lib , so all my functions are like mbedtls_***() I wanna keep them that way&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&amp;nbsp;, However I could not understand my aes example from mbedtls website runs just fine on my NRF52 DK board. Just the entropy generator fails.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://tls.mbed.org/kb/how-to/encrypt-with-aes-cbc"&gt;https://tls.mbed.org/kb/how-to/encrypt-with-aes-cbc&lt;/a&gt; this code runs fine as is no changes required , to generate IV(I am using static array right now as IV) I wanna use the mbedtls entropy generator (some thing from here &lt;a href="https://tls.mbed.org/kb/how-to/add-a-random-generator)"&gt;tls.mbed.org/.../add-a-random-generator)&lt;/a&gt; , This is where I am stuck. The ECB mode would run ok. no problem in that , entropy is stuck.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot run MBEDTLS Example</title><link>https://devzone.nordicsemi.com/thread/210874?ContentTypeID=1</link><pubDate>Fri, 20 Sep 2019 08:54:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f20d06f-62b1-4f49-ab28-6fc6d690b79e</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you upload the project ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What SDK version are you using?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;PS: Note that we have AES crypto examples using mbedtls backend &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/nrf_crypto_aes_example.html?cp=5_1_4_3_0_1"&gt;here&lt;/a&gt;. Also see &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/lib_crypto.html?cp=5_1_3_11_0#lib_crypto_intro_frontend"&gt;this&lt;/a&gt; and &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/lib_crypto_aes.html?cp=5_1_3_11_15_0"&gt;this&lt;/a&gt; page.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>