summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_crc32.c
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2008-10-18 15:53:31 +0000
committerrrs <rrs@FreeBSD.org>2008-10-18 15:53:31 +0000
commitca009db18e03d6c424a4846538aecd2d2cee0f5f (patch)
tree819d6063a0b66e73cad343c333a882922ec5cc97 /sys/netinet/sctp_crc32.c
parent98d25e143a9d572dd84d0a55fb33c753fd6e80a8 (diff)
downloadFreeBSD-src-ca009db18e03d6c424a4846538aecd2d2cee0f5f.zip
FreeBSD-src-ca009db18e03d6c424a4846538aecd2d2cee0f5f.tar.gz
Reported by Yehuda Weinraub (yehudasa@gamil.com) - CRC32C algorithm
uses incorrect init_bytes value. It SHOULD have the number of bytes to get to a 4 byte boundary. PR: 128134 MFC after: 4 weeks
Diffstat (limited to 'sys/netinet/sctp_crc32.c')
-rw-r--r--sys/netinet/sctp_crc32.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/sctp_crc32.c b/sys/netinet/sctp_crc32.c
index f3d1dc0..7f0e742 100644
--- a/sys/netinet/sctp_crc32.c
+++ b/sys/netinet/sctp_crc32.c
@@ -583,13 +583,13 @@ update_crc32(uint32_t crc32c,
unsigned char *buffer,
unsigned int length)
{
- uint32_t offset;
+ uint32_t to_even_word;
if (length == 0) {
return (crc32c);
}
- offset = ((uintptr_t) buffer) & 0x3;
- return (sctp_crc32c_sb8_64_bit(crc32c, buffer, length, offset));
+ to_even_word = (4 - (((uintptr_t) buffer) & 0x3));
+ return (sctp_crc32c_sb8_64_bit(crc32c, buffer, length, to_even_word));
}
uint32_t sctp_crc_c[256] = {
OpenPOWER on IntegriCloud