<?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>HASH problem during DFU of Bootloader</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36884/hash-problem-during-dfu-of-bootloader</link><description>Hello, 
 We are using nRF5 SDK14.2.0 and soft device s132, and trying to perform DFU of the Bootloader itself. 
 The process fail in nrf_dfu_postvalidate() due to wrong HASH value calculated on the image written to the flash. We read the content of the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 01 Aug 2018 12:07:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36884/hash-problem-during-dfu-of-bootloader" /><item><title>RE: HASH problem during DFU of Bootloader</title><link>https://devzone.nordicsemi.com/thread/142378?ContentTypeID=1</link><pubDate>Wed, 01 Aug 2018 12:07:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4b2ee9f-df24-4670-a4a5-56d58c056d99</guid><dc:creator>Yosi.stx</dc:creator><description>&lt;p&gt;Thank you for the answer.&lt;/p&gt;
&lt;p&gt;I have noticed that the function sha256_update() uses 64 bytes segments. &lt;br /&gt;When the last segment is exactly 64 bytes: the calculation is always good.&lt;br /&gt;When the last segment is less then 64 bytes, for example only 48 bytes, the sha256_update() function&lt;br /&gt;is leaving the extra 16 bytes from the previous segment in the vector &amp;quot;ctx-&amp;gt;data[]&amp;quot;.&lt;br /&gt;At this point when running with debugger I noticed that&lt;strong&gt; previous data on this RAM sector was changed&lt;/strong&gt; &lt;br /&gt;(maybe due to stack overflow?) causing bad calculation. When the previous segment data is left &lt;br /&gt;at the end of vector &amp;quot;ctx-&amp;gt;data[]&amp;quot; the Hash calculation returns good results.&lt;br /&gt;I need to clear that we increased the original Bootloader code by using external SPI Flash&lt;br /&gt;and before our code addition &lt;span style="text-decoration:underline;"&gt;we didn&amp;#39;t have this problem.&lt;/span&gt;&lt;br /&gt;I increased the stack from the example default of 0x800 to &lt;strong&gt;0x1800&lt;/strong&gt; and for now we have good Hash calculation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HASH problem during DFU of Bootloader</title><link>https://devzone.nordicsemi.com/thread/141999?ContentTypeID=1</link><pubDate>Mon, 30 Jul 2018 16:23:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fac13503-ced7-4746-a2a8-69132bfafe99</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Yosi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think we have any requirement of application size have to be 128 byte align. Word align maybe required but not 128 bytes.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you send us an example of application hex file that you see the problem and let us test here ? Do you see the same problem when updating our example application in the SDK ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We have a step by step guide &lt;a href="https://devzone.nordicsemi.com/b/blog/posts/getting-started-with-nordics-secure-dfu-bootloader"&gt;here&lt;/a&gt; might be useful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HASH problem during DFU of Bootloader</title><link>https://devzone.nordicsemi.com/thread/141793?ContentTypeID=1</link><pubDate>Sun, 29 Jul 2018 16:44:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8d427ce-5156-4522-bf2c-706b52e0de26</guid><dc:creator>Yosi.stx</dc:creator><description>&lt;p&gt;Some clarification:&lt;/p&gt;
&lt;p&gt;The reason that DFU of application was successful is that by chance the test application that we used was with size aligned to 128 bytes.&lt;/p&gt;
&lt;p&gt;that mean we have the same HASH problem also when performing DFU of application FW.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>