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

Simon Glass sjg at chromium.org
Thu May 8 01:04:21 CEST 2014


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?

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


More information about the U-Boot mailing list