From: Benny Halevy <bhalevy@panasas.com>
To: open-iscsi@googlegroups.com, linux-crypto@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Clay Haapala <chaapala@cisco.com>
Cc: fujita.tomonori@lab.ntt.co.jp, michaelc@cs.wisc.edu,
djiang@mvista.com, Herbert Xu <herbert@gondor.apana.org.au>
Subject: [PATCH] libcrc32c: keep intermediate crc state in cpu order
Date: Thu, 08 Nov 2007 10:20:34 +0200 [thread overview]
Message-ID: <4732C6D2.5000904@panasas.com> (raw)
In-Reply-To: <4731FD41.1090704@panasas.com>
crypto/crc32.c:chksum_final() is computing the digest as
*(__le32 *)out = ~cpu_to_le32(mctx->crc);
so the low-level crc32c_le routines should just keep
the crc in cpu order, otherwise it is getting swabbed
one too many times on big-endian machines.
Signed-off-by: Benny Halevy <bhalevy@fs1.bhalevy.com>
---
lib/libcrc32c.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/lib/libcrc32c.c b/lib/libcrc32c.c
index 802f11f..b5c3287 100644
--- a/lib/libcrc32c.c
+++ b/lib/libcrc32c.c
@@ -33,7 +33,6 @@
#include <linux/crc32c.h>
#include <linux/compiler.h>
#include <linux/module.h>
-#include <asm/byteorder.h>
MODULE_AUTHOR("Clay Haapala <chaapala@cisco.com>");
MODULE_DESCRIPTION("CRC32c (Castagnoli) calculations");
@@ -161,15 +160,13 @@ static const u32 crc32c_table[256] = {
*/
u32 __pure
-crc32c_le(u32 seed, unsigned char const *data, size_t length)
+crc32c_le(u32 crc, unsigned char const *data, size_t length)
{
- u32 crc = __cpu_to_le32(seed);
-
while (length--)
crc =
crc32c_table[(crc ^ *data++) & 0xFFL] ^ (crc >> 8);
- return __le32_to_cpu(crc);
+ return crc;
}
#endif /* CRC_LE_BITS == 8 */
--
1.5.3.3
next parent reply other threads:[~2007-11-08 8:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <473186E9.5080300@panasas.com>
[not found] ` <4731A5C5.3030109@panasas.com>
[not found] ` <4731D387.5090901@panasas.com>
[not found] ` <20071108001400O.tomof@acm.org>
[not found] ` <4731DA0C.5090702@panasas.com>
[not found] ` <4731FD41.1090704@panasas.com>
2007-11-08 8:20 ` Benny Halevy [this message]
2007-11-08 13:37 ` [PATCH] libcrc32c: keep intermediate crc state in cpu order Herbert Xu
2007-11-08 18:41 ` Dave Jiang
2007-11-08 19:29 ` Benny Halevy
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=4732C6D2.5000904@panasas.com \
--to=bhalevy@panasas.com \
--cc=chaapala@cisco.com \
--cc=davem@davemloft.net \
--cc=djiang@mvista.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
--cc=open-iscsi@googlegroups.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.