about summary refs log tree commit diff
path: root/sunrpc/xcrypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'sunrpc/xcrypt.c')
-rw-r--r--sunrpc/xcrypt.c46
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