CVS commit: [netbsd-5] src/sys/lib/libkern
Module Name:src Committed By: snj Date: Wed Jan 20 05:29:25 UTC 2010 Modified Files: src/sys/lib/libkern [netbsd-5]: arc4random.c Log Message: Pull up following revision(s) (requested by joerg in ticket #1253): sys/lib/libkern/arc4random.c: revision 1.21 Keep arc4_i and arc4_j synchronised after a rekeying. This prevents accidentally ending up in a short ARC4 cycle. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.20.10.1 src/sys/lib/libkern/arc4random.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libkern/arc4random.c diff -u src/sys/lib/libkern/arc4random.c:1.20 src/sys/lib/libkern/arc4random.c:1.20.10.1 --- src/sys/lib/libkern/arc4random.c:1.20 Mon Apr 28 20:24:06 2008 +++ src/sys/lib/libkern/arc4random.c Wed Jan 20 05:29:25 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: arc4random.c,v 1.20 2008/04/28 20:24:06 martin Exp $ */ +/* $NetBSD: arc4random.c,v 1.20.10.1 2010/01/20 05:29:25 snj Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -136,6 +136,7 @@ arc4_j = (arc4_j + arc4_sbox[n] + key[n]) % 256; arc4_swap(&arc4_sbox[n], &arc4_sbox[arc4_j]); } + arc4_i = arc4_j; /* Reset for next reseed cycle. */ arc4_nextreseed = time_uptime + ARC4_RESEED_SECONDS;
CVS commit: [netbsd-5] src/sys/lib/libkern
Module Name:src Committed By: snj Date: Sun May 3 22:25:25 UTC 2009 Modified Files: src/sys/lib/libkern [netbsd-5]: crc32.c Log Message: Pull up following revision(s) (requested by tls in ticket #611): sys/lib/libkern/crc32.c: revision 1.4 Make the function declaration the same for the big-endian case as for the little-endian case, and consistent with the libkern.h declaration. Fixes build problem for at least hp700 and evbbarm-eb. To generate a diff of this commit: cvs rdiff -u -r1.4.4.4 -r1.4.4.5 src/sys/lib/libkern/crc32.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libkern/crc32.c diff -u src/sys/lib/libkern/crc32.c:1.4.4.4 src/sys/lib/libkern/crc32.c:1.4.4.5 --- src/sys/lib/libkern/crc32.c:1.4.4.4 Sun May 3 17:33:17 2009 +++ src/sys/lib/libkern/crc32.c Sun May 3 22:25:25 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: crc32.c,v 1.4.4.4 2009/05/03 17:33:17 snj Exp $ */ +/* $NetBSD: crc32.c,v 1.4.4.5 2009/05/03 22:25:25 snj Exp $ */ /* crc32.c -- compute the CRC-32 of a data stream * @@ -80,10 +80,7 @@ #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 /* = */ -uint32_t crc32( -uint32_t crc, -const unsigned char *buf, -unsigned len) +uint32_t crc32(uint32_t crc, const uint8_t *buf, size_t len) { register u4 c; register const u4 *buf4;
CVS commit: [netbsd-5] src/sys/lib/libkern
Module Name:src Committed By: snj Date: Sun May 3 17:33:17 UTC 2009 Modified Files: src/sys/lib/libkern [netbsd-5]: crc32.c Log Message: Pull up following revision(s) (requested by tls in ticket #611): sys/lib/libkern/crc32.c: revision 1.3 Fix compilation error on 64-bit platforms. To generate a diff of this commit: cvs rdiff -u -r1.4.4.3 -r1.4.4.4 src/sys/lib/libkern/crc32.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libkern/crc32.c diff -u src/sys/lib/libkern/crc32.c:1.4.4.3 src/sys/lib/libkern/crc32.c:1.4.4.4 --- src/sys/lib/libkern/crc32.c:1.4.4.3 Sun May 3 17:31:42 2009 +++ src/sys/lib/libkern/crc32.c Sun May 3 17:33:17 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: crc32.c,v 1.4.4.3 2009/05/03 17:31:42 snj Exp $ */ +/* $NetBSD: crc32.c,v 1.4.4.4 2009/05/03 17:33:17 snj Exp $ */ /* crc32.c -- compute the CRC-32 of a data stream * @@ -19,8 +19,6 @@ #include #include -#define z_ptrdiff_t int32_t - typedef uint32_t u4; /* Definitions for doing the crc four data bytes at a time. */ @@ -50,7 +48,7 @@ c = (u4)crc; c = ~c; -while (len && ((z_ptrdiff_t)buf & 3)) { +while (len && ((uintptr_t)buf & 3)) { c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); len--; } @@ -94,7 +92,7 @@ c = REV((u4)crc); c = ~c; -while (len && ((z_ptrdiff_t)buf & 3)) { +while (len && ((uintptr_t)buf & 3)) { c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); len--; }