From e436294bb21b76e7eb13374da1c77525104e2503 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 17 Sep 2002 10:58:17 +0000 Subject: * sunrpc/xcrypt.c (passwd2des_internal): Renamed fom passwd2des. (passwd2des): Define it as an alias. (xencrypt, xdecrypt): Call passwd2des_internal instead of passwd2des. 2002-09-12 Bruno Haible * include/sys/sysctl.h (__sysctl): Add libc_hidden_proto. * sysdeps/unix/sysv/linux/sysctl.c (__sysctl): Add libc_hidden_def. * include/rpc/xdr.h (xdrstdio_create): Add libc_hidden_proto. * sunrpc/xdr_stdio.c (xdrstdio_create): Add libc_hidden_def. --- sunrpc/xcrypt.c | 46 ++++++++++++++++++++++++++++------------------ sunrpc/xdr_stdio.c | 2 ++ 2 files changed, 30 insertions(+), 18 deletions(-) (limited to 'sunrpc') diff --git a/sunrpc/xcrypt.c b/sunrpc/xcrypt.c index a6b2499..9f8c142 100644 --- a/sunrpc/xcrypt.c +++ b/sunrpc/xcrypt.c @@ -69,7 +69,32 @@ static char hexval (char) internal_function; static void hex2bin (int, char *, char *) internal_function; static void bin2hex (int, unsigned char *, char *) internal_function; -void passwd2des (char *pw, char *key); +static void passwd2des_internal (char *pw, char *key); + + +/* + * Turn password into DES key + */ +static void +passwd2des_internal (char *pw, char *key) +{ + int i; + + memset (key, 0, 8); + for (i = 0; *pw && i < 8; ++i) + key[i] ^= *pw++ << 1; + + des_setparity (key); +} + +#ifdef _LIBC +strong_alias (passwd2des_internal, passwd2des) +#else +void passwd2des (char *pw, char *key) +{ + return passwd2des_internal (pw, key); +} +#endif /* * Encrypt a secret key given passwd @@ -88,7 +113,7 @@ xencrypt (char *secret, char *passwd) len = strlen (secret) / 2; buf = malloc ((unsigned) len); hex2bin (len, secret, buf); - passwd2des (passwd, key); + passwd2des_internal (passwd, key); memset (ivec, 0, 8); err = cbc_crypt (key, buf, len, DES_ENCRYPT | DES_HW, ivec); @@ -120,7 +145,7 @@ xdecrypt (char *secret, char *passwd) buf = malloc ((unsigned) len); hex2bin (len, secret, buf); - passwd2des (passwd, key); + passwd2des_internal (passwd, key); memset (ivec, 0, 8); err = cbc_crypt (key, buf, len, DES_DECRYPT | DES_HW, ivec); @@ -135,21 +160,6 @@ xdecrypt (char *secret, char *passwd) } /* - * Turn password into DES key - */ -void -passwd2des (char *pw, char *key) -{ - int i; - - memset (key, 0, 8); - for (i = 0; *pw && i < 8; ++i) - key[i] ^= *pw++ << 1; - - des_setparity (key); -} - -/* * Hex to binary conversion */ static void diff --git a/sunrpc/xdr_stdio.c b/sunrpc/xdr_stdio.c index 8a76b75..264ab3b 100644 --- a/sunrpc/xdr_stdio.c +++ b/sunrpc/xdr_stdio.c @@ -192,3 +192,5 @@ xdrstdio_putint32 (XDR *xdrs, const int32_t *ip) return FALSE; return TRUE; } + +libc_hidden_def (xdrstdio_create) -- cgit v1.1