
7 May
2014
7 May
'14
12:42 p.m.
Dear Lukasz Majewski,
In message 1399443021-11748-1-git-send-email-l.majewski@samsung.com you 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.
...
- if (*output)
memcpy(&crc, output, sizeof(crc));
- crc = crc32_wd(crc, input, ilen, chunk_sz); crc = htonl(crc); memcpy(output, &crc, sizeof(crc));
You can actually remove the "if (*output)" because output has always to be a non-null pointer, as we're going to store the result there.
Which means that you cannot use this to implicitly initialize crc =0, whichin turn means you MUST add porper initialization to all callers of that function.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Die Freiheit des Menschen liegt nicht darin, dass er tun kann, was er
will, sondern darin, dass er nicht tun muss, was er nicht will.
-- Jean-Jacques Rousseau