[riot-devel] sha256

Francisco Javier Acosta Padilla francisco.acosta at inria.fr
Wed Dec 21 14:11:05 CET 2016

Hi Oleg! Thanks for your answer.

I should maybe give more hints.

I’m compiling sha256 without RIOT (and actually I removed #include “board.h”, I don’t know what’s the use there) and it compiles fine, but maybe it references something on RIOT internals?

firmware_bin it’s a binary file of a firmware, loaded using fopen. metadata.hash it’s a local variable, so it’s no related to firmware_bin.

Maybe this function is only intended for its use on RIOT?

My goal is to produce the same hash using a native application (without RIOT) and compare it at runtime by a RIOT application in a iotlab-m3 node. I suppose that using the same sha256 function on both sides increases interoperability, but it’s also true that a sha256 should be the same in all circumstances.

Thanks again for your help!



On 16 December 2016 at 19:00:16, Oleg Hahm (oliver.hahm at inria.fr) wrote:

Hey Paco!  

On Fri, Dec 16, 2016 at 06:47:19PM +0100, Francisco Javier Acosta Padilla wrote:  
> I’m trying the sha256 module on RIOT master and I just realised it returns  
> always a different value… for now, I’m doing this:  
> sha256_init(&sha256);  
> sha256_update(&sha256, (uint8_t*)firmware_bin, firmware_size);  
> sha256_final(&sha256, metadata.hash);  
> To initialise and store the hash, according to the unittest which does very  
> similar.  
> Am I doing something wrong?  

Strange. At a first glance your code seems to be valid for me. Could you share  
a pointer to your project? Is maybe first somehow corrupted or is metadata a  
part of firmware_bin?  


DPRINTK("strange things happen ...\n");  
devel mailing list
devel at riot-os.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20161221/5ea690e6/attachment.html>

More information about the devel mailing list