From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Thu, 08 May 2014 10:59:51 +0200 Subject: [U-Boot] [PATCH v3] lib:crc32:hash: Allow setting of the initial crc32 value In-Reply-To: References: <1399295277-28334-1-git-send-email-l.majewski@samsung.com> <1399467466-25115-1-git-send-email-l.majewski@samsung.com> Message-ID: <20140508105951.07cb74fb@amdc2363> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Simon, > Hi Lukasz, > > On 7 May 2014 06:57, Lukasz Majewski 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 , > hash update , , > hash finish , [*] > > or similar. > > Regards, > Simon -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group