From: niklas Date: Tue, 7 Jan 1997 10:09:00 +0000 (+0000) Subject: DOH! Fixing big endian broke little.. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=71c0a3d3831948b183335319721306b95af7abf1;p=openbsd DOH! Fixing big endian broke little.. --- 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 @@ -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 @@ -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);