sync with libc

This commit is contained in:
drochner 1999-09-10 13:21:14 +00:00
parent 24ca0bcfa6
commit 7148323ba0
4 changed files with 40 additions and 34 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ashrdi3.c,v 1.6 1998/03/27 01:29:59 cgd Exp $ */
/* $NetBSD: ashrdi3.c,v 1.7 1999/09/10 13:21:15 drochner Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)ashrdi3.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: ashrdi3.c,v 1.6 1998/03/27 01:29:59 cgd Exp $");
__RCSID("$NetBSD: ashrdi3.c,v 1.7 1999/09/10 13:21:15 drochner Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -71,12 +71,15 @@ __ashrdi3(a, shift)
* LONG_BITS is undefined, so we shift (LONG_BITS-1),
* then 1 more, to get our answer.
*/
/* LINTED inherits machine dependency */
s = (aa.sl[H] >> (LONG_BITS - 1)) >> 1;
/* LINTED inherits machine dependency*/
aa.ul[L] = aa.sl[H] >> (shift - LONG_BITS);
aa.ul[H] = s;
} else {
aa.ul[L] = (aa.ul[L] >> shift) |
(aa.ul[H] << (LONG_BITS - shift));
/* LINTED inherits machine dependency */
aa.sl[H] >>= shift;
}
return (aa.q);

View File

@ -1,4 +1,4 @@
/* $NetBSD: md5c.c,v 1.5 1999/02/04 15:26:42 fvdl Exp $ */
/* $NetBSD: md5c.c,v 1.6 1999/09/10 13:21:14 drochner Exp $ */
/*
* This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
@ -75,7 +75,7 @@ typedef u_int32_t UINT4;
#define S43 15
#define S44 21
#if !defined(_KERNEL) && defined(__weak_alias)
#if !defined(_KERNEL) && !defined(_STANDALONE) && defined(__weak_alias)
__weak_alias(MD5Init,_MD5Init);
__weak_alias(MD5Update,_MD5Update);
__weak_alias(MD5Final,_MD5Final);
@ -213,6 +213,7 @@ MD5Update(context, input, inputLen)
/* Transform as many times as possible. */
if (inputLen >= partLen) {
/* LINTED const castaway ok */
memcpy((POINTER)&context->buffer[idx],
(POINTER)input, partLen);
MD5Transform(context->state, context->buffer);
@ -225,6 +226,7 @@ MD5Update(context, input, inputLen)
i = 0;
/* Buffer remaining input */
/* LINTED const castaway ok */
memcpy((POINTER)&context->buffer[idx], (POINTER)&input[i],
inputLen - i);
}
@ -256,7 +258,7 @@ MD5Final(digest, context)
Encode(digest, context->state, 16);
/* Zeroize sensitive information. */
ZEROIZE((POINTER)context, sizeof(*context));
ZEROIZE((POINTER)(void *)context, sizeof(*context));
}
/*
@ -349,5 +351,5 @@ MD5Transform(state, block)
state[3] += d;
/* Zeroize sensitive information. */
ZEROIZE((POINTER)x, sizeof (x));
ZEROIZE((POINTER)(void *)x, sizeof (x));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: qdivrem.c,v 1.6 1998/03/27 01:30:07 cgd Exp $ */
/* $NetBSD: qdivrem.c,v 1.7 1999/09/10 13:21:14 drochner Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)qdivrem.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: qdivrem.c,v 1.6 1998/03/27 01:30:07 cgd Exp $");
__RCSID("$NetBSD: qdivrem.c,v 1.7 1999/09/10 13:21:14 drochner Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -122,15 +122,15 @@ __qdivrem(uq, vq, arq)
*/
tmp.uq = uq;
u[0] = 0;
u[1] = HHALF(tmp.ul[H]);
u[2] = LHALF(tmp.ul[H]);
u[3] = HHALF(tmp.ul[L]);
u[4] = LHALF(tmp.ul[L]);
u[1] = (digit)HHALF(tmp.ul[H]);
u[2] = (digit)LHALF(tmp.ul[H]);
u[3] = (digit)HHALF(tmp.ul[L]);
u[4] = (digit)LHALF(tmp.ul[L]);
tmp.uq = vq;
v[1] = HHALF(tmp.ul[H]);
v[2] = LHALF(tmp.ul[H]);
v[3] = HHALF(tmp.ul[L]);
v[4] = LHALF(tmp.ul[L]);
v[1] = (digit)HHALF(tmp.ul[H]);
v[2] = (digit)LHALF(tmp.ul[H]);
v[3] = (digit)HHALF(tmp.ul[L]);
v[4] = (digit)LHALF(tmp.ul[L]);
for (n = 4; v[1] == 0; v++) {
if (--n == 1) {
u_long rbj; /* r*B+u[j] (not root boy jim) */
@ -145,13 +145,13 @@ __qdivrem(uq, vq, arq)
* We unroll this completely here.
*/
t = v[2]; /* nonzero, by definition */
q1 = u[1] / t;
q1 = (digit)(u[1] / t);
rbj = COMBINE(u[1] % t, u[2]);
q2 = rbj / t;
q2 = (digit)(rbj / t);
rbj = COMBINE(rbj % t, u[3]);
q3 = rbj / t;
q3 = (digit)(rbj / t);
rbj = COMBINE(rbj % t, u[4]);
q4 = rbj / t;
q4 = (digit)(rbj / t);
if (arq)
*arq = rbj % t;
tmp.ul[H] = COMBINE(q1, q2);
@ -209,9 +209,9 @@ __qdivrem(uq, vq, arq)
rhat = uj1;
goto qhat_too_big;
} else {
u_long n = COMBINE(uj0, uj1);
qhat = n / v1;
rhat = n % v1;
u_long nn = COMBINE(uj0, uj1);
qhat = nn / v1;
rhat = nn % v1;
}
while (v2 * qhat > COMBINE(rhat, uj2)) {
qhat_too_big:
@ -227,11 +227,11 @@ __qdivrem(uq, vq, arq)
*/
for (t = 0, i = n; i > 0; i--) {
t = u[i + j] - v[i] * qhat - t;
u[i + j] = LHALF(t);
u[i + j] = (digit)LHALF(t);
t = (B - HHALF(t)) & (B - 1);
}
t = u[j] - t;
u[j] = LHALF(t);
u[j] = (digit)LHALF(t);
/*
* D5: test remainder.
* There is a borrow if and only if HHALF(t) is nonzero;
@ -242,12 +242,12 @@ __qdivrem(uq, vq, arq)
qhat--;
for (t = 0, i = n; i > 0; i--) { /* D6: add back. */
t += u[i + j] + v[i];
u[i + j] = LHALF(t);
u[i + j] = (digit)LHALF(t);
t = HHALF(t);
}
u[j] = LHALF(u[j] + t);
u[j] = (digit)LHALF(u[j] + t);
}
q[j] = qhat;
q[j] = (digit)qhat;
} while (++j <= m); /* D7: loop on j. */
/*
@ -258,8 +258,8 @@ __qdivrem(uq, vq, arq)
if (arq) {
if (d) {
for (i = m + n; i > m; --i)
u[i] = (u[i] >> d) |
LHALF(u[i - 1] << (HALF_BITS - d));
u[i] = ((u_long)u[i] >> d) |
LHALF((u_long)u[i - 1] << (HALF_BITS - d));
u[i] = 0;
}
tmp.ul[H] = COMBINE(uspace[1], uspace[2]);
@ -283,6 +283,7 @@ shl(digit *p, int len, int sh)
int i;
for (i = 0; i < len; i++)
p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh));
p[i] = LHALF(p[i] << sh);
p[i] = LHALF((u_long)p[i] << sh) |
(p[i + 1] >> (HALF_BITS - sh));
p[i] = (digit)LHALF(p[i] << sh);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: quad.h,v 1.11 1998/08/30 15:32:20 eeh Exp $ */
/* $NetBSD: quad.h,v 1.12 1999/09/10 13:21:14 drochner Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -107,7 +107,7 @@ union uu {
* as u_quad_t, while gcc 2 correctly uses int. Unfortunately, we still use
* both compilers.
*/
#if __GNUC__ >= 2
#if (__GNUC__ >= 2) || defined(lint)
typedef unsigned int qshift_t;
#else
typedef u_quad_t qshift_t;