diff options
author | Roland McGrath <roland@gnu.org> | 2002-09-17 10:58:17 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-09-17 10:58:17 +0000 |
commit | e436294bb21b76e7eb13374da1c77525104e2503 (patch) | |
tree | 8d12df7104feeb3ceeeaa90151b9ae8ca48ab27b /sunrpc/xcrypt.c | |
parent | 39d003fb0e5a097ffcb7636ea6eebd012f251f3d (diff) | |
download | glibc-e436294bb21b76e7eb13374da1c77525104e2503.tar.gz glibc-e436294bb21b76e7eb13374da1c77525104e2503.tar.xz glibc-e436294bb21b76e7eb13374da1c77525104e2503.zip |
* 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 <bruno@clisp.org> * 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.
Diffstat (limited to 'sunrpc/xcrypt.c')
-rw-r--r-- | sunrpc/xcrypt.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/sunrpc/xcrypt.c b/sunrpc/xcrypt.c index a6b2499708..9f8c142649 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 |