public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@qca.qualcomm.com>
To: <linux-kernel@vger.kernel.org>
Cc: <ath10k@lists.infradead.org>, <linux-wireless@vger.kernel.org>
Subject: Re: Matching crc32 checksums from kernel and user space
Date: Mon, 16 Nov 2015 17:27:21 +0200	[thread overview]
Message-ID: <87egfq0xt2.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <87lh9y1520.fsf@kamboji.qca.qualcomm.com> (Kalle Valo's message of "Mon, 16 Nov 2015 14:50:47 +0200")

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

      reply	other threads:[~2015-11-16 15:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16 12:50 Matching crc32 checksums from kernel and user space Kalle Valo
2015-11-16 15:27 ` Kalle Valo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87egfq0xt2.fsf@kamboji.qca.qualcomm.com \
    --to=kvalo@qca.qualcomm.com \
    --cc=ath10k@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox