summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrypt/crypt.c10
-rw-r--r--libcrypt/des.c5
-rw-r--r--libcrypt/libcrypt.h20
-rw-r--r--libcrypt/md5.c14
4 files changed, 29 insertions, 20 deletions
diff --git a/libcrypt/crypt.c b/libcrypt/crypt.c
index 5d8215fac..8b361d393 100644
--- a/libcrypt/crypt.c
+++ b/libcrypt/crypt.c
@@ -8,16 +8,14 @@
#define __FORCE_GLIBC
#include <crypt.h>
#include <unistd.h>
+#include "libcrypt.h"
-extern char * __md5_crypt( const char *pw, const char *salt) attribute_hidden;
-extern char * __des_crypt( const char *pw, const char *salt) attribute_hidden;
-
-char * crypt(const char *key, const char *salt)
+char *crypt(const char *key, const char *salt)
{
/* First, check if we are supposed to be using the MD5 replacement
* instead of DES... */
if (salt[0]=='$' && salt[1]=='1' && salt[2]=='$')
- return __md5_crypt(key, salt);
+ return __md5_crypt((unsigned char*)key, (unsigned char*)salt);
else
- return __des_crypt(key, salt);
+ return __des_crypt((unsigned char*)key, (unsigned char*)salt);
}
diff --git a/libcrypt/des.c b/libcrypt/des.c
index 3f6b382bb..db2e22cb9 100644
--- a/libcrypt/des.c
+++ b/libcrypt/des.c
@@ -64,6 +64,7 @@
#include <pwd.h>
#include <string.h>
#include <crypt.h>
+#include "libcrypt.h"
/* Re-entrantify me -- all this junk needs to be in
* struct crypt_data to make this really reentrant... */
@@ -638,9 +639,7 @@ encrypt(char *block, int flag)
block[(i << 5) | j] = (io[i] & bits32[j]) ? 1 : 0;
}
-char *__des_crypt(const char *key, const char *setting) attribute_hidden;
-char *
-__des_crypt(const char *key, const char *setting)
+char *__des_crypt(const unsigned char *key, const unsigned char *setting)
{
u_int32_t count, salt, l, r0, r1, keybuf[2];
u_char *p, *q;
diff --git a/libcrypt/libcrypt.h b/libcrypt/libcrypt.h
new file mode 100644
index 000000000..11866200c
--- /dev/null
+++ b/libcrypt/libcrypt.h
@@ -0,0 +1,20 @@
+/* prototypes for internal crypt functions
+ *
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef __LIBCRYPT_H__
+#define __LIBCRYPT_H__
+
+extern char *__md5_crypt(const unsigned char *pw, const unsigned char *salt) attribute_hidden;
+extern char *__des_crypt(const unsigned char *pw, const unsigned char *salt) attribute_hidden;
+
+/* shut up gcc-4.x signed warnings */
+#define strcpy(dst,src) strcpy((char*)dst,(char*)src)
+#define strlen(s) strlen((char*)s)
+#define strncat(dst,src,n) strncat((char*)dst,(char*)src,n)
+#define strncmp(s1,s2,n) strncmp((char*)s1,(char*)s2,n)
+
+#endif
diff --git a/libcrypt/md5.c b/libcrypt/md5.c
index 412c8bfb5..841ed8342 100644
--- a/libcrypt/md5.c
+++ b/libcrypt/md5.c
@@ -79,7 +79,8 @@
#include <stdio.h>
#include <crypt.h>
#include <sys/cdefs.h>
-
+#include "libcrypt.h"
+
/* MD5 context. */
struct MD5Context {
u_int32_t state[4]; /* state (ABCD) */
@@ -100,14 +101,6 @@ static const unsigned char __md5_itoa64[] = /* 0 ... 63 => ascii - 64 */
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-/* shut up gcc-4.x signed warnings */
-#define strcpy(dst,src) strcpy((char*)dst,(char*)src)
-#define strlen(s) strlen((char*)s)
-#define strncat(dst,src,n) strncat((char*)dst,(char*)src,n)
-#define strncmp(s1,s2,n) strncmp((char*)s1,(char*)s2,n)
-
-
-
#ifdef i386
#define __md5_Encode memcpy
#define __md5_Decode memcpy
@@ -538,8 +531,7 @@ static void __md5_to64( char *s, unsigned long v, int n)
* Use MD5 for what it is best at...
*/
-char * __md5_crypt( const unsigned char *pw, const unsigned char *salt) attribute_hidden;
-char * __md5_crypt( const unsigned char *pw, const unsigned char *salt)
+char *__md5_crypt(const unsigned char *pw, const unsigned char *salt)
{
/* Static stuff */
static const unsigned char *sp, *ep;