Skip to content

Commit dd41b28

Browse files
ebiggersherbertx
authored andcommitted
crypto: mips/crc32 - fix the CRC32C implementation
Commit ca459e5 ("crypto: mips/crc32 - Clean up useless assignment operations") changed crc32c_mips_le_hw() to use the instructions that use the "regular" CRC32 polynomial instead of the Castagnoli polynomial. Therefore it can't be computing CRC32C values correctly anymore. I haven't been successful in running a MIPS kernel in QEMU, but based on code review this is the fix that is needed. Fixes: ca459e5 ("crypto: mips/crc32 - Clean up useless assignment operations") Cc: Guan Wentao <[email protected]> Cc: WangYuli <[email protected]> Signed-off-by: Eric Biggers <[email protected]> Acked-by: Wentao Guan <[email protected]> Acked-by: WangYuli <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent cd84339 commit dd41b28

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/mips/crypto/crc32-mips.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,20 @@ static u32 crc32c_mips_le_hw(u32 crc_, const u8 *p, unsigned int len)
123123
for (; len >= sizeof(u64); p += sizeof(u64), len -= sizeof(u64)) {
124124
u64 value = get_unaligned_le64(p);
125125

126-
CRC32(crc, value, d);
126+
CRC32C(crc, value, d);
127127
}
128128

129129
if (len & sizeof(u32)) {
130130
u32 value = get_unaligned_le32(p);
131131

132-
CRC32(crc, value, w);
132+
CRC32C(crc, value, w);
133133
p += sizeof(u32);
134134
}
135135
} else {
136136
for (; len >= sizeof(u32); len -= sizeof(u32)) {
137137
u32 value = get_unaligned_le32(p);
138138

139-
CRC32(crc, value, w);
139+
CRC32C(crc, value, w);
140140
p += sizeof(u32);
141141
}
142142
}

0 commit comments

Comments
 (0)