diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-01-07 10:09:01 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-01-07 10:09:01 +0000 |
commit | 0192b598bad714bc39a610e6f6c16caebba30c00 (patch) | |
tree | a56898ef0d454cb07efc51385736848bfadcb075 /lib | |
parent | a86fe0c29de3166e2c8da4d6d44f99ed9be7e9d3 (diff) |
DOH! Fixing big endian broke little..
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/md/md4c.c | 9 | ||||
-rw-r--r-- | lib/libc/md/md5c.c | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/lib/libc/md/md4c.c b/lib/libc/md/md4c.c index 65dee105993..f182d518649 100644 --- a/lib/libc/md/md4c.c +++ b/lib/libc/md/md4c.c @@ -22,7 +22,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: md4c.c,v 1.7 1997/01/06 00:18:22 niklas Exp $"; +static char rcsid[] = "$OpenBSD: md4c.c,v 1.8 1997/01/07 10:09:00 niklas Exp $"; #endif /* LIBC_SCCS and not lint */ #include <string.h> @@ -189,10 +189,13 @@ MD4_CTX *context; /* context */ { unsigned char bits[8]; unsigned int index, padLen; + u_int32_t hi, lo; /* Save number of bits */ - Encode (bits, ((void *)&context->count) + 4, 4); - Encode (bits + 4, &context->count, 4); + hi = context->count >> 32; + lo = context->count & 0xffffffff; + Encode (bits, &lo, 4); + Encode (bits + 4, &hi, 4); /* Pad out to 56 mod 64. */ diff --git a/lib/libc/md/md5c.c b/lib/libc/md/md5c.c index 92d1228a111..f8ec90d6a55 100644 --- a/lib/libc/md/md5c.c +++ b/lib/libc/md/md5c.c @@ -23,7 +23,7 @@ documentation and/or software. */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: md5c.c,v 1.7 1997/01/06 00:18:23 niklas Exp $"; +static char rcsid[] = "$OpenBSD: md5c.c,v 1.8 1997/01/07 10:09:00 niklas Exp $"; #endif /* LIBC_SCCS and not lint */ #include <string.h> @@ -201,10 +201,13 @@ MD5_CTX *context; /* context */ unsigned char bits[8]; unsigned int index; size_t padLen; + u_int32_t hi, lo; /* Save number of bits */ - Encode (bits, ((void *)&context->count) + 4, 4); - Encode (bits + 4, &context->count, 4); + hi = context->count >> 32; + lo = context->count & 0xffffffff; + Encode (bits, &lo, 4); + Encode (bits + 4, &hi, 4); /* Pad out to 56 mod 64. */ index = (unsigned int)((context->count >> 3) & 0x3f); |