<?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>How to validate signature check requirements</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70726/how-to-validate-signature-check-requirements</link><description>I am trying to create a test case for in house validation and would like to know how to do so. 
 Here is what I want to do: 
 
 I want to create a boot loader that checks the signature of the application every time the device boots up. 
 I want to combine</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Feb 2021 09:55:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70726/how-to-validate-signature-check-requirements" /><item><title>RE: How to validate signature check requirements</title><link>https://devzone.nordicsemi.com/thread/292159?ContentTypeID=1</link><pubDate>Mon, 01 Feb 2021 09:55:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2166ed8e-71eb-4672-a8bb-3cfb90ccb449</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi RMV,&lt;/p&gt;
[quote user="RMV"]I can get the version without any encryption to boot up, but have not been successful in making this update process work with encryption.[/quote]
&lt;p&gt;It should have worked if you only use signature verification on the app. If also used on the SoftDevice then there is a bug in SDK 16 which was fixed in SDK 17 (see &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/index.html"&gt;SDK 17.0.2 release notes&lt;/a&gt;). You could back-port that if needed. In what way does this not work? Do you get any errors or sensible logs form the bootloader if you test with the _debug bootloader with RTT loggign?&lt;/p&gt;
[quote user="RMV"]I would like to use ECDSA with 256bit hash but can settle for a related and supported variant on this ecosystem.[/quote]
&lt;p&gt;The bootloader supports exactly what you want, and that is the only cryptographic has that is supported out of the box. Others can be added, but I do not see a need for that as your wishes is in line with the SDK support.&lt;/p&gt;
[quote user="RMV"]What combination of preprocessor symbols (and anything else that I am unaware of) is required to be defined in the sdk_config and the command line when: &lt;br /&gt;1. Building the boot loader + DFU&lt;br /&gt;2. Building the application + buttonless DFU service[/quote]
&lt;p&gt;To be honest the down-side with sdk_config.h is that it is huge and automatically generated. We do not provide any minimal set. I recommend you just start off with the relevant example. Most examples have a complete sdk_config.h. If you for some reason want to minimize it, you can remove configurations that is not used, but I do not have any such minimal sdk_config.h files to provide. That does not have any effect on the resulting code, though. Similarly, if you miss some configuration macros you will typically see quite easily from the error when building what is missing so that you can add missing parts form an example sdk_config.h file. I understand this is not the answer you hoped for, but this is how the nRF5 SDK is organized.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate signature check requirements</title><link>https://devzone.nordicsemi.com/thread/292044?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2021 17:01:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0479fe8e-a891-4b34-8bcf-798e5d30b40a</guid><dc:creator>RVM</dc:creator><description>[quote userid="7377" url="~/f/nordic-q-a/70726/how-to-validate-signature-check-requirements/290605#290605"]This is not related to programming itself. The points is that you need to specify the validation method when you generate the bootloader settings page so that it is properly signed. Specifically you need to use&amp;nbsp;&lt;code&gt;--app-boot-validation&amp;nbsp;VALIDATE_ECDSA_P256_SHA256&lt;/code&gt;. You can type&amp;nbsp;&lt;code&gt;nrfutil settings generate --help&lt;/code&gt; for more details on settings page generation.[/quote]
&lt;p&gt;I can get the version without any encryption to boot up, but have not been successful in making this update process work with encryption.&lt;/p&gt;
&lt;p&gt;I am using SDK v16.0.0, Soft Device S132 v7.0.1 on an nRF52832 custom board. &lt;br /&gt;I would like to use ECDSA with 256bit hash but can settle for a related and supported variant on this ecosystem.&lt;/p&gt;
&lt;p&gt;My question is: &lt;br /&gt;What combination of preprocessor symbols (and anything else that I am unaware of) is required to be defined in the sdk_config and the command line when: &lt;br /&gt;1. Building the boot loader + DFU&lt;br /&gt;2. Building the application + buttonless DFU service&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: How to validate signature check requirements</title><link>https://devzone.nordicsemi.com/thread/290619?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 21:13:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9ea3d6a-6236-4f52-87e9-3a95d69ac2f5</guid><dc:creator>RVM</dc:creator><description>&lt;p&gt;Thank you for the walkthrough. I will mark this as &amp;#39;answered&amp;#39;&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: How to validate signature check requirements</title><link>https://devzone.nordicsemi.com/thread/290605?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 18:23:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:575dbd0f-0a53-48e7-845e-90cc7f365fb5</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="RMV"]I am sorry but I do not know how to &amp;quot;specify here as well that there should be a signature verification&amp;quot; -- I am using JLINK over SWD so what would be the workflow for specifying signature verification at boot up?[/quote]
&lt;p&gt;This is not related to programming itself. The points is that you need to specify the validation method when you generate the bootloader settings page so that it is properly signed. Specifically you need to use&amp;nbsp;&lt;code&gt;--app-boot-validation&amp;nbsp;VALIDATE_ECDSA_P256_SHA256&lt;/code&gt;. You can type&amp;nbsp;&lt;code&gt;nrfutil settings generate --help&lt;/code&gt; for more details on settings page generation.&lt;/p&gt;
[quote user="RMV"]Do you mean a dummy &amp;#39;key file&amp;#39; instead of &amp;#39;hex file&amp;#39; ?[/quote]
&lt;p&gt;No, I ment hex file, but you will get the same effect by changing the key file. Essentially, you need both the correct data and correct key to generate a valid signature. So replacing any of the two when generating the bootloader settings page would cause subsequent signature verification to fail (as expected).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate signature check requirements</title><link>https://devzone.nordicsemi.com/thread/290599?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 16:52:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3eca445-780e-474a-911f-9532384d20c2</guid><dc:creator>RVM</dc:creator><description>[quote userid="7377" url="~/f/nordic-q-a/70726/how-to-validate-signature-check-requirements/290522#290522"]&lt;blockquote class="quote"&gt;&lt;div class="quote-content"&gt;(IMPORTANT) I want to download this package to the device using a &amp;#39;SWD debug port&amp;#39; -- not by any generic DFU workflows.&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="quote-footer"&gt;&lt;/div&gt;
&lt;p&gt;No problem. As long as your merged hex file includes a &lt;a href="https://infocenter.nordicsemi.com/topic/ug_nrfutil/UG/nrfutil/nrfutil_settings_generate_display.html"&gt;bootloader settings page&lt;/a&gt;, the app will start and everything will work after programming via SWD. Note that you need to specify here as well that there should be a signature verification, so that the correct signature is part of the generated settings page.&lt;/p&gt;[/quote]
&lt;p&gt;I am sorry but I do not know how to &amp;quot;specify here as well that there should be a signature verification&amp;quot; -- I am using JLINK over SWD so what would be the workflow for specifying signature verification at boot up?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/70726/how-to-validate-signature-check-requirements/290522#290522"]&lt;blockquote class="quote"&gt;&lt;div class="quote-content"&gt;Then I want to power cycle and reboot the device and ensure that I can FORCE the device to FAIL the boot up validation by using a &amp;#39;WRONG&amp;#39; key somewhere in the process that leads to the generation of the single HEX file in (2) above.&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="quote-footer"&gt;&lt;/div&gt;
&lt;p&gt;To do this, just supply a dummy hex file instead of the correct hex file when generating the bootloader settings page. Then the signature will not be valid for the actual hex file, and the bootloader will not start the application.&lt;/p&gt;[/quote]
&lt;p&gt;Do you mean a dummy &amp;#39;key file&amp;#39; instead of &amp;#39;hex file&amp;#39; ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to validate signature check requirements</title><link>https://devzone.nordicsemi.com/thread/290522?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 13:02:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1eb2232a-693f-4e8c-8212-270230e70404</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi RMV,&lt;/p&gt;
[quote user=""]Can this be done, and if so, how?[/quote]
&lt;p&gt;Yes, this is all supported out of the box.&lt;/p&gt;
[quote user=""]I want to create a boot loader that checks the signature of the application every time the device boots up.[/quote]
&lt;p&gt;This is supported by the nRF5 SDK bootloader. By default it will only check a CRC of the application, but you can require a signature check by setting&amp;nbsp;NRF_BL_APP_SIGNATURE_CHECK_REQUIRED to 1 in the bootloader&amp;#39;s sdk_config.h.&lt;/p&gt;
[quote user=""]I want to combine the SoftDevice, the boot loader, the boot loader settings and the application into a single HEX file[/quote]
&lt;p&gt;That is no problem. You can merge all these to a single hex using the mergehex tool which is part of &lt;a href="https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools/Download"&gt;nRF Command Line Tools&lt;/a&gt;.&lt;/p&gt;
[quote user=""](IMPORTANT) I want to download this package to the device using a &amp;#39;SWD debug port&amp;#39; -- not by any generic DFU workflows.[/quote]
&lt;p&gt;No problem. As long as your merged hex file includes a &lt;a href="https://infocenter.nordicsemi.com/topic/ug_nrfutil/UG/nrfutil/nrfutil_settings_generate_display.html"&gt;bootloader settings page&lt;/a&gt;, the app will start and everything will work after programming via SWD. Note that you need to specify here as well that there should be a signature verification, so that the correct signature is part of the generated settings page.&lt;/p&gt;
[quote user=""]Then I want to power cycle and reboot the device and ensure that I can FORCE the device to FAIL the boot up validation by using a &amp;#39;WRONG&amp;#39; key somewhere in the process that leads to the generation of the single HEX file in (2) above.[/quote]
&lt;p&gt;To do this, just supply a dummy hex file instead of the correct hex file when generating the bootloader settings page. Then the signature will not be valid for the actual hex file, and the bootloader will not start the application.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>