[U-Boot] [PATCH v3] lib:crc32:hash: Allow setting of the initial crc32 value

Lukasz Majewski l.majewski at samsung.com
Thu May 8 10:59:51 CEST 2014


Hi Simon,

> Hi Lukasz,
> 
> On 7 May 2014 06:57, Lukasz Majewski <l.majewski at samsung.com> wrote:
> >
> > The current approach set the initial value of crc32 calculation to
> > zero, which is correct for calculating checksum of the whole chunk
> > of data.
> >
> > It however, lacks the flexibility, when one wants to calculate
> > CRC32 of a file comprised of many smaller parts received separately.
> >
> > In the proposed approach the output value is used as a starting
> > condition for the proper crc32 calculation at crc32_wd function.
> > This behavior is identical to the one provided by crc32() method
> > implementation.
> >
> > Additionally comments were appropriately updated.
> 
> Maybe I am missing something, but this doesn't seem necessary. In
> hash.h we have
> 
> hash_init()
> hash_update()
> hash_finish()
> 
> which permits you to pass more data through a hash function. Doesn't
> this already do what you want?

I thought, that I would get away with replacing crc32() function call
with similar one - hash_block(). As it was pointed out it doesn't
itself provide the same functionality.

However, I will try to implement the solution you suggested. Thanks for
tip.


> 
> What is missing is probably command-line access to this API.
> Something like:
> 
> hash init <envvar>, <algo>
> hash update  <envvar>, <data>, <size>
> hash finish <envvar>, [*]<result>
> 
> or similar.
> 
> Regards,
> Simon


-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list