Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1270278

Re: Matching crc32 checksums from kernel and user space

From Kalle Valo <kvalo@qca.qualcomm.com>
Newsgroups linux.kernel
Subject Re: Matching crc32 checksums from kernel and user space
Date 2015-11-16 16:30 +0100
Message-ID <qvtTb-AH-1@gated-at.bofh.it> (permalink)
References <qvry3-7qr-45@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Kalle Valo <kvalo@qca.qualcomm.com> writes:

> Hi,
>
> I want ath10k to print a checksum for the firmware image and include
> that to the firmware crash dump file as well. Then I want to print the
> same checksum from user space scripts and verify it with the crash dump
> file.
>
> I thought that crc32 would be good enough for me but it wasn't that
> simple as I can't seem to getting matching checksums, at least not with
> the user space tools I found. For a test case I created a simple file:
>
> $ xxd /lib/firmware/ath10k/crc-test.bin 
> 00000000: 3132 3334 3536 3738 3930 0a              1234567890.
>
> In kernel I get these checksums:
>
> [  574.867724] crc32_le(0) 8916bc26
> [  574.867739] crc32_le(~0) 1d6ef235
> [  574.867743] crc32_be(0) b9346a4c
> [  574.867746] crc32_be(~0) 71467465
>
> And from python I got (value in parenthesis is the seed I used):
>
> binascii.crc32(00000000) 0xe2910dcaL
> binascii.crc32(ffffffff) 0x76e943d9L

Johannes Berg pointed out that this looks to be a sign issue, I just
need to invert the python value and then I get the same value:

>>> hex(~0x76e943d9 & 0xffffffff)
'0x8916bc26'

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Matching crc32 checksums from kernel and user space Kalle Valo <kvalo@qca.qualcomm.com> - 2015-11-16 14:00 +0100
  Re: Matching crc32 checksums from kernel and user space Kalle Valo <kvalo@qca.qualcomm.com> - 2015-11-16 16:30 +0100

csiph-web