<?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 Verification post DFU over thread</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71229/hash-verification-post-dfu-over-thread</link><description>Hello Everyone, 
 We are using nRF52840 IC for our products which has 1 MB of flash. 
 Thread Secure DFU Example provided with Nordic SDK supports only Dual Bank DFU. This limits the application size. 
 Our Application size is increasing and therefore</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 Feb 2021 11:15:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71229/hash-verification-post-dfu-over-thread" /><item><title>RE: Hash Verification post DFU over thread</title><link>https://devzone.nordicsemi.com/thread/292874?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2021 11:15:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1de4de21-b7b3-4deb-b3c5-04166751ac98</guid><dc:creator>ashish_shukla</dc:creator><description>&lt;p&gt;Thanks Einar,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It solved the issue.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hash Verification post DFU over thread</title><link>https://devzone.nordicsemi.com/thread/292816?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2021 07:47:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e305bc65-d0b5-4ab4-9668-028b919becfe</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="ashish_shukla"]Can you suggest how can I direct this function to read from external&amp;nbsp; flash to calculate HASH, if at all possible ?&amp;nbsp;[/quote]
&lt;p&gt;It is not possible.&lt;/p&gt;
[quote user="ashish_shukla"]If not, what are other options to resolve this issue ?&amp;nbsp;[/quote]
&lt;p&gt;You can easily achieve the same thing by using the three functions I mentioned before, and copy chunks of data from your external flash into RAM (the size of the chunks is up to you). In more detail:&lt;/p&gt;
&lt;p&gt;1. Call&amp;nbsp;nrf_crypto_hash_init()&lt;/p&gt;
&lt;p&gt;2. Copy chunk of data into ram and call&amp;nbsp;nrf_crypto_hash_update() for that chunk. Then copy the next chunk and do the same until you have iterated over the entier image.&lt;/p&gt;
&lt;p&gt;3. Call&amp;nbsp;nrf_crypto_hash_finalize() to finialize the calculation and obtain the hash for the entire image.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hash Verification post DFU over thread</title><link>https://devzone.nordicsemi.com/thread/292802?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2021 05:58:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac5fcdce-fad9-4a1a-839a-053e576d2c62</guid><dc:creator>ashish_shukla</dc:creator><description>&lt;p&gt;Hi Einar,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the Clarification. Now, I understand why Hash verification fails in my case - as I&amp;#39;ve directed DFU packets to external flash, while this function must be calculating HASH based on contents of internal flash.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you suggest how can I direct this function to read from external&amp;nbsp; flash to calculate HASH, if at all possible ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If not, what are other options to resolve this issue ?&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;(You are probably using the CryptoCell CC310 backend on the nRF52840?&amp;nbsp;In this case the nrf_crypto library will copy chunks of data to RAM if the data is in flash (as in this case), as CC310 only can operate on data in RAM. That is an implementation detail the caller usually do not need to think about, though.)&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Yes - I&amp;#39;m using&amp;nbsp;CryptoCell CC310 backend.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hash Verification post DFU over thread</title><link>https://devzone.nordicsemi.com/thread/292745?ContentTypeID=1</link><pubDate>Wed, 03 Feb 2021 16:27:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e92852f-ff11-44ab-b9be-6ffd089dfb28</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]as it takes in starting address of firmware in flash, it&amp;#39;s length and calculates Hash. Does this function reads complete firmware from flash to calculate hash[/quote]
&lt;p&gt;Yes, that is correct (depending on which crypto backend is used this may be broken down internally, but the caller do not need to care about that). If this does not fit you and you would prefer to do split this in multiple steps for some reason, that is also possible. In that case you would call first&amp;nbsp;nrf_crypto_hash_init(), so&amp;nbsp;nrf_crypto_hash_update() an arbitrary number of times and lastly&amp;nbsp;nrf_crypto_hash_finalize(). You can refer to the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/group__nrf__crypto__hash.html"&gt;API documentation&lt;/a&gt; for details, as well as the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_crypto.html"&gt;nrf_crypto documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;(You are probably using the CryptoCell CC310 backend on the nRF52840?&amp;nbsp;In this case the nrf_crypto library will copy chunks of data to RAM if the data is in flash (as in this case), as CC310 only can operate on data in RAM. That is an implementation detail the caller usually do not need to think about, though.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>