<?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>Bootloader build with ECDSA256 (nRF52832, SDK 16.0.0, S132 v7.0.1)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70847/bootloader-build-with-ecdsa256-nrf52832-sdk-16-0-0-s132-v7-0-1</link><description>I want to bring up a secure bootloader with support for ECDSA and SHA-256. 
 I am having a hard time coming up with a combination of SDK components (frontend, backend), external libraries, and preprocessor symbol definitions in the sdk_config.h file.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 26 Jan 2021 17:25:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70847/bootloader-build-with-ecdsa256-nrf52832-sdk-16-0-0-s132-v7-0-1" /><item><title>RE: Bootloader build with ECDSA256 (nRF52832, SDK 16.0.0, S132 v7.0.1)</title><link>https://devzone.nordicsemi.com/thread/291354?ContentTypeID=1</link><pubDate>Tue, 26 Jan 2021 17:25:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d86eee4-a4d6-4860-a401-b7feee6a835a</guid><dc:creator>RVM</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think I quite agree with all the arrangements but I will mark this as answered so this ticket can be closed.&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;RMV&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader build with ECDSA256 (nRF52832, SDK 16.0.0, S132 v7.0.1)</title><link>https://devzone.nordicsemi.com/thread/291207?ContentTypeID=1</link><pubDate>Tue, 26 Jan 2021 09:10:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff985421-d4a8-4d8e-a096-26367c06c1f5</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi RMV,&amp;nbsp;&lt;/p&gt;
[quote user="RMV"]It looks like this symbol is defined in one of these backends (cc310, cc310_bl, mbedtls, nrf_sw, oberon) but I do not see this symbol being defined in the micro-ecc. How then does one use the micro-ecc for the backend?[/quote]
&lt;p&gt;micro-ecc will do the elliptic curve cryptography, but no the hashing. I recommend you just refer to a example bootloader project for the nRF52832. Then you will see that in addition to the micro-ecc backend,&amp;nbsp;NRF_CRYPTO_BACKEND_NRF_SW_ENABLED is set to 1 and&amp;nbsp;NRF_CRYPTO_BACKEND_NRF_SW_HASH_SHA256_ENABLED is set to 1. That provides the&amp;nbsp;SHA256 support that you are currently missing.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader build with ECDSA256 (nRF52832, SDK 16.0.0, S132 v7.0.1)</title><link>https://devzone.nordicsemi.com/thread/291205?ContentTypeID=1</link><pubDate>Tue, 26 Jan 2021 09:06:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c749381-94a1-4358-9604-93d51dc2a224</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi RMV,&lt;/p&gt;
[quote user="RMV"]The problem is that I never seem to get a clean build with NO WARNINGS in the build output.[/quote]
&lt;p&gt;I am not sure why that causes (if you need assistance on that please provide more information or code). But as explained before, the SDK bootloader example works with&amp;nbsp;&lt;span&gt;ECDSA_P256_SHA256 boot validation out of the box, and the example bootloader builds without any warnings or errors. So you need to look into your changes.&lt;/span&gt;&lt;/p&gt;
[quote user="RMV"]I have now been made aware that one of the warnings I see can&amp;nbsp; and should be ignored so maybe I should not be so paranoic about it[/quote]
&lt;p&gt;Not sure about that, I would say you should always make your code warning free. If not, you risk tuning your mind to ignoring warnings that actually matter, and then you will regret going down that path in the first place &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;&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader build with ECDSA256 (nRF52832, SDK 16.0.0, S132 v7.0.1)</title><link>https://devzone.nordicsemi.com/thread/291203?ContentTypeID=1</link><pubDate>Tue, 26 Jan 2021 09:00:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e7c598d-602a-4e52-b9c8-3cd7e8da9b33</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi RMV,&lt;/p&gt;
[quote user="RMV"]I think that &amp;#39;not defining&amp;#39; a variable should be treated as setting it to &amp;#39;0&amp;#39;.[/quote]
&lt;p&gt;yes, and that is generally the case. But for some special cases there are checks in the code to make sure this is something you have considered properly. Like here, and also&amp;nbsp; in case of&amp;nbsp;NRF_CRYPTO_CURVE25519_BIG_ENDIAN_ENABLED as that configuration macro was added after SDK 15.0.0, and the&amp;nbsp;intention in that case was to help users handle the API change instead of risking they suddenly getting unexpected behavior (due to endianness change between SDK versions).&lt;/p&gt;
[quote user="RMV"]I did get this warning to go away by explicitly setting it to &amp;#39;0&amp;#39; without setting ANY OTHER RELATED macros explicitly -- and that was my issue.[/quote]
&lt;p&gt;Yes, of course.&lt;/p&gt;
[quote user="RMV"]I think this should be changed -- I never wanted to use the 310 so I did not expect to define ANY 310 macros.[/quote]
&lt;p&gt;This will not be changed. The nrf_crypto API has had this way of configuring everything via sdk_config.h since it was introduced, and while I agree it gives a long sdk_config.h and a lot of macros, the end result seems to be working well. A lot of flexibility and no additional complexity runtime (saving CPU time and power).&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader build with ECDSA256 (nRF52832, SDK 16.0.0, S132 v7.0.1)</title><link>https://devzone.nordicsemi.com/thread/291132?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2021 18:10:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58659fd1-61e7-41c5-b51f-d752c2a9d237</guid><dc:creator>RVM</dc:creator><description>[quote userid="7377" url="~/f/nordic-q-a/70847/bootloader-build-with-ecdsa256-nrf52832-sdk-16-0-0-s132-v7-0-1/291038#291038"]&lt;blockquote class="quote"&gt;&lt;div class="quote-content"&gt;3. I found out, after navigating through many web pages and spending quite a few hours, that the 310 backend is NOT supported on the nRF52832. Now I don&amp;#39;t know what is ACTUALLY supported on the nRF52832 -- should Iuse uECC or should I use OBERON or &amp;#39;nrf sw implementation/?&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="quote-footer"&gt;&lt;/div&gt;
&lt;p&gt;CC310 / CryptoCell is a HW peripheral in the nRF52840. It is not available in any other nRF52 series devices. However, all the other nrf_crypto backends are SW libraries that can be used on any nRF52 device. In the bootloader it makes most sense to use micro-ecc as it seems you are allready doing, as that has a small footprint.&lt;/p&gt;[/quote]
&lt;p&gt;If I try to stick with just the micro-ecc I get this linker error: &amp;quot;nrf_dfu_validation.c:(.text.nrf_dfu_validation_signature_check+0x3e): undefined reference to `nrf_crypto_hash_calculate&amp;#39;&amp;quot;&lt;/p&gt;
&lt;p&gt;I see that it is defined in the file nrf_crypto_hash.c but the code is not compiled because this macro is evaluting to a &amp;#39;0&amp;#39;&lt;br /&gt;#if NRF_MODULE_ENABLED(NRF_CRYPTO_HASH)&lt;/p&gt;
&lt;p&gt;It looks like this symbol is defined in one of these backends (cc310, cc310_bl, mbedtls, nrf_sw, oberon) but I do not see this symbol being defined in the micro-ecc. How then does one use the micro-ecc for the backend?&lt;/p&gt;
&lt;p&gt;Cheers&lt;br /&gt;RMV&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader build with ECDSA256 (nRF52832, SDK 16.0.0, S132 v7.0.1)</title><link>https://devzone.nordicsemi.com/thread/291129?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2021 17:39:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70ae4865-c722-42cf-b71a-b35ee752f415</guid><dc:creator>RVM</dc:creator><description>[quote userid="7377" url="~/f/nordic-q-a/70847/bootloader-build-with-ecdsa256-nrf52832-sdk-16-0-0-s132-v7-0-1/291038#291038"]&lt;blockquote class="quote"&gt;&lt;div class="quote-content"&gt;2.I was able to recreate the build used by the secure_bootloader example but over time I am beginning to get the feeling that the configuration out of the box does not support ECDSA-256 (?)&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="quote-footer"&gt;&lt;/div&gt;
&lt;p&gt;Why do you get that feeling? The SDK bootloader support using&amp;nbsp;ECDSA_P256_SHA256 boot validation of the application out of the box as explained in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/70726/how-to-validate-signature-check-requirements"&gt;this thread&lt;/a&gt;.&lt;/p&gt;[/quote]
&lt;p&gt;Hi Einar&lt;/p&gt;
&lt;p&gt;That thread is also something that I created based on shared experiences with the same project I am trying to bring up.&lt;br /&gt;The problem is that I never seem to get a clean build with NO WARNINGS in the build output.&lt;br /&gt;I have now been made aware that one of the warnings I see can&amp;nbsp; and should be ignored so maybe I should not be so paranoic about it &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;&lt;/p&gt;
&lt;p&gt;Cheers&lt;br /&gt;RMV&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader build with ECDSA256 (nRF52832, SDK 16.0.0, S132 v7.0.1)</title><link>https://devzone.nordicsemi.com/thread/291128?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2021 17:35:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f1fa707-eda5-4380-8358-8a8626eb1bb6</guid><dc:creator>RVM</dc:creator><description>&lt;p&gt;Thanks Einar.&lt;/p&gt;
&lt;p&gt;As for&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/70847/bootloader-build-with-ecdsa256-nrf52832-sdk-16-0-0-s132-v7-0-1/291038#291038"]&lt;blockquote class="quote"&gt;&lt;div class="quote-content"&gt;If I do not define the Curve25519 specific parameters then I get this warning:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="font-family:courier new, courier;"&gt;#warning NRF_CRYPTO_BACKEND_CC310_BL_HASH_SHA256_ENABLED define not found in sdk_config.h (Is the sdk_config.h valid?)&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="quote-footer"&gt;&lt;/div&gt;
&lt;p&gt;Again, I suspect you have a problem with your sdk_config.h. You should copy the whole nrf_crypto section of a valid sdk_config.h and adapt to your needs. That means not deleting anything, but just toggling features off or on by settings the definitions to 0 or 1 as explained &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_crypto_config.html"&gt;here&lt;/a&gt;. That way you should not get any of these warnings.&lt;/p&gt;[/quote]
&lt;p&gt;I think that &amp;#39;not defining&amp;#39; a variable should be treated as setting it to &amp;#39;0&amp;#39;. &lt;br /&gt;I did get this warning to go away by explicitly setting it to &amp;#39;0&amp;#39; without setting ANY OTHER RELATED macros explicitly -- and that was my issue.&lt;br /&gt;I think this should be changed -- I never wanted to use the 310 so I did not expect to define ANY 310 macros.&lt;/p&gt;
&lt;p&gt;Cheers&lt;br /&gt;RMV&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader build with ECDSA256 (nRF52832, SDK 16.0.0, S132 v7.0.1)</title><link>https://devzone.nordicsemi.com/thread/291038?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2021 13:13:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52d7b24f-9020-4e54-95f7-f4189c1ef8e5</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi RMV,&lt;/p&gt;
[quote user=""]The first issue I ran into was that I need to set up a &amp;#39;frontend&amp;#39; and a &amp;#39;backend&amp;#39;.[/quote]
&lt;p&gt;The nrf_crypto library provide a unified API for a number of different crypto libraries. If you use an SDK example you generally have all libraries included in the project and just need to select the desired backend in sdk_config.h See &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_crypto_config.html"&gt;Configuring nrf_crypto frontend and backends&lt;/a&gt;.&lt;/p&gt;
[quote user=""]1. In this regard I am not sure what role is played by the external uECC library that I built with GCC ARM.[/quote]
&lt;p&gt;micro-ecc is one of the supported backend for nrf_crypto. If you enable the micro-ecc backend for the specific algorithm you use, then this backend will be used for that algorithm.&lt;/p&gt;
[quote user=""]2.I was able to recreate the build used by the secure_bootloader example but over time I am beginning to get the feeling that the configuration out of the box does not support ECDSA-256 (?)[/quote]
&lt;p&gt;Why do you get that feeling? The SDK bootloader support using&amp;nbsp;ECDSA_P256_SHA256 boot validation of the application out of the box as explained in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/70726/how-to-validate-signature-check-requirements"&gt;this thread&lt;/a&gt;.&lt;/p&gt;
[quote user=""]3. I found out, after navigating through many web pages and spending quite a few hours, that the 310 backend is NOT supported on the nRF52832. Now I don&amp;#39;t know what is ACTUALLY supported on the nRF52832 -- should Iuse uECC or should I use OBERON or &amp;#39;nrf sw implementation/?[/quote]
&lt;p&gt;CC310 / CryptoCell is a HW peripheral in the nRF52840. It is not available in any other nRF52 series devices. However, all the other nrf_crypto backends are SW libraries that can be used on any nRF52 device. In the bootloader it makes most sense to use micro-ecc as it seems you are allready doing, as that has a small footprint.&lt;/p&gt;
[quote user=""]An example is when I tried to enable the OBERON backend --&lt;br /&gt;&amp;nbsp; If I enable all the same flags in the basic crypto example I get this warning (even though the build succeeds)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="font-family:courier new, courier;"&gt;#warning &amp;quot;NRF_CRYPTO_CURVE25519_BIG_ENDIAN_ENABLED not defined. Please define it to choose the endianness of Curve25519 parameters.&amp;quot;&lt;/span&gt;[/quote]
&lt;p&gt;Have you migrated from an earlier SDK version, or is there another reason your sdk_config.h is not valid out of the box? In any case, you can fix this by defining&amp;nbsp;NRF_CRYPTO_CURVE25519_BIG_ENDIAN_ENABLED to 0 or 1 as you can see done in many example sdk_config.h files in the SDK. Note that it will not have any practical implications though, unless you actually use that curve (though I fully agree that you should make your code build without any warnings).&lt;/p&gt;
[quote user=""]If I do not define the Curve25519 specific parameters then I get this warning:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="font-family:courier new, courier;"&gt;#warning NRF_CRYPTO_BACKEND_CC310_BL_HASH_SHA256_ENABLED define not found in sdk_config.h (Is the sdk_config.h valid?)&lt;/span&gt;[/quote]
&lt;p&gt;Again, I suspect you have a problem with your sdk_config.h. You should copy the whole nrf_crypto section of a valid sdk_config.h and adapt to your needs. That means not deleting anything, but just toggling features off or on by settings the definitions to 0 or 1 as explained &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_crypto_config.html"&gt;here&lt;/a&gt;. That way you should not get any of these warnings.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>