<?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>Erase the Previous program when secure OTA with Wrong Key?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33643/erase-the-previous-program-when-secure-ota-with-wrong-key</link><description>Hi, 
 I am working on secure OTA in my custom Board which is having nrf51822. 
 I had done secure OTA successfully with SDK 12 but when i am trying to update the code using wrong private key at that time my old program erased by itself and my board start</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 May 2018 11:04:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33643/erase-the-previous-program-when-secure-ota-with-wrong-key" /><item><title>RE: Erase the Previous program when secure OTA with Wrong Key?</title><link>https://devzone.nordicsemi.com/thread/130999?ContentTypeID=1</link><pubDate>Fri, 04 May 2018 11:04:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7c3a712-e18a-43f4-b308-91dd54bec7c7</guid><dc:creator>Nilesh Bhavsar</dc:creator><description>&lt;p&gt;Hello Sir,&lt;/p&gt;
&lt;p&gt;There is silly mistake by me in testing.&lt;/p&gt;
&lt;p&gt;When i update the program using wrong credential. it is not like erase program but make it in again &amp;quot;DFUtarg&amp;quot; mode or when i restart device its start working normally like my previous application.&lt;/p&gt;
&lt;p&gt;Thank you.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Erase the Previous program when secure OTA with Wrong Key?</title><link>https://devzone.nordicsemi.com/thread/130009?ContentTypeID=1</link><pubDate>Thu, 26 Apr 2018 15:23:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c92722c8-777b-4f52-a3a4-40b50d622e76</guid><dc:creator>Rune Holmgren</dc:creator><description>&lt;p&gt;It sounds to me like you are having a different problem. A wrong key shouldn&amp;#39;t invalidate the existing application.&amp;nbsp;I might have to try this out myself since there could be some bug unknown to me. If I can reproduce the issue I can help find a suitable workaround. First I have a few questions:&lt;/p&gt;
&lt;p&gt;What error code are you getting from the device?&lt;/p&gt;
&lt;p&gt;Is the failing update you are sending completely identical to the successful one?&lt;/p&gt;
&lt;p&gt;Have you tried resetting the device after the failed update to ensure that it&amp;#39;s not just the device being ready to receive another update?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Rune Holmgren&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Erase the Previous program when secure OTA with Wrong Key?</title><link>https://devzone.nordicsemi.com/thread/129385?ContentTypeID=1</link><pubDate>Mon, 23 Apr 2018 14:46:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bda8ead9-a6e3-4471-b8ff-17e869306192</guid><dc:creator>Nilesh Bhavsar</dc:creator><description>&lt;p&gt;Hello sir,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank for your response.&lt;/p&gt;
&lt;p&gt;But, i tried to change&amp;nbsp;&lt;span&gt;function &amp;quot;nrf_dfu_find_cache&amp;quot; which is called in &amp;quot;dfu_req_handling.c&amp;quot;. By calling this function&amp;nbsp;with &amp;quot;true&amp;quot; instead of &amp;quot;false&amp;quot;. There is no change in behaviour of my chip. It will erase the program if once try to update using wrong key.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Erase the Previous program when secure OTA with Wrong Key?</title><link>https://devzone.nordicsemi.com/thread/129361?ContentTypeID=1</link><pubDate>Mon, 23 Apr 2018 13:30:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb4cbce8-6f2a-4141-ae9a-ed84978f9b99</guid><dc:creator>Rune Holmgren</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;When a DFU process is running, there are a few different phases to consider. They are distinctly separated&amp;nbsp;by the prevalidation and post validation operation.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Before prevalidation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Everything that happens before prevalidation can be done by anyone at any time given that they are able to connect to the BLE device. Because of this, we never perform operations at this point which are not reversible during this period. We will initiate the DFU process and receive the &amp;quot;init packet&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prevalidation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;After receiving the init packet, the prevalidation is run. At this point, we will check that this update is to be started. This includes checking compatibility with the SoftDevice, checking hardware version numbers, checking the version number of the new firmware, and finally verifying the ECDSA based signature. Only with a successful prevalidation will we continue the process. Note that the &amp;quot;debug&amp;quot; version of the bootloaders available in the SDK will skip several checks.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Between pre- and &lt;/strong&gt;postvalidation&lt;/p&gt;
&lt;p&gt;In this period we will be receiving the new firmware. If there is enough space to perform a dual bank update, the bootloader will not remove the existing application. If such an update fails though power failure, an invalid package or BLE disconnection, the original application will still be present and valid. However, if there is not enough free space for the new update the bootloader will delete the existing application and use the free space. If a single bank update is interrupted the device will only have a bootloader and no app. It can not be used until an application update has been performed.&lt;/p&gt;
&lt;p&gt;In your case you want to never be in a situation where the application is deleted. This means that you will have to have enough space on the device to perform the update. You may change the value of the &amp;quot;dual_bank_only&amp;quot; parameter in the function &amp;quot;nrf_dfu_find_cache&amp;quot; which is called in &amp;quot;dfu_req_handling.c&amp;quot;. By calling this function&amp;nbsp;with &amp;quot;true&amp;quot; instead of &amp;quot;false&amp;quot; you force the device to reject any updates too large for dual banking. Note that this means you have to have a small enough application to receive&amp;nbsp;whatever updates you are planning to send. On an nRF51 this means a very small application.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Post validation and after post validation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Not relevant to your problem. If the application has not been removed by this point, you will not have any issues.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&amp;quot;I had done secure OTA successfully with SDK 12 but when &lt;/strong&gt;&lt;/em&gt;i&lt;em&gt;&lt;strong&gt; am trying to update the code using &lt;/strong&gt;&lt;/em&gt;wrong&lt;em&gt;&lt;strong&gt; private key at that time my old program erased by itself and my board start to emit &amp;quot;DFUTarg&amp;quot;.&amp;quot;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is not something that should happen just because you have used the wrong key. Are you using the debug version of the example or something? I am curious as to how you got into this state. If you reset the device, will it the still not switch to the application?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Rune Holmgren&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>