diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-09 18:19:54 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-09 18:19:54 -0500 |
| commit | cb834e7cc0e8b223386f219c1d1986846c87c55f (patch) | |
| tree | 09d0dcfa4dfe2693266bb712e6ef2bb9e064b69a /lib/libcrc32c.c | |
| parent | 4c31c30302358ce1d253f915a064722db33c2114 (diff) | |
| parent | ef19454bd437b2ba14c9cda1de85debd9f383484 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
[LIB] crc32c: Keep intermediate crc state in cpu order
Diffstat (limited to 'lib/libcrc32c.c')
| -rw-r--r-- | lib/libcrc32c.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/libcrc32c.c b/lib/libcrc32c.c index 802f11f0bf5b..b5c3287d8ea4 100644 --- a/lib/libcrc32c.c +++ b/lib/libcrc32c.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | #include <linux/crc32c.h> | 33 | #include <linux/crc32c.h> |
| 34 | #include <linux/compiler.h> | 34 | #include <linux/compiler.h> |
| 35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
| 36 | #include <asm/byteorder.h> | ||
| 37 | 36 | ||
| 38 | MODULE_AUTHOR("Clay Haapala <chaapala@cisco.com>"); | 37 | MODULE_AUTHOR("Clay Haapala <chaapala@cisco.com>"); |
| 39 | MODULE_DESCRIPTION("CRC32c (Castagnoli) calculations"); | 38 | MODULE_DESCRIPTION("CRC32c (Castagnoli) calculations"); |
| @@ -161,15 +160,13 @@ static const u32 crc32c_table[256] = { | |||
| 161 | */ | 160 | */ |
| 162 | 161 | ||
| 163 | u32 __pure | 162 | u32 __pure |
| 164 | crc32c_le(u32 seed, unsigned char const *data, size_t length) | 163 | crc32c_le(u32 crc, unsigned char const *data, size_t length) |
| 165 | { | 164 | { |
| 166 | u32 crc = __cpu_to_le32(seed); | ||
| 167 | |||
| 168 | while (length--) | 165 | while (length--) |
| 169 | crc = | 166 | crc = |
| 170 | crc32c_table[(crc ^ *data++) & 0xFFL] ^ (crc >> 8); | 167 | crc32c_table[(crc ^ *data++) & 0xFFL] ^ (crc >> 8); |
| 171 | 168 | ||
| 172 | return __le32_to_cpu(crc); | 169 | return crc; |
| 173 | } | 170 | } |
| 174 | 171 | ||
| 175 | #endif /* CRC_LE_BITS == 8 */ | 172 | #endif /* CRC_LE_BITS == 8 */ |
