summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/des/fcrypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/des/fcrypt.c')
-rw-r--r--src/lib/libcrypto/des/fcrypt.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/lib/libcrypto/des/fcrypt.c b/src/lib/libcrypto/des/fcrypt.c
index ccbdff250f..d02189b290 100644
--- a/src/lib/libcrypto/des/fcrypt.c
+++ b/src/lib/libcrypto/des/fcrypt.c
@@ -1,13 +1,5 @@
1/* NOCW */ 1/* NOCW */
2#include <stdio.h> 2#include <stdio.h>
3#ifdef _OSD_POSIX
4#ifndef CHARSET_EBCDIC
5#define CHARSET_EBCDIC 1
6#endif
7#endif
8#ifdef CHARSET_EBCDIC
9#include <openssl/ebcdic.h>
10#endif
11 3
12/* This version of crypt has been developed from my MIT compatible 4/* This version of crypt has been developed from my MIT compatible
13 * DES library. 5 * DES library.
@@ -62,37 +54,7 @@ char *DES_crypt(const char *buf, const char *salt)
62 { 54 {
63 static char buff[14]; 55 static char buff[14];
64 56
65#ifndef CHARSET_EBCDIC
66 return(DES_fcrypt(buf,salt,buff)); 57 return(DES_fcrypt(buf,salt,buff));
67#else
68 char e_salt[2+1];
69 char e_buf[32+1]; /* replace 32 by 8 ? */
70 char *ret;
71
72 /* Copy at most 2 chars of salt */
73 if ((e_salt[0] = salt[0]) != '\0')
74 e_salt[1] = salt[1];
75
76 /* Copy at most 32 chars of password */
77 strncpy (e_buf, buf, sizeof(e_buf));
78
79 /* Make sure we have a delimiter */
80 e_salt[sizeof(e_salt)-1] = e_buf[sizeof(e_buf)-1] = '\0';
81
82 /* Convert the e_salt to ASCII, as that's what DES_fcrypt works on */
83 ebcdic2ascii(e_salt, e_salt, sizeof e_salt);
84
85 /* Convert the cleartext password to ASCII */
86 ebcdic2ascii(e_buf, e_buf, sizeof e_buf);
87
88 /* Encrypt it (from/to ASCII) */
89 ret = DES_fcrypt(e_buf,e_salt,buff);
90
91 /* Convert the result back to EBCDIC */
92 ascii2ebcdic(ret, ret, strlen(ret));
93
94 return ret;
95#endif
96 } 58 }
97 59
98 60
@@ -115,18 +77,10 @@ char *DES_fcrypt(const char *buf, const char *salt, char *ret)
115 * crypt to "*". This was found when replacing the crypt in 77 * crypt to "*". This was found when replacing the crypt in
116 * our shared libraries. People found that the disabled 78 * our shared libraries. People found that the disabled
117 * accounts effectively had no passwd :-(. */ 79 * accounts effectively had no passwd :-(. */
118#ifndef CHARSET_EBCDIC
119 x=ret[0]=((salt[0] == '\0')?'A':salt[0]); 80 x=ret[0]=((salt[0] == '\0')?'A':salt[0]);
120 Eswap0=con_salt[x]<<2; 81 Eswap0=con_salt[x]<<2;
121 x=ret[1]=((salt[1] == '\0')?'A':salt[1]); 82 x=ret[1]=((salt[1] == '\0')?'A':salt[1]);
122 Eswap1=con_salt[x]<<6; 83 Eswap1=con_salt[x]<<6;
123#else
124 x=ret[0]=((salt[0] == '\0')?os_toascii['A']:salt[0]);
125 Eswap0=con_salt[x]<<2;
126 x=ret[1]=((salt[1] == '\0')?os_toascii['A']:salt[1]);
127 Eswap1=con_salt[x]<<6;
128#endif
129
130/* EAY 84/* EAY
131r=strlen(buf); 85r=strlen(buf);
132r=(r+7)/8; 86r=(r+7)/8;