lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 22 Sep 2008 19:58:26 +0400
From:	Nickolay Vinogradov <nickolay@...tei.ru>
To:	linux-kernel@...r.kernel.org
Subject: SCTP checksum patch for 2.6.26.5

SCTP checksum calculation fix for BigEndian.
ntohl() doesn't do anything on BigEndian.

diff --git a/Makefile b/Makefile
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index ba75c67..2f0ed64 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -74,5 +74,19 @@ static inline __u32 sctp_update_cksum(__u8 *buffer, 
__u16 length, __u32 crc32)

  static inline __u32 sctp_end_cksum(__u32 crc32)
  {
-       return ntohl(~crc32);
+       __u32 result;
+       __u8 byte0, byte1, byte2, byte3;
+
+       result = ~crc32;
+
+       byte0 = result & 0xff;
+       byte1 = (result>>8) & 0xff;
+       byte2 = (result>>16) & 0xff;
+       byte3 = (result>>24) & 0xff;
+
+       crc32 = ((byte0 << 24) |
+                (byte1 << 16) |
+                (byte2 << 8)  |
+                byte3);
+       return crc32;
  }
diff --git a/net/sctp/output.c b/net/sctp/output.c


-- 
Nickolay Vinogradov
Protei Research and Development Center
St.Petersburg, 194044, Russia
Tel.: +7 812 449 47 27
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ