summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbeck <>2014-04-15 17:46:17 +0000
committerbeck <>2014-04-15 17:46:17 +0000
commitc9414ed70ec89926c1041a64ee4b2f3ef36c90f6 (patch)
treec53c25a15cd89988cef641fa18324c5c6db28fed /src
parent0cfe49dc6db41fd2d4f960b618ed41b11ffffc6a (diff)
downloadopenbsd-c9414ed70ec89926c1041a64ee4b2f3ef36c90f6.tar.gz
openbsd-c9414ed70ec89926c1041a64ee4b2f3ef36c90f6.tar.bz2
openbsd-c9414ed70ec89926c1041a64ee4b2f3ef36c90f6.zip
Send the rotIBM stream cipher (ebcdic) to Valhalla to party for eternity
with the bearded ones... some API's that nobody should be using will dissapear with this commit.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/Attic/Makefile6
-rw-r--r--src/lib/libcrypto/asn1/a_gentm.c18
-rw-r--r--src/lib/libcrypto/asn1/a_mbstr.c7
-rw-r--r--src/lib/libcrypto/asn1/a_print.c8
-rw-r--r--src/lib/libcrypto/asn1/a_time.c15
-rw-r--r--src/lib/libcrypto/asn1/a_utctm.c18
-rw-r--r--src/lib/libcrypto/asn1/f_int.c9
-rw-r--r--src/lib/libcrypto/asn1/f_string.c9
-rw-r--r--src/lib/libcrypto/asn1/t_x509.c10
-rw-r--r--src/lib/libcrypto/bf/bftest.c11
-rw-r--r--src/lib/libcrypto/bio/b_dump.c6
-rw-r--r--src/lib/libcrypto/conf/conf_def.h17
-rw-r--r--src/lib/libcrypto/conf/keysets.pl16
-rw-r--r--src/lib/libcrypto/crypto.h4
-rw-r--r--src/lib/libcrypto/crypto/Makefile5
-rw-r--r--src/lib/libcrypto/des/fcrypt.c46
-rw-r--r--src/lib/libcrypto/ebcdic.c221
-rw-r--r--src/lib/libcrypto/ebcdic.h19
-rw-r--r--src/lib/libcrypto/evp/encode.c11
-rw-r--r--src/lib/libcrypto/hmac/hmactest.c11
-rw-r--r--src/lib/libcrypto/md2/md2_one.c16
-rw-r--r--src/lib/libcrypto/md2/md2test.c4
-rw-r--r--src/lib/libcrypto/md4/md4_one.c20
-rw-r--r--src/lib/libcrypto/md5/md5_one.c20
-rw-r--r--src/lib/libcrypto/mdc2/mdc2test.c8
-rw-r--r--src/lib/libcrypto/objects/obj_dat.c16
-rw-r--r--src/lib/libcrypto/pem/pem_lib.c15
-rw-r--r--src/lib/libcrypto/ripemd/rmdtest.c7
-rw-r--r--src/lib/libcrypto/sha/sha1test.c12
-rw-r--r--src/lib/libcrypto/sha/shatest.c12
-rw-r--r--src/lib/libcrypto/x509/x509_obj.c40
-rw-r--r--src/lib/libcrypto/x509v3/v3_ia5.c3
-rw-r--r--src/lib/libcrypto/x509v3/v3_prn.c30
-rw-r--r--src/lib/libcrypto/x509v3/v3_utl.c18
-rw-r--r--src/lib/libssl/src/apps/passwd.c6
-rw-r--r--src/lib/libssl/src/apps/req.c14
-rw-r--r--src/lib/libssl/src/apps/s_client.c6
-rw-r--r--src/lib/libssl/src/apps/s_server.c159
-rw-r--r--src/lib/libssl/src/crypto/Makefile6
-rw-r--r--src/lib/libssl/src/crypto/asn1/a_gentm.c18
-rw-r--r--src/lib/libssl/src/crypto/asn1/a_mbstr.c7
-rw-r--r--src/lib/libssl/src/crypto/asn1/a_print.c8
-rw-r--r--src/lib/libssl/src/crypto/asn1/a_time.c15
-rw-r--r--src/lib/libssl/src/crypto/asn1/a_utctm.c18
-rw-r--r--src/lib/libssl/src/crypto/asn1/f_int.c9
-rw-r--r--src/lib/libssl/src/crypto/asn1/f_string.c9
-rw-r--r--src/lib/libssl/src/crypto/asn1/t_x509.c10
-rw-r--r--src/lib/libssl/src/crypto/bf/bftest.c11
-rw-r--r--src/lib/libssl/src/crypto/bio/b_dump.c6
-rw-r--r--src/lib/libssl/src/crypto/conf/conf_def.h17
-rw-r--r--src/lib/libssl/src/crypto/conf/keysets.pl16
-rw-r--r--src/lib/libssl/src/crypto/crypto.h4
-rw-r--r--src/lib/libssl/src/crypto/des/fcrypt.c46
-rw-r--r--src/lib/libssl/src/crypto/ebcdic.c221
-rw-r--r--src/lib/libssl/src/crypto/ebcdic.h19
-rw-r--r--src/lib/libssl/src/crypto/evp/encode.c11
-rw-r--r--src/lib/libssl/src/crypto/hmac/hmactest.c11
-rw-r--r--src/lib/libssl/src/crypto/md2/md2_one.c16
-rw-r--r--src/lib/libssl/src/crypto/md2/md2test.c4
-rw-r--r--src/lib/libssl/src/crypto/md4/md4_one.c20
-rw-r--r--src/lib/libssl/src/crypto/md5/md5_one.c20
-rw-r--r--src/lib/libssl/src/crypto/mdc2/mdc2test.c8
-rw-r--r--src/lib/libssl/src/crypto/objects/obj_dat.c16
-rw-r--r--src/lib/libssl/src/crypto/pem/pem_lib.c15
-rw-r--r--src/lib/libssl/src/crypto/ripemd/rmdtest.c7
-rw-r--r--src/lib/libssl/src/crypto/sha/sha1test.c12
-rw-r--r--src/lib/libssl/src/crypto/sha/shatest.c12
-rw-r--r--src/lib/libssl/src/crypto/x509/x509_obj.c40
-rw-r--r--src/lib/libssl/src/crypto/x509v3/v3_ia5.c3
-rw-r--r--src/lib/libssl/src/crypto/x509v3/v3_prn.c30
-rw-r--r--src/lib/libssl/src/crypto/x509v3/v3_utl.c18
-rw-r--r--src/lib/libssl/src/ssl/s2_lib.c4
-rw-r--r--src/lib/libssl/src/ssl/s3_enc.c9
-rw-r--r--src/lib/libssl/src/ssl/ssl_ciph.c4
-rw-r--r--src/lib/libssl/src/ssl/tls1.h19
-rw-r--r--src/lib/libssl/ssl_ciph.c4
-rw-r--r--src/lib/libssl/tls1.h19
77 files changed, 9 insertions, 1606 deletions
diff --git a/src/lib/libcrypto/Attic/Makefile b/src/lib/libcrypto/Attic/Makefile
index aa105e37a2..326915d520 100644
--- a/src/lib/libcrypto/Attic/Makefile
+++ b/src/lib/libcrypto/Attic/Makefile
@@ -35,13 +35,13 @@ GENERAL=Makefile README crypto-lib.com install.com
35LIB= $(TOP)/libcrypto.a 35LIB= $(TOP)/libcrypto.a
36SHARED_LIB= libcrypto$(SHLIB_EXT) 36SHARED_LIB= libcrypto$(SHLIB_EXT)
37LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c \ 37LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
38 ebcdic.c uid.c o_time.c o_str.c o_dir.c o_fips.c o_init.c fips_ers.c 38 uid.c o_time.c o_str.c o_dir.c o_fips.c o_init.c fips_ers.c
39LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o ebcdic.o \ 39LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o \
40 uid.o o_time.o o_str.o o_dir.o o_fips.o o_init.o fips_ers.o $(CPUID_OBJ) 40 uid.o o_time.o o_str.o o_dir.o o_fips.o o_init.o fips_ers.o $(CPUID_OBJ)
41 41
42SRC= $(LIBSRC) 42SRC= $(LIBSRC)
43 43
44EXHEADER= crypto.h opensslv.h opensslconf.h ebcdic.h symhacks.h \ 44EXHEADER= crypto.h opensslv.h opensslconf.h symhacks.h \
45 ossl_typ.h 45 ossl_typ.h
46HEADER= cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(EXHEADER) 46HEADER= cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(EXHEADER)
47 47
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c
index 04266e790a..4f312ee6c9 100644
--- a/src/lib/libcrypto/asn1/a_gentm.c
+++ b/src/lib/libcrypto/asn1/a_gentm.c
@@ -68,18 +68,6 @@
68 68
69int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp) 69int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp)
70 { 70 {
71#ifdef CHARSET_EBCDIC
72 /* KLUDGE! We convert to ascii before writing DER */
73 int len;
74 char tmp[24];
75 ASN1_STRING tmpstr = *(ASN1_STRING *)a;
76
77 len = tmpstr.length;
78 ebcdic2ascii(tmp, tmpstr.data, (len >= sizeof tmp) ? sizeof tmp : len);
79 tmpstr.data = tmp;
80
81 a = (ASN1_GENERALIZEDTIME *) &tmpstr;
82#endif
83 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, 71 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
84 V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL)); 72 V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL));
85 } 73 }
@@ -97,9 +85,6 @@ ASN1_GENERALIZEDTIME *d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a,
97 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ERR_R_NESTED_ASN1_ERROR); 85 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ERR_R_NESTED_ASN1_ERROR);
98 return(NULL); 86 return(NULL);
99 } 87 }
100#ifdef CHARSET_EBCDIC
101 ascii2ebcdic(ret->data, ret->data, ret->length);
102#endif
103 if (!ASN1_GENERALIZEDTIME_check(ret)) 88 if (!ASN1_GENERALIZEDTIME_check(ret))
104 { 89 {
105 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ASN1_R_INVALID_TIME_FORMAT); 90 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ASN1_R_INVALID_TIME_FORMAT);
@@ -256,8 +241,5 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
256 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); 241 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
257 s->length=strlen(p); 242 s->length=strlen(p);
258 s->type=V_ASN1_GENERALIZEDTIME; 243 s->type=V_ASN1_GENERALIZEDTIME;
259#ifdef CHARSET_EBCDIC_not
260 ebcdic2ascii(s->data, s->data, s->length);
261#endif
262 return(s); 244 return(s);
263 } 245 }
diff --git a/src/lib/libcrypto/asn1/a_mbstr.c b/src/lib/libcrypto/asn1/a_mbstr.c
index 264d8f677f..dc953c8325 100644
--- a/src/lib/libcrypto/asn1/a_mbstr.c
+++ b/src/lib/libcrypto/asn1/a_mbstr.c
@@ -385,16 +385,9 @@ static int is_printable(unsigned long value)
385 /* Note: we can't use 'isalnum' because certain accented 385 /* Note: we can't use 'isalnum' because certain accented
386 * characters may count as alphanumeric in some environments. 386 * characters may count as alphanumeric in some environments.
387 */ 387 */
388#ifndef CHARSET_EBCDIC
389 if((ch >= 'a') && (ch <= 'z')) return 1; 388 if((ch >= 'a') && (ch <= 'z')) return 1;
390 if((ch >= 'A') && (ch <= 'Z')) return 1; 389 if((ch >= 'A') && (ch <= 'Z')) return 1;
391 if((ch >= '0') && (ch <= '9')) return 1; 390 if((ch >= '0') && (ch <= '9')) return 1;
392 if ((ch == ' ') || strchr("'()+,-./:=?", ch)) return 1; 391 if ((ch == ' ') || strchr("'()+,-./:=?", ch)) return 1;
393#else /*CHARSET_EBCDIC*/
394 if((ch >= os_toascii['a']) && (ch <= os_toascii['z'])) return 1;
395 if((ch >= os_toascii['A']) && (ch <= os_toascii['Z'])) return 1;
396 if((ch >= os_toascii['0']) && (ch <= os_toascii['9'])) return 1;
397 if ((ch == os_toascii[' ']) || strchr("'()+,-./:=?", os_toebcdic[ch])) return 1;
398#endif /*CHARSET_EBCDIC*/
399 return 0; 392 return 0;
400} 393}
diff --git a/src/lib/libcrypto/asn1/a_print.c b/src/lib/libcrypto/asn1/a_print.c
index d18e772320..9eec5034e1 100644
--- a/src/lib/libcrypto/asn1/a_print.c
+++ b/src/lib/libcrypto/asn1/a_print.c
@@ -72,7 +72,6 @@ int ASN1_PRINTABLE_type(const unsigned char *s, int len)
72 while ((*s) && (len-- != 0)) 72 while ((*s) && (len-- != 0))
73 { 73 {
74 c= *(s++); 74 c= *(s++);
75#ifndef CHARSET_EBCDIC
76 if (!( ((c >= 'a') && (c <= 'z')) || 75 if (!( ((c >= 'a') && (c <= 'z')) ||
77 ((c >= 'A') && (c <= 'Z')) || 76 ((c >= 'A') && (c <= 'Z')) ||
78 (c == ' ') || 77 (c == ' ') ||
@@ -86,13 +85,6 @@ int ASN1_PRINTABLE_type(const unsigned char *s, int len)
86 ia5=1; 85 ia5=1;
87 if (c&0x80) 86 if (c&0x80)
88 t61=1; 87 t61=1;
89#else
90 if (!isalnum(c) && (c != ' ') &&
91 strchr("'()+,-./:=?", c) == NULL)
92 ia5=1;
93 if (os_toascii[c] & 0x80)
94 t61=1;
95#endif
96 } 88 }
97 if (t61) return(V_ASN1_T61STRING); 89 if (t61) return(V_ASN1_T61STRING);
98 if (ia5) return(V_ASN1_IA5STRING); 90 if (ia5) return(V_ASN1_IA5STRING);
diff --git a/src/lib/libcrypto/asn1/a_time.c b/src/lib/libcrypto/asn1/a_time.c
index e2eb9b243e..4ade88f065 100644
--- a/src/lib/libcrypto/asn1/a_time.c
+++ b/src/lib/libcrypto/asn1/a_time.c
@@ -74,21 +74,6 @@ IMPLEMENT_ASN1_FUNCTIONS(ASN1_TIME)
74#if 0 74#if 0
75int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp) 75int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp)
76 { 76 {
77#ifdef CHARSET_EBCDIC
78 /* KLUDGE! We convert to ascii before writing DER */
79 char tmp[24];
80 ASN1_STRING tmpstr;
81
82 if(a->type == V_ASN1_UTCTIME || a->type == V_ASN1_GENERALIZEDTIME) {
83 int len;
84
85 tmpstr = *(ASN1_STRING *)a;
86 len = tmpstr.length;
87 ebcdic2ascii(tmp, tmpstr.data, (len >= sizeof tmp) ? sizeof tmp : len);
88 tmpstr.data = tmp;
89 a = (ASN1_GENERALIZEDTIME *) &tmpstr;
90 }
91#endif
92 if(a->type == V_ASN1_UTCTIME || a->type == V_ASN1_GENERALIZEDTIME) 77 if(a->type == V_ASN1_UTCTIME || a->type == V_ASN1_GENERALIZEDTIME)
93 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, 78 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
94 a->type ,V_ASN1_UNIVERSAL)); 79 a->type ,V_ASN1_UNIVERSAL));
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c
index 615395b738..f2e7de16af 100644
--- a/src/lib/libcrypto/asn1/a_utctm.c
+++ b/src/lib/libcrypto/asn1/a_utctm.c
@@ -65,20 +65,8 @@
65#if 0 65#if 0
66int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp) 66int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp)
67 { 67 {
68#ifndef CHARSET_EBCDIC
69 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, 68 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
70 V_ASN1_UTCTIME,V_ASN1_UNIVERSAL)); 69 V_ASN1_UTCTIME,V_ASN1_UNIVERSAL));
71#else
72 /* KLUDGE! We convert to ascii before writing DER */
73 int len;
74 char tmp[24];
75 ASN1_STRING x = *(ASN1_STRING *)a;
76
77 len = x.length;
78 ebcdic2ascii(tmp, x.data, (len >= sizeof tmp) ? sizeof tmp : len);
79 x.data = tmp;
80 return i2d_ASN1_bytes(&x, pp, V_ASN1_UTCTIME,V_ASN1_UNIVERSAL);
81#endif
82 } 70 }
83 71
84 72
@@ -94,9 +82,6 @@ ASN1_UTCTIME *d2i_ASN1_UTCTIME(ASN1_UTCTIME **a, unsigned char **pp,
94 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ERR_R_NESTED_ASN1_ERROR); 82 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ERR_R_NESTED_ASN1_ERROR);
95 return(NULL); 83 return(NULL);
96 } 84 }
97#ifdef CHARSET_EBCDIC
98 ascii2ebcdic(ret->data, ret->data, ret->length);
99#endif
100 if (!ASN1_UTCTIME_check(ret)) 85 if (!ASN1_UTCTIME_check(ret))
101 { 86 {
102 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_INVALID_TIME_FORMAT); 87 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_INVALID_TIME_FORMAT);
@@ -233,9 +218,6 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
233 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); 218 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
234 s->length=strlen(p); 219 s->length=strlen(p);
235 s->type=V_ASN1_UTCTIME; 220 s->type=V_ASN1_UTCTIME;
236#ifdef CHARSET_EBCDIC_not
237 ebcdic2ascii(s->data, s->data, s->length);
238#endif
239 return(s); 221 return(s);
240 } 222 }
241 223
diff --git a/src/lib/libcrypto/asn1/f_int.c b/src/lib/libcrypto/asn1/f_int.c
index 9494e597ab..8b92fad9df 100644
--- a/src/lib/libcrypto/asn1/f_int.c
+++ b/src/lib/libcrypto/asn1/f_int.c
@@ -123,18 +123,9 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
123 123
124 for (j=0; j<i; j++) 124 for (j=0; j<i; j++)
125 { 125 {
126#ifndef CHARSET_EBCDIC
127 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) || 126 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) ||
128 ((buf[j] >= 'a') && (buf[j] <= 'f')) || 127 ((buf[j] >= 'a') && (buf[j] <= 'f')) ||
129 ((buf[j] >= 'A') && (buf[j] <= 'F')))) 128 ((buf[j] >= 'A') && (buf[j] <= 'F'))))
130#else
131 /* This #ifdef is not strictly necessary, since
132 * the characters A...F a...f 0...9 are contiguous
133 * (yes, even in EBCDIC - but not the whole alphabet).
134 * Nevertheless, isxdigit() is faster.
135 */
136 if (!isxdigit(buf[j]))
137#endif
138 { 129 {
139 i=j; 130 i=j;
140 break; 131 break;
diff --git a/src/lib/libcrypto/asn1/f_string.c b/src/lib/libcrypto/asn1/f_string.c
index 968698a798..f7d36adac7 100644
--- a/src/lib/libcrypto/asn1/f_string.c
+++ b/src/lib/libcrypto/asn1/f_string.c
@@ -123,18 +123,9 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
123 123
124 for (j=i-1; j>0; j--) 124 for (j=i-1; j>0; j--)
125 { 125 {
126#ifndef CHARSET_EBCDIC
127 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) || 126 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) ||
128 ((buf[j] >= 'a') && (buf[j] <= 'f')) || 127 ((buf[j] >= 'a') && (buf[j] <= 'f')) ||
129 ((buf[j] >= 'A') && (buf[j] <= 'F')))) 128 ((buf[j] >= 'A') && (buf[j] <= 'F'))))
130#else
131 /* This #ifdef is not strictly necessary, since
132 * the characters A...F a...f 0...9 are contiguous
133 * (yes, even in EBCDIC - but not the whole alphabet).
134 * Nevertheless, isxdigit() is faster.
135 */
136 if (!isxdigit(buf[j]))
137#endif
138 { 129 {
139 i=j; 130 i=j;
140 break; 131 break;
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c
index edbb39a02f..bbf00c7a29 100644
--- a/src/lib/libcrypto/asn1/t_x509.c
+++ b/src/lib/libcrypto/asn1/t_x509.c
@@ -485,7 +485,6 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
485 c=s; 485 c=s;
486 for (;;) 486 for (;;)
487 { 487 {
488#ifndef CHARSET_EBCDIC
489 if ( ((*s == '/') && 488 if ( ((*s == '/') &&
490 ((s[1] >= 'A') && (s[1] <= 'Z') && ( 489 ((s[1] >= 'A') && (s[1] <= 'Z') && (
491 (s[2] == '=') || 490 (s[2] == '=') ||
@@ -493,15 +492,6 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
493 (s[3] == '=')) 492 (s[3] == '='))
494 ))) || 493 ))) ||
495 (*s == '\0')) 494 (*s == '\0'))
496#else
497 if ( ((*s == '/') &&
498 (isupper(s[1]) && (
499 (s[2] == '=') ||
500 (isupper(s[2]) &&
501 (s[3] == '='))
502 ))) ||
503 (*s == '\0'))
504#endif
505 { 495 {
506 i=s-c; 496 i=s-c;
507 if (BIO_write(bp,c,i) != i) goto err; 497 if (BIO_write(bp,c,i) != i) goto err;
diff --git a/src/lib/libcrypto/bf/bftest.c b/src/lib/libcrypto/bf/bftest.c
index 97e6634d37..20caf0f3f8 100644
--- a/src/lib/libcrypto/bf/bftest.c
+++ b/src/lib/libcrypto/bf/bftest.c
@@ -75,10 +75,6 @@ int main(int argc, char *argv[])
75#else 75#else
76#include <openssl/blowfish.h> 76#include <openssl/blowfish.h>
77 77
78#ifdef CHARSET_EBCDIC
79#include <openssl/ebcdic.h>
80#endif
81
82static char *bf_key[2]={ 78static char *bf_key[2]={
83 "abcdefghijklmnopqrstuvwxyz", 79 "abcdefghijklmnopqrstuvwxyz",
84 "Who is John Galt?" 80 "Who is John Galt?"
@@ -361,16 +357,9 @@ static int test(void)
361 unsigned char out[8]; 357 unsigned char out[8];
362 BF_LONG len; 358 BF_LONG len;
363 359
364#ifdef CHARSET_EBCDIC
365 ebcdic2ascii(cbc_data, cbc_data, strlen(cbc_data));
366#endif
367
368 printf("testing blowfish in raw ecb mode\n"); 360 printf("testing blowfish in raw ecb mode\n");
369 for (n=0; n<2; n++) 361 for (n=0; n<2; n++)
370 { 362 {
371#ifdef CHARSET_EBCDIC
372 ebcdic2ascii(bf_key[n], bf_key[n], strlen(bf_key[n]));
373#endif
374 BF_set_key(&key,strlen(bf_key[n]),(unsigned char *)bf_key[n]); 363 BF_set_key(&key,strlen(bf_key[n]),(unsigned char *)bf_key[n]);
375 364
376 data[0]=bf_plain[n][0]; 365 data[0]=bf_plain[n][0];
diff --git a/src/lib/libcrypto/bio/b_dump.c b/src/lib/libcrypto/bio/b_dump.c
index bea94969a2..32d523563e 100644
--- a/src/lib/libcrypto/bio/b_dump.c
+++ b/src/lib/libcrypto/bio/b_dump.c
@@ -125,14 +125,8 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),
125 if (((i*dump_width) + j) >= len) 125 if (((i*dump_width) + j) >= len)
126 break; 126 break;
127 ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff; 127 ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff;
128#ifndef CHARSET_EBCDIC
129 (void) snprintf(tmp, sizeof tmp, "%c", 128 (void) snprintf(tmp, sizeof tmp, "%c",
130 ((ch >= ' ') && (ch <= '~')) ? ch : '.'); 129 ((ch >= ' ') && (ch <= '~')) ? ch : '.');
131#else
132 (void) snprintf(tmp, sizeof tmp, "%c",
133 ((ch >= os_toascii[' ']) && (ch <= os_toascii['~']))
134 ? os_toebcdic[ch] : '.');
135#endif
136 BUF_strlcat(buf, tmp, sizeof buf); 130 BUF_strlcat(buf, tmp, sizeof buf);
137 } 131 }
138 BUF_strlcat(buf, "\n", sizeof buf); 132 BUF_strlcat(buf, "\n", sizeof buf);
diff --git a/src/lib/libcrypto/conf/conf_def.h b/src/lib/libcrypto/conf/conf_def.h
index 92a7d8ad77..b18e6e2728 100644
--- a/src/lib/libcrypto/conf/conf_def.h
+++ b/src/lib/libcrypto/conf/conf_def.h
@@ -78,7 +78,6 @@
78 CONF_PUNCTUATION) 78 CONF_PUNCTUATION)
79 79
80#define KEYTYPES(c) ((unsigned short *)((c)->meth_data)) 80#define KEYTYPES(c) ((unsigned short *)((c)->meth_data))
81#ifndef CHARSET_EBCDIC
82#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT) 81#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
83#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT) 82#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
84#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF) 83#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
@@ -92,22 +91,6 @@
92#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE) 91#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
93#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT) 92#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
94 93
95#else /*CHARSET_EBCDIC*/
96
97#define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_COMMENT)
98#define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_FCOMMENT)
99#define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_EOF)
100#define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ESC)
101#define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_NUMBER)
102#define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_WS)
103#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC)
104#define IS_ALPHA_NUMERIC_PUNCT(c,a) \
105 (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
106#define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_QUOTE)
107#define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_DQUOTE)
108#define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_HIGHBIT)
109#endif /*CHARSET_EBCDIC*/
110
111static unsigned short CONF_type_default[256]={ 94static unsigned short CONF_type_default[256]={
112 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 95 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
113 0x0000,0x0010,0x0010,0x0000,0x0000,0x0010,0x0000,0x0000, 96 0x0000,0x0010,0x0010,0x0000,0x0000,0x0010,0x0000,0x0000,
diff --git a/src/lib/libcrypto/conf/keysets.pl b/src/lib/libcrypto/conf/keysets.pl
index 50ed67fa52..fe17be57fe 100644
--- a/src/lib/libcrypto/conf/keysets.pl
+++ b/src/lib/libcrypto/conf/keysets.pl
@@ -132,7 +132,6 @@ print <<"EOF";
132 CONF_PUNCTUATION) 132 CONF_PUNCTUATION)
133 133
134#define KEYTYPES(c) ((unsigned short *)((c)->meth_data)) 134#define KEYTYPES(c) ((unsigned short *)((c)->meth_data))
135#ifndef CHARSET_EBCDIC
136#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT) 135#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
137#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT) 136#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
138#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF) 137#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
@@ -146,21 +145,6 @@ print <<"EOF";
146#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE) 145#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
147#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT) 146#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
148 147
149#else /*CHARSET_EBCDIC*/
150
151#define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_COMMENT)
152#define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_FCOMMENT)
153#define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_EOF)
154#define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ESC)
155#define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_NUMBER)
156#define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_WS)
157#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC)
158#define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
159 (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
160#define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_QUOTE)
161#define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_DQUOTE)
162#define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_HIGHBIT)
163#endif /*CHARSET_EBCDIC*/
164 148
165EOF 149EOF
166 150
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index baeba25b99..351ccfd35b 100644
--- a/src/lib/libcrypto/crypto.h
+++ b/src/lib/libcrypto/crypto.h
@@ -130,10 +130,6 @@
130#include <openssl/opensslv.h> 130#include <openssl/opensslv.h>
131#include <openssl/ossl_typ.h> 131#include <openssl/ossl_typ.h>
132 132
133#ifdef CHARSET_EBCDIC
134#include <openssl/ebcdic.h>
135#endif
136
137#ifdef __cplusplus 133#ifdef __cplusplus
138extern "C" { 134extern "C" {
139#endif 135#endif
diff --git a/src/lib/libcrypto/crypto/Makefile b/src/lib/libcrypto/crypto/Makefile
index f07176f829..e3bb0a2b36 100644
--- a/src/lib/libcrypto/crypto/Makefile
+++ b/src/lib/libcrypto/crypto/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.7 2014/04/15 17:20:09 beck Exp $ 1# $OpenBSD: Makefile,v 1.8 2014/04/15 17:46:16 beck Exp $
2 2
3LIB= crypto 3LIB= crypto
4 4
@@ -43,7 +43,7 @@ CFLAGS+= -I${LCRYPTO_SRC}/modes -I${LCRYPTO_SRC}/asn1 -I${LCRYPTO_SRC}/evp
43 43
44# crypto/ 44# crypto/
45SRCS+= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c cpt_err.c 45SRCS+= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c cpt_err.c
46SRCS+= ebcdic.c uid.c o_time.c o_str.c o_fips.c o_init.c fips_ers.c 46SRCS+= uid.c o_time.c o_str.c o_fips.c o_init.c fips_ers.c
47 47
48# aes/ 48# aes/
49SRCS+= aes_misc.c aes_ecb.c aes_cfb.c aes_ofb.c 49SRCS+= aes_misc.c aes_ecb.c aes_cfb.c aes_ofb.c
@@ -369,7 +369,6 @@ HDRS=\
369 crypto/dh/dh.h \ 369 crypto/dh/dh.h \
370 crypto/dsa/dsa.h \ 370 crypto/dsa/dsa.h \
371 crypto/dso/dso.h \ 371 crypto/dso/dso.h \
372 crypto/ebcdic.h \
373 crypto/ec/ec.h \ 372 crypto/ec/ec.h \
374 crypto/ecdh/ecdh.h \ 373 crypto/ecdh/ecdh.h \
375 crypto/ecdsa/ecdsa.h \ 374 crypto/ecdsa/ecdsa.h \
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;
diff --git a/src/lib/libcrypto/ebcdic.c b/src/lib/libcrypto/ebcdic.c
deleted file mode 100644
index 2ac26abc72..0000000000
--- a/src/lib/libcrypto/ebcdic.c
+++ /dev/null
@@ -1,221 +0,0 @@
1/* crypto/ebcdic.c */
2
3#ifndef CHARSET_EBCDIC
4
5#include <openssl/e_os2.h>
6#if defined(PEDANTIC) || defined(__DECC) || defined(OPENSSL_SYS_MACOSX)
7static void *dummy = &dummy;
8#endif
9
10#else /*CHARSET_EBCDIC*/
11
12#include "ebcdic.h"
13/* Initial Port for Apache-1.3 by <Martin.Kraemer@Mch.SNI.De>
14 * Adapted for OpenSSL-0.9.4 by <Martin.Kraemer@Mch.SNI.De>
15 */
16
17#ifdef _OSD_POSIX
18/*
19 "BS2000 OSD" is a POSIX subsystem on a main frame.
20 It is made by Siemens AG, Germany, for their BS2000 mainframe machines.
21 Within the POSIX subsystem, the same character set was chosen as in
22 "native BS2000", namely EBCDIC. (EDF04)
23
24 The name "ASCII" in these routines is misleading: actually, conversion
25 is not between EBCDIC and ASCII, but EBCDIC(EDF04) and ISO-8859.1;
26 that means that (western european) national characters are preserved.
27
28 This table is identical to the one used by rsh/rcp/ftp and other POSIX tools.
29*/
30
31/* Here's the bijective ebcdic-to-ascii table: */
32const unsigned char os_toascii[256] = {
33/*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f,
34 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
35/*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97,
36 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
37/*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b,
38 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................*/
39/*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
40 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................*/
41/*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
42 0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|*/
43/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
44 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);.*/
45/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
46 0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /*-/........^,%_>?*/
47/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
48 0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'="*/
49/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
50 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi......*/
51/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
52 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr......*/
53/*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
54 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz......*/
55/*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
56 0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\]..*/
57/*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
58 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI......*/
59/*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
60 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR......*/
61/*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
62 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ......*/
63/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
64 0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e /*0123456789.{.}.~*/
65};
66
67
68/* The ascii-to-ebcdic table: */
69const unsigned char os_toebcdic[256] = {
70/*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
71 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
72/*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
73 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
74/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
75 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
76/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
77 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/
78/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
79 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/
80/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
81 0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/
82/*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
83 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/
84/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
85 0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/
86/*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
87 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/
88/*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
89 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/
90/*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
91 0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/
92/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
93 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/
94/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
95 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/
96/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
97 0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/
98/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
99 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/
100/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
101 0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/
102};
103
104#else /*_OSD_POSIX*/
105
106/*
107This code does basic character mapping for IBM's TPF and OS/390 operating systems.
108It is a modified version of the BS2000 table.
109
110Bijective EBCDIC (character set IBM-1047) to US-ASCII table:
111This table is bijective - there are no ambigous or duplicate characters.
112*/
113const unsigned char os_toascii[256] = {
114 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */
115 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
116 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */
117 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
118 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */
119 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */
120 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */
121 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */
122 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */
123 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */
124 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */
125 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */
126 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */
127 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */
128 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */
129 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */
130 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */
131 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */
132 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */
133 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */
134 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */
135 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */
136 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */
137 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */
138 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */
139 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */
140 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */
141 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */
142 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */
143 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */
144 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */
145 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */
146};
147
148
149/*
150The US-ASCII to EBCDIC (character set IBM-1047) table:
151This table is bijective (no ambiguous or duplicate characters)
152*/
153const unsigned char os_toebcdic[256] = {
154 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f: */
155 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
156 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f: */
157 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
158 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f: */
159 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
160 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f: */
161 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */
162 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f: */
163 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */
164 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f: */
165 0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */
166 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f: */
167 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */
168 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f: */
169 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */
170 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f: */
171 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */
172 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f: */
173 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */
174 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af: */
175 0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */
176 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf: */
177 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */
178 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf: */
179 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */
180 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df: */
181 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */
182 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef: */
183 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */
184 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff: */
185 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /* ................ */
186};
187#endif /*_OSD_POSIX*/
188
189/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset)
190 * dest and srce may be identical, or separate memory blocks, but
191 * should not overlap. These functions intentionally have an interface
192 * compatible to memcpy(3).
193 */
194
195void *
196ebcdic2ascii(void *dest, const void *srce, size_t count)
197{
198 unsigned char *udest = dest;
199 const unsigned char *usrce = srce;
200
201 while (count-- != 0) {
202 *udest++ = os_toascii[*usrce++];
203 }
204
205 return dest;
206}
207
208void *
209ascii2ebcdic(void *dest, const void *srce, size_t count)
210{
211 unsigned char *udest = dest;
212 const unsigned char *usrce = srce;
213
214 while (count-- != 0) {
215 *udest++ = os_toebcdic[*usrce++];
216 }
217
218 return dest;
219}
220
221#endif
diff --git a/src/lib/libcrypto/ebcdic.h b/src/lib/libcrypto/ebcdic.h
deleted file mode 100644
index 6d65afcf9e..0000000000
--- a/src/lib/libcrypto/ebcdic.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/* crypto/ebcdic.h */
2
3#ifndef HEADER_EBCDIC_H
4#define HEADER_EBCDIC_H
5
6#include <sys/types.h>
7
8/* Avoid name clashes with other applications */
9#define os_toascii _openssl_os_toascii
10#define os_toebcdic _openssl_os_toebcdic
11#define ebcdic2ascii _openssl_ebcdic2ascii
12#define ascii2ebcdic _openssl_ascii2ebcdic
13
14extern const unsigned char os_toascii[256];
15extern const unsigned char os_toebcdic[256];
16void *ebcdic2ascii(void *dest, const void *srce, size_t count);
17void *ascii2ebcdic(void *dest, const void *srce, size_t count);
18
19#endif
diff --git a/src/lib/libcrypto/evp/encode.c b/src/lib/libcrypto/evp/encode.c
index 28546a84bc..7af9a2780b 100644
--- a/src/lib/libcrypto/evp/encode.c
+++ b/src/lib/libcrypto/evp/encode.c
@@ -60,19 +60,8 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62 62
63#ifndef CHARSET_EBCDIC
64#define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f]) 63#define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f])
65#define conv_ascii2bin(a) (data_ascii2bin[(a)&0x7f]) 64#define conv_ascii2bin(a) (data_ascii2bin[(a)&0x7f])
66#else
67/* We assume that PEM encoded files are EBCDIC files
68 * (i.e., printable text files). Convert them here while decoding.
69 * When encoding, output is EBCDIC (text) format again.
70 * (No need for conversion in the conv_bin2ascii macro, as the
71 * underlying textstring data_bin2ascii[] is already EBCDIC)
72 */
73#define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f])
74#define conv_ascii2bin(a) (data_ascii2bin[os_toascii[a]&0x7f])
75#endif
76 65
77/* 64 char lines 66/* 64 char lines
78 * pad input with 0 67 * pad input with 0
diff --git a/src/lib/libcrypto/hmac/hmactest.c b/src/lib/libcrypto/hmac/hmactest.c
index 1b906b81af..282e06e53e 100644
--- a/src/lib/libcrypto/hmac/hmactest.c
+++ b/src/lib/libcrypto/hmac/hmactest.c
@@ -74,9 +74,6 @@ int main(int argc, char *argv[])
74#include <openssl/md5.h> 74#include <openssl/md5.h>
75#endif 75#endif
76 76
77#ifdef CHARSET_EBCDIC
78#include <openssl/ebcdic.h>
79#endif
80 77
81#ifndef OPENSSL_NO_MD5 78#ifndef OPENSSL_NO_MD5
82static struct test_st 79static struct test_st
@@ -132,14 +129,6 @@ int main(int argc, char *argv[])
132#ifdef OPENSSL_NO_MD5 129#ifdef OPENSSL_NO_MD5
133 printf("test skipped: MD5 disabled\n"); 130 printf("test skipped: MD5 disabled\n");
134#else 131#else
135
136#ifdef CHARSET_EBCDIC
137 ebcdic2ascii(test[0].data, test[0].data, test[0].data_len);
138 ebcdic2ascii(test[1].data, test[1].data, test[1].data_len);
139 ebcdic2ascii(test[2].key, test[2].key, test[2].key_len);
140 ebcdic2ascii(test[2].data, test[2].data, test[2].data_len);
141#endif
142
143 for (i=0; i<4; i++) 132 for (i=0; i<4; i++)
144 { 133 {
145 p=pt(HMAC(EVP_md5(), 134 p=pt(HMAC(EVP_md5(),
diff --git a/src/lib/libcrypto/md2/md2_one.c b/src/lib/libcrypto/md2/md2_one.c
index f7fef5cc0a..cb8594e085 100644
--- a/src/lib/libcrypto/md2/md2_one.c
+++ b/src/lib/libcrypto/md2/md2_one.c
@@ -71,23 +71,7 @@ unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md)
71 if (md == NULL) md=m; 71 if (md == NULL) md=m;
72 if (!MD2_Init(&c)) 72 if (!MD2_Init(&c))
73 return NULL; 73 return NULL;
74#ifndef CHARSET_EBCDIC
75 MD2_Update(&c,d,n); 74 MD2_Update(&c,d,n);
76#else
77 {
78 char temp[1024];
79 unsigned long chunk;
80
81 while (n > 0)
82 {
83 chunk = (n > sizeof(temp)) ? sizeof(temp) : n;
84 ebcdic2ascii(temp, d, chunk);
85 MD2_Update(&c,temp,chunk);
86 n -= chunk;
87 d += chunk;
88 }
89 }
90#endif
91 MD2_Final(md,&c); 75 MD2_Final(md,&c);
92 OPENSSL_cleanse(&c,sizeof(c)); /* Security consideration */ 76 OPENSSL_cleanse(&c,sizeof(c)); /* Security consideration */
93 return(md); 77 return(md);
diff --git a/src/lib/libcrypto/md2/md2test.c b/src/lib/libcrypto/md2/md2test.c
index db5f5bc6d2..0195214036 100644
--- a/src/lib/libcrypto/md2/md2test.c
+++ b/src/lib/libcrypto/md2/md2test.c
@@ -72,10 +72,6 @@ int main(int argc, char *argv[])
72#include <openssl/evp.h> 72#include <openssl/evp.h>
73#include <openssl/md2.h> 73#include <openssl/md2.h>
74 74
75#ifdef CHARSET_EBCDIC
76#include <openssl/ebcdic.h>
77#endif
78
79static char *test[]={ 75static char *test[]={
80 "", 76 "",
81 "a", 77 "a",
diff --git a/src/lib/libcrypto/md4/md4_one.c b/src/lib/libcrypto/md4/md4_one.c
index bb64362638..ed6ce33650 100644
--- a/src/lib/libcrypto/md4/md4_one.c
+++ b/src/lib/libcrypto/md4/md4_one.c
@@ -61,10 +61,6 @@
61#include <openssl/md4.h> 61#include <openssl/md4.h>
62#include <openssl/crypto.h> 62#include <openssl/crypto.h>
63 63
64#ifdef CHARSET_EBCDIC
65#include <openssl/ebcdic.h>
66#endif
67
68unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md) 64unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md)
69 { 65 {
70 MD4_CTX c; 66 MD4_CTX c;
@@ -73,23 +69,7 @@ unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md)
73 if (md == NULL) md=m; 69 if (md == NULL) md=m;
74 if (!MD4_Init(&c)) 70 if (!MD4_Init(&c))
75 return NULL; 71 return NULL;
76#ifndef CHARSET_EBCDIC
77 MD4_Update(&c,d,n); 72 MD4_Update(&c,d,n);
78#else
79 {
80 char temp[1024];
81 unsigned long chunk;
82
83 while (n > 0)
84 {
85 chunk = (n > sizeof(temp)) ? sizeof(temp) : n;
86 ebcdic2ascii(temp, d, chunk);
87 MD4_Update(&c,temp,chunk);
88 n -= chunk;
89 d += chunk;
90 }
91 }
92#endif
93 MD4_Final(md,&c); 73 MD4_Final(md,&c);
94 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */ 74 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
95 return(md); 75 return(md);
diff --git a/src/lib/libcrypto/md5/md5_one.c b/src/lib/libcrypto/md5/md5_one.c
index 43fee89379..839e27e972 100644
--- a/src/lib/libcrypto/md5/md5_one.c
+++ b/src/lib/libcrypto/md5/md5_one.c
@@ -61,10 +61,6 @@
61#include <openssl/md5.h> 61#include <openssl/md5.h>
62#include <openssl/crypto.h> 62#include <openssl/crypto.h>
63 63
64#ifdef CHARSET_EBCDIC
65#include <openssl/ebcdic.h>
66#endif
67
68unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md) 64unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)
69 { 65 {
70 MD5_CTX c; 66 MD5_CTX c;
@@ -73,23 +69,7 @@ unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)
73 if (md == NULL) md=m; 69 if (md == NULL) md=m;
74 if (!MD5_Init(&c)) 70 if (!MD5_Init(&c))
75 return NULL; 71 return NULL;
76#ifndef CHARSET_EBCDIC
77 MD5_Update(&c,d,n); 72 MD5_Update(&c,d,n);
78#else
79 {
80 char temp[1024];
81 unsigned long chunk;
82
83 while (n > 0)
84 {
85 chunk = (n > sizeof(temp)) ? sizeof(temp) : n;
86 ebcdic2ascii(temp, d, chunk);
87 MD5_Update(&c,temp,chunk);
88 n -= chunk;
89 d += chunk;
90 }
91 }
92#endif
93 MD5_Final(md,&c); 73 MD5_Final(md,&c);
94 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */ 74 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
95 return(md); 75 return(md);
diff --git a/src/lib/libcrypto/mdc2/mdc2test.c b/src/lib/libcrypto/mdc2/mdc2test.c
index 017b31add2..cf8f65cf27 100644
--- a/src/lib/libcrypto/mdc2/mdc2test.c
+++ b/src/lib/libcrypto/mdc2/mdc2test.c
@@ -76,10 +76,6 @@ int main(int argc, char *argv[])
76#include <openssl/evp.h> 76#include <openssl/evp.h>
77#include <openssl/mdc2.h> 77#include <openssl/mdc2.h>
78 78
79#ifdef CHARSET_EBCDIC
80#include <openssl/ebcdic.h>
81#endif
82
83static unsigned char pad1[16]={ 79static unsigned char pad1[16]={
84 0x42,0xE5,0x0C,0xD2,0x24,0xBA,0xCE,0xBA, 80 0x42,0xE5,0x0C,0xD2,0x24,0xBA,0xCE,0xBA,
85 0x76,0x0B,0xDD,0x2B,0xD4,0x09,0x28,0x1A 81 0x76,0x0B,0xDD,0x2B,0xD4,0x09,0x28,0x1A
@@ -98,10 +94,6 @@ int main(int argc, char *argv[])
98 EVP_MD_CTX c; 94 EVP_MD_CTX c;
99 static char *text="Now is the time for all "; 95 static char *text="Now is the time for all ";
100 96
101#ifdef CHARSET_EBCDIC
102 ebcdic2ascii(text,text,strlen(text));
103#endif
104
105 EVP_MD_CTX_init(&c); 97 EVP_MD_CTX_init(&c);
106 EVP_DigestInit_ex(&c,EVP_mdc2(), NULL); 98 EVP_DigestInit_ex(&c,EVP_mdc2(), NULL);
107 EVP_DigestUpdate(&c,(unsigned char *)text,strlen(text)); 99 EVP_DigestUpdate(&c,(unsigned char *)text,strlen(text));
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c
index a597284c80..bced796e62 100644
--- a/src/lib/libcrypto/objects/obj_dat.c
+++ b/src/lib/libcrypto/objects/obj_dat.c
@@ -705,22 +705,6 @@ const void *OBJ_bsearch_ex_(const void *key, const void *base_, int num,
705 else 705 else
706 break; 706 break;
707 } 707 }
708#ifdef CHARSET_EBCDIC
709/* THIS IS A KLUDGE - Because the *_obj is sorted in ASCII order, and
710 * I don't have perl (yet), we revert to a *LINEAR* search
711 * when the object wasn't found in the binary search.
712 */
713 if (c != 0)
714 {
715 for (i=0; i<num; ++i)
716 {
717 p= &(base[i*size]);
718 c = (*cmp)(key,p);
719 if (c == 0 || (c < 0 && (flags & OBJ_BSEARCH_VALUE_ON_NOMATCH)))
720 return p;
721 }
722 }
723#endif
724 if (c != 0 && !(flags & OBJ_BSEARCH_VALUE_ON_NOMATCH)) 708 if (c != 0 && !(flags & OBJ_BSEARCH_VALUE_ON_NOMATCH))
725 p = NULL; 709 p = NULL;
726 else if (c == 0 && (flags & OBJ_BSEARCH_FIRST_VALUE_ON_MATCH)) 710 else if (c == 0 && (flags & OBJ_BSEARCH_FIRST_VALUE_ON_MATCH))
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c
index 5a421fc4b6..74baa2ec1c 100644
--- a/src/lib/libcrypto/pem/pem_lib.c
+++ b/src/lib/libcrypto/pem/pem_lib.c
@@ -382,10 +382,6 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp,
382 PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,PEM_R_READ_KEY); 382 PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,PEM_R_READ_KEY);
383 goto err; 383 goto err;
384 } 384 }
385#ifdef CHARSET_EBCDIC
386 /* Convert the pass phrase from EBCDIC */
387 ebcdic2ascii(buf, buf, klen);
388#endif
389 kstr=(unsigned char *)buf; 385 kstr=(unsigned char *)buf;
390 } 386 }
391 RAND_add(data,i,0);/* put in the RSA key. */ 387 RAND_add(data,i,0);/* put in the RSA key. */
@@ -458,11 +454,6 @@ int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen,
458 PEMerr(PEM_F_PEM_DO_HEADER,PEM_R_BAD_PASSWORD_READ); 454 PEMerr(PEM_F_PEM_DO_HEADER,PEM_R_BAD_PASSWORD_READ);
459 return(0); 455 return(0);
460 } 456 }
461#ifdef CHARSET_EBCDIC
462 /* Convert the pass phrase from EBCDIC */
463 ebcdic2ascii(buf, buf, klen);
464#endif
465
466 if (!EVP_BytesToKey(cipher->cipher,EVP_md5(),&(cipher->iv[0]), 457 if (!EVP_BytesToKey(cipher->cipher,EVP_md5(),&(cipher->iv[0]),
467 (unsigned char *)buf,klen,1,key,NULL)) 458 (unsigned char *)buf,klen,1,key,NULL))
468 return 0; 459 return 0;
@@ -516,15 +507,9 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher)
516 for (;;) 507 for (;;)
517 { 508 {
518 c= *header; 509 c= *header;
519#ifndef CHARSET_EBCDIC
520 if (!( ((c >= 'A') && (c <= 'Z')) || (c == '-') || 510 if (!( ((c >= 'A') && (c <= 'Z')) || (c == '-') ||
521 ((c >= '0') && (c <= '9')))) 511 ((c >= '0') && (c <= '9'))))
522 break; 512 break;
523#else
524 if (!( isupper(c) || (c == '-') ||
525 isdigit(c)))
526 break;
527#endif
528 header++; 513 header++;
529 } 514 }
530 *header='\0'; 515 *header='\0';
diff --git a/src/lib/libcrypto/ripemd/rmdtest.c b/src/lib/libcrypto/ripemd/rmdtest.c
index fb34e0e836..b32fda96ed 100644
--- a/src/lib/libcrypto/ripemd/rmdtest.c
+++ b/src/lib/libcrypto/ripemd/rmdtest.c
@@ -72,10 +72,6 @@ int main(int argc, char *argv[])
72#include <openssl/ripemd.h> 72#include <openssl/ripemd.h>
73#include <openssl/evp.h> 73#include <openssl/evp.h>
74 74
75#ifdef CHARSET_EBCDIC
76#include <openssl/ebcdic.h>
77#endif
78
79static char *test[]={ 75static char *test[]={
80 "", 76 "",
81 "a", 77 "a",
@@ -112,9 +108,6 @@ int main(int argc, char *argv[])
112 i=1; 108 i=1;
113 while (*P != NULL) 109 while (*P != NULL)
114 { 110 {
115#ifdef CHARSET_EBCDIC
116 ebcdic2ascii((char *)*P, (char *)*P, strlen((char *)*P));
117#endif
118 EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_ripemd160(), NULL); 111 EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_ripemd160(), NULL);
119 p=pt(md); 112 p=pt(md);
120 if (strcmp(p,(char *)*R) != 0) 113 if (strcmp(p,(char *)*R) != 0)
diff --git a/src/lib/libcrypto/sha/sha1test.c b/src/lib/libcrypto/sha/sha1test.c
index 6feb3964c7..ad9e3dc407 100644
--- a/src/lib/libcrypto/sha/sha1test.c
+++ b/src/lib/libcrypto/sha/sha1test.c
@@ -72,10 +72,6 @@ int main(int argc, char *argv[])
72#include <openssl/evp.h> 72#include <openssl/evp.h>
73#include <openssl/sha.h> 73#include <openssl/sha.h>
74 74
75#ifdef CHARSET_EBCDIC
76#include <openssl/ebcdic.h>
77#endif
78
79#undef SHA_0 /* FIPS 180 */ 75#undef SHA_0 /* FIPS 180 */
80#define SHA_1 /* FIPS 180-1 */ 76#define SHA_1 /* FIPS 180-1 */
81 77
@@ -112,11 +108,6 @@ int main(int argc, char *argv[])
112 EVP_MD_CTX c; 108 EVP_MD_CTX c;
113 unsigned char md[SHA_DIGEST_LENGTH]; 109 unsigned char md[SHA_DIGEST_LENGTH];
114 110
115#ifdef CHARSET_EBCDIC
116 ebcdic2ascii(test[0], test[0], strlen(test[0]));
117 ebcdic2ascii(test[1], test[1], strlen(test[1]));
118#endif
119
120 EVP_MD_CTX_init(&c); 111 EVP_MD_CTX_init(&c);
121 P=test; 112 P=test;
122 R=ret; 113 R=ret;
@@ -139,9 +130,6 @@ int main(int argc, char *argv[])
139 } 130 }
140 131
141 memset(buf,'a',1000); 132 memset(buf,'a',1000);
142#ifdef CHARSET_EBCDIC
143 ebcdic2ascii(buf, buf, 1000);
144#endif /*CHARSET_EBCDIC*/
145 EVP_DigestInit_ex(&c,EVP_sha1(), NULL); 133 EVP_DigestInit_ex(&c,EVP_sha1(), NULL);
146 for (i=0; i<1000; i++) 134 for (i=0; i<1000; i++)
147 EVP_DigestUpdate(&c,buf,1000); 135 EVP_DigestUpdate(&c,buf,1000);
diff --git a/src/lib/libcrypto/sha/shatest.c b/src/lib/libcrypto/sha/shatest.c
index 27614646d1..6c93c39590 100644
--- a/src/lib/libcrypto/sha/shatest.c
+++ b/src/lib/libcrypto/sha/shatest.c
@@ -72,10 +72,6 @@ int main(int argc, char *argv[])
72#include <openssl/evp.h> 72#include <openssl/evp.h>
73#include <openssl/sha.h> 73#include <openssl/sha.h>
74 74
75#ifdef CHARSET_EBCDIC
76#include <openssl/ebcdic.h>
77#endif
78
79#define SHA_0 /* FIPS 180 */ 75#define SHA_0 /* FIPS 180 */
80#undef SHA_1 /* FIPS 180-1 */ 76#undef SHA_1 /* FIPS 180-1 */
81 77
@@ -112,11 +108,6 @@ int main(int argc, char *argv[])
112 EVP_MD_CTX c; 108 EVP_MD_CTX c;
113 unsigned char md[SHA_DIGEST_LENGTH]; 109 unsigned char md[SHA_DIGEST_LENGTH];
114 110
115#ifdef CHARSET_EBCDIC
116 ebcdic2ascii(test[0], test[0], strlen(test[0]));
117 ebcdic2ascii(test[1], test[1], strlen(test[1]));
118#endif
119
120 EVP_MD_CTX_init(&c); 111 EVP_MD_CTX_init(&c);
121 P=test; 112 P=test;
122 R=ret; 113 R=ret;
@@ -139,9 +130,6 @@ int main(int argc, char *argv[])
139 } 130 }
140 131
141 memset(buf,'a',1000); 132 memset(buf,'a',1000);
142#ifdef CHARSET_EBCDIC
143 ebcdic2ascii(buf, buf, 1000);
144#endif /*CHARSET_EBCDIC*/
145 EVP_DigestInit_ex(&c,EVP_sha(), NULL); 133 EVP_DigestInit_ex(&c,EVP_sha(), NULL);
146 for (i=0; i<1000; i++) 134 for (i=0; i<1000; i++)
147 EVP_DigestUpdate(&c,buf,1000); 135 EVP_DigestUpdate(&c,buf,1000);
diff --git a/src/lib/libcrypto/x509/x509_obj.c b/src/lib/libcrypto/x509/x509_obj.c
index 21fed9f838..bcc1e7429e 100644
--- a/src/lib/libcrypto/x509/x509_obj.c
+++ b/src/lib/libcrypto/x509/x509_obj.c
@@ -75,9 +75,6 @@ int i;
75 static const char hex[17]="0123456789ABCDEF"; 75 static const char hex[17]="0123456789ABCDEF";
76 int gs_doit[4]; 76 int gs_doit[4];
77 char tmp_buf[80]; 77 char tmp_buf[80];
78#ifdef CHARSET_EBCDIC
79 char ebcdic_buf[1024];
80#endif
81 78
82 if (buf == NULL) 79 if (buf == NULL)
83 { 80 {
@@ -114,20 +111,6 @@ int i;
114 type=ne->value->type; 111 type=ne->value->type;
115 num=ne->value->length; 112 num=ne->value->length;
116 q=ne->value->data; 113 q=ne->value->data;
117#ifdef CHARSET_EBCDIC
118 if (type == V_ASN1_GENERALSTRING ||
119 type == V_ASN1_VISIBLESTRING ||
120 type == V_ASN1_PRINTABLESTRING ||
121 type == V_ASN1_TELETEXSTRING ||
122 type == V_ASN1_VISIBLESTRING ||
123 type == V_ASN1_IA5STRING) {
124 ascii2ebcdic(ebcdic_buf, q,
125 (num > sizeof ebcdic_buf)
126 ? sizeof ebcdic_buf : num);
127 q=ebcdic_buf;
128 }
129#endif
130
131 if ((type == V_ASN1_GENERALSTRING) && ((num%4) == 0)) 114 if ((type == V_ASN1_GENERALSTRING) && ((num%4) == 0))
132 { 115 {
133 gs_doit[0]=gs_doit[1]=gs_doit[2]=gs_doit[3]=0; 116 gs_doit[0]=gs_doit[1]=gs_doit[2]=gs_doit[3]=0;
@@ -149,12 +132,7 @@ int i;
149 { 132 {
150 if (!gs_doit[j&3]) continue; 133 if (!gs_doit[j&3]) continue;
151 l2++; 134 l2++;
152#ifndef CHARSET_EBCDIC
153 if ((q[j] < ' ') || (q[j] > '~')) l2+=3; 135 if ((q[j] < ' ') || (q[j] > '~')) l2+=3;
154#else
155 if ((os_toascii[q[j]] < os_toascii[' ']) ||
156 (os_toascii[q[j]] > os_toascii['~'])) l2+=3;
157#endif
158 } 136 }
159 137
160 lold=l; 138 lold=l;
@@ -173,15 +151,10 @@ int i;
173 *(p++)='/'; 151 *(p++)='/';
174 memcpy(p,s,(unsigned int)l1); p+=l1; 152 memcpy(p,s,(unsigned int)l1); p+=l1;
175 *(p++)='='; 153 *(p++)='=';
176
177#ifndef CHARSET_EBCDIC /* q was assigned above already. */
178 q=ne->value->data; 154 q=ne->value->data;
179#endif
180
181 for (j=0; j<num; j++) 155 for (j=0; j<num; j++)
182 { 156 {
183 if (!gs_doit[j&3]) continue; 157 if (!gs_doit[j&3]) continue;
184#ifndef CHARSET_EBCDIC
185 n=q[j]; 158 n=q[j];
186 if ((n < ' ') || (n > '~')) 159 if ((n < ' ') || (n > '~'))
187 { 160 {
@@ -192,19 +165,6 @@ int i;
192 } 165 }
193 else 166 else
194 *(p++)=n; 167 *(p++)=n;
195#else
196 n=os_toascii[q[j]];
197 if ((n < os_toascii[' ']) ||
198 (n > os_toascii['~']))
199 {
200 *(p++)='\\';
201 *(p++)='x';
202 *(p++)=hex[(n>>4)&0x0f];
203 *(p++)=hex[n&0x0f];
204 }
205 else
206 *(p++)=q[j];
207#endif
208 } 168 }
209 *p='\0'; 169 *p='\0';
210 } 170 }
diff --git a/src/lib/libcrypto/x509v3/v3_ia5.c b/src/lib/libcrypto/x509v3/v3_ia5.c
index 4ff12b52b5..ab1c5188b8 100644
--- a/src/lib/libcrypto/x509v3/v3_ia5.c
+++ b/src/lib/libcrypto/x509v3/v3_ia5.c
@@ -105,9 +105,6 @@ static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method,
105 M_ASN1_IA5STRING_free(ia5); 105 M_ASN1_IA5STRING_free(ia5);
106 goto err; 106 goto err;
107 } 107 }
108#ifdef CHARSET_EBCDIC
109 ebcdic2ascii(ia5->data, ia5->data, ia5->length);
110#endif /*CHARSET_EBCDIC*/
111 return ia5; 108 return ia5;
112 err: 109 err:
113 X509V3err(X509V3_F_S2I_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); 110 X509V3err(X509V3_F_S2I_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE);
diff --git a/src/lib/libcrypto/x509v3/v3_prn.c b/src/lib/libcrypto/x509v3/v3_prn.c
index 3146218708..2124b447b4 100644
--- a/src/lib/libcrypto/x509v3/v3_prn.c
+++ b/src/lib/libcrypto/x509v3/v3_prn.c
@@ -83,22 +83,7 @@ void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml)
83 nval = sk_CONF_VALUE_value(val, i); 83 nval = sk_CONF_VALUE_value(val, i);
84 if(!nval->name) BIO_puts(out, nval->value); 84 if(!nval->name) BIO_puts(out, nval->value);
85 else if(!nval->value) BIO_puts(out, nval->name); 85 else if(!nval->value) BIO_puts(out, nval->name);
86#ifndef CHARSET_EBCDIC
87 else BIO_printf(out, "%s:%s", nval->name, nval->value); 86 else BIO_printf(out, "%s:%s", nval->name, nval->value);
88#else
89 else {
90 int len;
91 char *tmp;
92 len = strlen(nval->value)+1;
93 tmp = OPENSSL_malloc(len);
94 if (tmp)
95 {
96 ascii2ebcdic(tmp, nval->value, len);
97 BIO_printf(out, "%s:%s", nval->name, tmp);
98 OPENSSL_free(tmp);
99 }
100 }
101#endif
102 if(ml) BIO_puts(out, "\n"); 87 if(ml) BIO_puts(out, "\n");
103 } 88 }
104} 89}
@@ -127,22 +112,7 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int inde
127 ok = 0; 112 ok = 0;
128 goto err; 113 goto err;
129 } 114 }
130#ifndef CHARSET_EBCDIC
131 BIO_printf(out, "%*s%s", indent, "", value); 115 BIO_printf(out, "%*s%s", indent, "", value);
132#else
133 {
134 int len;
135 char *tmp;
136 len = strlen(value)+1;
137 tmp = OPENSSL_malloc(len);
138 if (tmp)
139 {
140 ascii2ebcdic(tmp, value, len);
141 BIO_printf(out, "%*s%s", indent, "", tmp);
142 OPENSSL_free(tmp);
143 }
144 }
145#endif
146 } else if(method->i2v) { 116 } else if(method->i2v) {
147 if(!(nval = method->i2v(method, ext_str, NULL))) { 117 if(!(nval = method->i2v(method, ext_str, NULL))) {
148 ok = 0; 118 ok = 0;
diff --git a/src/lib/libcrypto/x509v3/v3_utl.c b/src/lib/libcrypto/x509v3/v3_utl.c
index e030234540..c4b6143eff 100644
--- a/src/lib/libcrypto/x509v3/v3_utl.c
+++ b/src/lib/libcrypto/x509v3/v3_utl.c
@@ -378,10 +378,6 @@ char *hex_to_string(const unsigned char *buffer, long len)
378 *q++ = ':'; 378 *q++ = ':';
379 } 379 }
380 q[-1] = 0; 380 q[-1] = 0;
381#ifdef CHARSET_EBCDIC
382 ebcdic2ascii(tmp, tmp, q - tmp - 1);
383#endif
384
385 return tmp; 381 return tmp;
386} 382}
387 383
@@ -400,14 +396,8 @@ unsigned char *string_to_hex(const char *str, long *len)
400 if(!(hexbuf = OPENSSL_malloc(strlen(str) >> 1))) goto err; 396 if(!(hexbuf = OPENSSL_malloc(strlen(str) >> 1))) goto err;
401 for(p = (unsigned char *)str, q = hexbuf; *p;) { 397 for(p = (unsigned char *)str, q = hexbuf; *p;) {
402 ch = *p++; 398 ch = *p++;
403#ifdef CHARSET_EBCDIC
404 ch = os_toebcdic[ch];
405#endif
406 if(ch == ':') continue; 399 if(ch == ':') continue;
407 cl = *p++; 400 cl = *p++;
408#ifdef CHARSET_EBCDIC
409 cl = os_toebcdic[cl];
410#endif
411 if(!cl) { 401 if(!cl) {
412 X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS); 402 X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS);
413 OPENSSL_free(hexbuf); 403 OPENSSL_free(hexbuf);
@@ -844,21 +834,13 @@ int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk,
844 * multiple instances 834 * multiple instances
845 */ 835 */
846 for(p = type; *p ; p++) 836 for(p = type; *p ; p++)
847#ifndef CHARSET_EBCDIC
848 if ((*p == ':') || (*p == ',') || (*p == '.')) 837 if ((*p == ':') || (*p == ',') || (*p == '.'))
849#else
850 if ((*p == os_toascii[':']) || (*p == os_toascii[',']) || (*p == os_toascii['.']))
851#endif
852 { 838 {
853 p++; 839 p++;
854 if(*p) type = p; 840 if(*p) type = p;
855 break; 841 break;
856 } 842 }
857#ifndef CHARSET_EBCDIC
858 if (*type == '+') 843 if (*type == '+')
859#else
860 if (*type == os_toascii['+'])
861#endif
862 { 844 {
863 mval = -1; 845 mval = -1;
864 type++; 846 type++;
diff --git a/src/lib/libssl/src/apps/passwd.c b/src/lib/libssl/src/apps/passwd.c
index 473fe46cbd..9eabeb488c 100644
--- a/src/lib/libssl/src/apps/passwd.c
+++ b/src/lib/libssl/src/apps/passwd.c
@@ -1,6 +1,6 @@
1/* apps/passwd.c */ 1/* apps/passwd.c */
2 2
3#if defined OPENSSL_NO_MD5 || defined CHARSET_EBCDIC 3#if defined OPENSSL_NO_MD5
4# define NO_MD5CRYPT_1 4# define NO_MD5CRYPT_1
5#endif 5#endif
6 6
@@ -440,10 +440,6 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
440 (*salt_p)[0] = cov_2char[(*salt_p)[0] & 0x3f]; /* 6 bits */ 440 (*salt_p)[0] = cov_2char[(*salt_p)[0] & 0x3f]; /* 6 bits */
441 (*salt_p)[1] = cov_2char[(*salt_p)[1] & 0x3f]; /* 6 bits */ 441 (*salt_p)[1] = cov_2char[(*salt_p)[1] & 0x3f]; /* 6 bits */
442 (*salt_p)[2] = 0; 442 (*salt_p)[2] = 0;
443#ifdef CHARSET_EBCDIC
444 ascii2ebcdic(*salt_p, *salt_p, 2); /* des_crypt will convert
445 * back to ASCII */
446#endif
447 } 443 }
448#endif /* !OPENSSL_NO_DES */ 444#endif /* !OPENSSL_NO_DES */
449 445
diff --git a/src/lib/libssl/src/apps/req.c b/src/lib/libssl/src/apps/req.c
index f1f412887d..4b5c813cef 100644
--- a/src/lib/libssl/src/apps/req.c
+++ b/src/lib/libssl/src/apps/req.c
@@ -1397,20 +1397,12 @@ static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
1397 * multiple instances 1397 * multiple instances
1398 */ 1398 */
1399 for(p = v->name; *p ; p++) 1399 for(p = v->name; *p ; p++)
1400#ifndef CHARSET_EBCDIC
1401 if ((*p == ':') || (*p == ',') || (*p == '.')) { 1400 if ((*p == ':') || (*p == ',') || (*p == '.')) {
1402#else
1403 if ((*p == os_toascii[':']) || (*p == os_toascii[',']) || (*p == os_toascii['.'])) {
1404#endif
1405 p++; 1401 p++;
1406 if(*p) type = p; 1402 if(*p) type = p;
1407 break; 1403 break;
1408 } 1404 }
1409#ifndef CHARSET_EBCDIC
1410 if (*p == '+') 1405 if (*p == '+')
1411#else
1412 if (*p == os_toascii['+'])
1413#endif
1414 { 1406 {
1415 p++; 1407 p++;
1416 mval = -1; 1408 mval = -1;
@@ -1486,9 +1478,6 @@ start:
1486 return(0); 1478 return(0);
1487 } 1479 }
1488 buf[--i]='\0'; 1480 buf[--i]='\0';
1489#ifdef CHARSET_EBCDIC
1490 ebcdic2ascii(buf, buf, i);
1491#endif
1492 if(!req_check_len(i, n_min, n_max)) goto start; 1481 if(!req_check_len(i, n_min, n_max)) goto start;
1493 if (!X509_NAME_add_entry_by_NID(n,nid, chtype, 1482 if (!X509_NAME_add_entry_by_NID(n,nid, chtype,
1494 (unsigned char *) buf, -1,-1,mval)) goto err; 1483 (unsigned char *) buf, -1,-1,mval)) goto err;
@@ -1545,9 +1534,6 @@ start:
1545 return(0); 1534 return(0);
1546 } 1535 }
1547 buf[--i]='\0'; 1536 buf[--i]='\0';
1548#ifdef CHARSET_EBCDIC
1549 ebcdic2ascii(buf, buf, i);
1550#endif
1551 if(!req_check_len(i, n_min, n_max)) goto start; 1537 if(!req_check_len(i, n_min, n_max)) goto start;
1552 1538
1553 if(!X509_REQ_add1_attr_by_NID(req, nid, chtype, 1539 if(!X509_REQ_add1_attr_by_NID(req, nid, chtype,
diff --git a/src/lib/libssl/src/apps/s_client.c b/src/lib/libssl/src/apps/s_client.c
index 78566a595e..87fd958cbd 100644
--- a/src/lib/libssl/src/apps/s_client.c
+++ b/src/lib/libssl/src/apps/s_client.c
@@ -1752,9 +1752,6 @@ SSL_set_tlsext_status_ids(con, ids);
1752 else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds)) 1752 else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
1753#endif 1753#endif
1754 { 1754 {
1755#ifdef CHARSET_EBCDIC
1756 ascii2ebcdic(&(sbuf[sbuf_off]),&(sbuf[sbuf_off]),sbuf_len);
1757#endif
1758 i=raw_write_stdout(&(sbuf[sbuf_off]),sbuf_len); 1755 i=raw_write_stdout(&(sbuf[sbuf_off]),sbuf_len);
1759 1756
1760 if (i <= 0) 1757 if (i <= 0)
@@ -1885,9 +1882,6 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
1885 { 1882 {
1886 cbuf_len=i; 1883 cbuf_len=i;
1887 cbuf_off=0; 1884 cbuf_off=0;
1888#ifdef CHARSET_EBCDIC
1889 ebcdic2ascii(cbuf, cbuf, i);
1890#endif
1891 } 1885 }
1892 1886
1893 write_ssl=1; 1887 write_ssl=1;
diff --git a/src/lib/libssl/src/apps/s_server.c b/src/lib/libssl/src/apps/s_server.c
index 53da15da23..de54aa6abd 100644
--- a/src/lib/libssl/src/apps/s_server.c
+++ b/src/lib/libssl/src/apps/s_server.c
@@ -567,156 +567,6 @@ static void sv_usage(void)
567static int local_argc=0; 567static int local_argc=0;
568static char **local_argv; 568static char **local_argv;
569 569
570#ifdef CHARSET_EBCDIC
571static int ebcdic_new(BIO *bi);
572static int ebcdic_free(BIO *a);
573static int ebcdic_read(BIO *b, char *out, int outl);
574static int ebcdic_write(BIO *b, const char *in, int inl);
575static long ebcdic_ctrl(BIO *b, int cmd, long num, void *ptr);
576static int ebcdic_gets(BIO *bp, char *buf, int size);
577static int ebcdic_puts(BIO *bp, const char *str);
578
579#define BIO_TYPE_EBCDIC_FILTER (18|0x0200)
580static BIO_METHOD methods_ebcdic=
581 {
582 BIO_TYPE_EBCDIC_FILTER,
583 "EBCDIC/ASCII filter",
584 ebcdic_write,
585 ebcdic_read,
586 ebcdic_puts,
587 ebcdic_gets,
588 ebcdic_ctrl,
589 ebcdic_new,
590 ebcdic_free,
591 };
592
593typedef struct
594{
595 size_t alloced;
596 char buff[1];
597} EBCDIC_OUTBUFF;
598
599BIO_METHOD *BIO_f_ebcdic_filter()
600{
601 return(&methods_ebcdic);
602}
603
604static int ebcdic_new(BIO *bi)
605{
606 EBCDIC_OUTBUFF *wbuf;
607
608 wbuf = (EBCDIC_OUTBUFF *)OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + 1024);
609 wbuf->alloced = 1024;
610 wbuf->buff[0] = '\0';
611
612 bi->ptr=(char *)wbuf;
613 bi->init=1;
614 bi->flags=0;
615 return(1);
616}
617
618static int ebcdic_free(BIO *a)
619{
620 if (a == NULL) return(0);
621 if (a->ptr != NULL)
622 OPENSSL_free(a->ptr);
623 a->ptr=NULL;
624 a->init=0;
625 a->flags=0;
626 return(1);
627}
628
629static int ebcdic_read(BIO *b, char *out, int outl)
630{
631 int ret=0;
632
633 if (out == NULL || outl == 0) return(0);
634 if (b->next_bio == NULL) return(0);
635
636 ret=BIO_read(b->next_bio,out,outl);
637 if (ret > 0)
638 ascii2ebcdic(out,out,ret);
639 return(ret);
640}
641
642static int ebcdic_write(BIO *b, const char *in, int inl)
643{
644 EBCDIC_OUTBUFF *wbuf;
645 int ret=0;
646 int num;
647 unsigned char n;
648
649 if ((in == NULL) || (inl <= 0)) return(0);
650 if (b->next_bio == NULL) return(0);
651
652 wbuf=(EBCDIC_OUTBUFF *)b->ptr;
653
654 if (inl > (num = wbuf->alloced))
655 {
656 num = num + num; /* double the size */
657 if (num < inl)
658 num = inl;
659 OPENSSL_free(wbuf);
660 wbuf=(EBCDIC_OUTBUFF *)OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + num);
661
662 wbuf->alloced = num;
663 wbuf->buff[0] = '\0';
664
665 b->ptr=(char *)wbuf;
666 }
667
668 ebcdic2ascii(wbuf->buff, in, inl);
669
670 ret=BIO_write(b->next_bio, wbuf->buff, inl);
671
672 return(ret);
673}
674
675static long ebcdic_ctrl(BIO *b, int cmd, long num, void *ptr)
676{
677 long ret;
678
679 if (b->next_bio == NULL) return(0);
680 switch (cmd)
681 {
682 case BIO_CTRL_DUP:
683 ret=0L;
684 break;
685 default:
686 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
687 break;
688 }
689 return(ret);
690}
691
692static int ebcdic_gets(BIO *bp, char *buf, int size)
693{
694 int i, ret=0;
695 if (bp->next_bio == NULL) return(0);
696/* return(BIO_gets(bp->next_bio,buf,size));*/
697 for (i=0; i<size-1; ++i)
698 {
699 ret = ebcdic_read(bp,&buf[i],1);
700 if (ret <= 0)
701 break;
702 else if (buf[i] == '\n')
703 {
704 ++i;
705 break;
706 }
707 }
708 if (i < size)
709 buf[i] = '\0';
710 return (ret < 0 && i == 0) ? ret : i;
711}
712
713static int ebcdic_puts(BIO *bp, const char *str)
714{
715 if (bp->next_bio == NULL) return(0);
716 return ebcdic_write(bp, str, strlen(str));
717}
718#endif
719
720#ifndef OPENSSL_NO_TLSEXT 570#ifndef OPENSSL_NO_TLSEXT
721 571
722/* This is a context that we pass to callbacks */ 572/* This is a context that we pass to callbacks */
@@ -2231,9 +2081,6 @@ static int sv_body(char *hostname, int s, unsigned char *context)
2231 print_stats(bio_s_out,SSL_get_SSL_CTX(con)); 2081 print_stats(bio_s_out,SSL_get_SSL_CTX(con));
2232 } 2082 }
2233 } 2083 }
2234#ifdef CHARSET_EBCDIC
2235 ebcdic2ascii(buf,buf,i);
2236#endif
2237 l=k=0; 2084 l=k=0;
2238 for (;;) 2085 for (;;)
2239 { 2086 {
@@ -2316,9 +2163,6 @@ again:
2316 switch (SSL_get_error(con,i)) 2163 switch (SSL_get_error(con,i))
2317 { 2164 {
2318 case SSL_ERROR_NONE: 2165 case SSL_ERROR_NONE:
2319#ifdef CHARSET_EBCDIC
2320 ascii2ebcdic(buf,buf,i);
2321#endif
2322 raw_write_stdout(buf, 2166 raw_write_stdout(buf,
2323 (unsigned int)i); 2167 (unsigned int)i);
2324 if (SSL_pending(con)) goto again; 2168 if (SSL_pending(con)) goto again;
@@ -2612,9 +2456,6 @@ static int www_body(char *hostname, int s, unsigned char *context)
2612 /* SSL_set_fd(con,s); */ 2456 /* SSL_set_fd(con,s); */
2613 BIO_set_ssl(ssl_bio,con,BIO_CLOSE); 2457 BIO_set_ssl(ssl_bio,con,BIO_CLOSE);
2614 BIO_push(io,ssl_bio); 2458 BIO_push(io,ssl_bio);
2615#ifdef CHARSET_EBCDIC
2616 io = BIO_push(BIO_new(BIO_f_ebcdic_filter()),io);
2617#endif
2618 2459
2619 if (s_debug) 2460 if (s_debug)
2620 { 2461 {
diff --git a/src/lib/libssl/src/crypto/Makefile b/src/lib/libssl/src/crypto/Makefile
index aa105e37a2..326915d520 100644
--- a/src/lib/libssl/src/crypto/Makefile
+++ b/src/lib/libssl/src/crypto/Makefile
@@ -35,13 +35,13 @@ GENERAL=Makefile README crypto-lib.com install.com
35LIB= $(TOP)/libcrypto.a 35LIB= $(TOP)/libcrypto.a
36SHARED_LIB= libcrypto$(SHLIB_EXT) 36SHARED_LIB= libcrypto$(SHLIB_EXT)
37LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c \ 37LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
38 ebcdic.c uid.c o_time.c o_str.c o_dir.c o_fips.c o_init.c fips_ers.c 38 uid.c o_time.c o_str.c o_dir.c o_fips.c o_init.c fips_ers.c
39LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o ebcdic.o \ 39LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o \
40 uid.o o_time.o o_str.o o_dir.o o_fips.o o_init.o fips_ers.o $(CPUID_OBJ) 40 uid.o o_time.o o_str.o o_dir.o o_fips.o o_init.o fips_ers.o $(CPUID_OBJ)
41 41
42SRC= $(LIBSRC) 42SRC= $(LIBSRC)
43 43
44EXHEADER= crypto.h opensslv.h opensslconf.h ebcdic.h symhacks.h \ 44EXHEADER= crypto.h opensslv.h opensslconf.h symhacks.h \
45 ossl_typ.h 45 ossl_typ.h
46HEADER= cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(EXHEADER) 46HEADER= cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(EXHEADER)
47 47
diff --git a/src/lib/libssl/src/crypto/asn1/a_gentm.c b/src/lib/libssl/src/crypto/asn1/a_gentm.c
index 04266e790a..4f312ee6c9 100644
--- a/src/lib/libssl/src/crypto/asn1/a_gentm.c
+++ b/src/lib/libssl/src/crypto/asn1/a_gentm.c
@@ -68,18 +68,6 @@
68 68
69int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp) 69int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp)
70 { 70 {
71#ifdef CHARSET_EBCDIC
72 /* KLUDGE! We convert to ascii before writing DER */
73 int len;
74 char tmp[24];
75 ASN1_STRING tmpstr = *(ASN1_STRING *)a;
76
77 len = tmpstr.length;
78 ebcdic2ascii(tmp, tmpstr.data, (len >= sizeof tmp) ? sizeof tmp : len);
79 tmpstr.data = tmp;
80
81 a = (ASN1_GENERALIZEDTIME *) &tmpstr;
82#endif
83 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, 71 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
84 V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL)); 72 V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL));
85 } 73 }
@@ -97,9 +85,6 @@ ASN1_GENERALIZEDTIME *d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a,
97 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ERR_R_NESTED_ASN1_ERROR); 85 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ERR_R_NESTED_ASN1_ERROR);
98 return(NULL); 86 return(NULL);
99 } 87 }
100#ifdef CHARSET_EBCDIC
101 ascii2ebcdic(ret->data, ret->data, ret->length);
102#endif
103 if (!ASN1_GENERALIZEDTIME_check(ret)) 88 if (!ASN1_GENERALIZEDTIME_check(ret))
104 { 89 {
105 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ASN1_R_INVALID_TIME_FORMAT); 90 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ASN1_R_INVALID_TIME_FORMAT);
@@ -256,8 +241,5 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
256 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); 241 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
257 s->length=strlen(p); 242 s->length=strlen(p);
258 s->type=V_ASN1_GENERALIZEDTIME; 243 s->type=V_ASN1_GENERALIZEDTIME;
259#ifdef CHARSET_EBCDIC_not
260 ebcdic2ascii(s->data, s->data, s->length);
261#endif
262 return(s); 244 return(s);
263 } 245 }
diff --git a/src/lib/libssl/src/crypto/asn1/a_mbstr.c b/src/lib/libssl/src/crypto/asn1/a_mbstr.c
index 264d8f677f..dc953c8325 100644
--- a/src/lib/libssl/src/crypto/asn1/a_mbstr.c
+++ b/src/lib/libssl/src/crypto/asn1/a_mbstr.c
@@ -385,16 +385,9 @@ static int is_printable(unsigned long value)
385 /* Note: we can't use 'isalnum' because certain accented 385 /* Note: we can't use 'isalnum' because certain accented
386 * characters may count as alphanumeric in some environments. 386 * characters may count as alphanumeric in some environments.
387 */ 387 */
388#ifndef CHARSET_EBCDIC
389 if((ch >= 'a') && (ch <= 'z')) return 1; 388 if((ch >= 'a') && (ch <= 'z')) return 1;
390 if((ch >= 'A') && (ch <= 'Z')) return 1; 389 if((ch >= 'A') && (ch <= 'Z')) return 1;
391 if((ch >= '0') && (ch <= '9')) return 1; 390 if((ch >= '0') && (ch <= '9')) return 1;
392 if ((ch == ' ') || strchr("'()+,-./:=?", ch)) return 1; 391 if ((ch == ' ') || strchr("'()+,-./:=?", ch)) return 1;
393#else /*CHARSET_EBCDIC*/
394 if((ch >= os_toascii['a']) && (ch <= os_toascii['z'])) return 1;
395 if((ch >= os_toascii['A']) && (ch <= os_toascii['Z'])) return 1;
396 if((ch >= os_toascii['0']) && (ch <= os_toascii['9'])) return 1;
397 if ((ch == os_toascii[' ']) || strchr("'()+,-./:=?", os_toebcdic[ch])) return 1;
398#endif /*CHARSET_EBCDIC*/
399 return 0; 392 return 0;
400} 393}
diff --git a/src/lib/libssl/src/crypto/asn1/a_print.c b/src/lib/libssl/src/crypto/asn1/a_print.c
index d18e772320..9eec5034e1 100644
--- a/src/lib/libssl/src/crypto/asn1/a_print.c
+++ b/src/lib/libssl/src/crypto/asn1/a_print.c
@@ -72,7 +72,6 @@ int ASN1_PRINTABLE_type(const unsigned char *s, int len)
72 while ((*s) && (len-- != 0)) 72 while ((*s) && (len-- != 0))
73 { 73 {
74 c= *(s++); 74 c= *(s++);
75#ifndef CHARSET_EBCDIC
76 if (!( ((c >= 'a') && (c <= 'z')) || 75 if (!( ((c >= 'a') && (c <= 'z')) ||
77 ((c >= 'A') && (c <= 'Z')) || 76 ((c >= 'A') && (c <= 'Z')) ||
78 (c == ' ') || 77 (c == ' ') ||
@@ -86,13 +85,6 @@ int ASN1_PRINTABLE_type(const unsigned char *s, int len)
86 ia5=1; 85 ia5=1;
87 if (c&0x80) 86 if (c&0x80)
88 t61=1; 87 t61=1;
89#else
90 if (!isalnum(c) && (c != ' ') &&
91 strchr("'()+,-./:=?", c) == NULL)
92 ia5=1;
93 if (os_toascii[c] & 0x80)
94 t61=1;
95#endif
96 } 88 }
97 if (t61) return(V_ASN1_T61STRING); 89 if (t61) return(V_ASN1_T61STRING);
98 if (ia5) return(V_ASN1_IA5STRING); 90 if (ia5) return(V_ASN1_IA5STRING);
diff --git a/src/lib/libssl/src/crypto/asn1/a_time.c b/src/lib/libssl/src/crypto/asn1/a_time.c
index e2eb9b243e..4ade88f065 100644
--- a/src/lib/libssl/src/crypto/asn1/a_time.c
+++ b/src/lib/libssl/src/crypto/asn1/a_time.c
@@ -74,21 +74,6 @@ IMPLEMENT_ASN1_FUNCTIONS(ASN1_TIME)
74#if 0 74#if 0
75int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp) 75int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **pp)
76 { 76 {
77#ifdef CHARSET_EBCDIC
78 /* KLUDGE! We convert to ascii before writing DER */
79 char tmp[24];
80 ASN1_STRING tmpstr;
81
82 if(a->type == V_ASN1_UTCTIME || a->type == V_ASN1_GENERALIZEDTIME) {
83 int len;
84
85 tmpstr = *(ASN1_STRING *)a;
86 len = tmpstr.length;
87 ebcdic2ascii(tmp, tmpstr.data, (len >= sizeof tmp) ? sizeof tmp : len);
88 tmpstr.data = tmp;
89 a = (ASN1_GENERALIZEDTIME *) &tmpstr;
90 }
91#endif
92 if(a->type == V_ASN1_UTCTIME || a->type == V_ASN1_GENERALIZEDTIME) 77 if(a->type == V_ASN1_UTCTIME || a->type == V_ASN1_GENERALIZEDTIME)
93 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, 78 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
94 a->type ,V_ASN1_UNIVERSAL)); 79 a->type ,V_ASN1_UNIVERSAL));
diff --git a/src/lib/libssl/src/crypto/asn1/a_utctm.c b/src/lib/libssl/src/crypto/asn1/a_utctm.c
index 615395b738..f2e7de16af 100644
--- a/src/lib/libssl/src/crypto/asn1/a_utctm.c
+++ b/src/lib/libssl/src/crypto/asn1/a_utctm.c
@@ -65,20 +65,8 @@
65#if 0 65#if 0
66int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp) 66int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp)
67 { 67 {
68#ifndef CHARSET_EBCDIC
69 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, 68 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
70 V_ASN1_UTCTIME,V_ASN1_UNIVERSAL)); 69 V_ASN1_UTCTIME,V_ASN1_UNIVERSAL));
71#else
72 /* KLUDGE! We convert to ascii before writing DER */
73 int len;
74 char tmp[24];
75 ASN1_STRING x = *(ASN1_STRING *)a;
76
77 len = x.length;
78 ebcdic2ascii(tmp, x.data, (len >= sizeof tmp) ? sizeof tmp : len);
79 x.data = tmp;
80 return i2d_ASN1_bytes(&x, pp, V_ASN1_UTCTIME,V_ASN1_UNIVERSAL);
81#endif
82 } 70 }
83 71
84 72
@@ -94,9 +82,6 @@ ASN1_UTCTIME *d2i_ASN1_UTCTIME(ASN1_UTCTIME **a, unsigned char **pp,
94 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ERR_R_NESTED_ASN1_ERROR); 82 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ERR_R_NESTED_ASN1_ERROR);
95 return(NULL); 83 return(NULL);
96 } 84 }
97#ifdef CHARSET_EBCDIC
98 ascii2ebcdic(ret->data, ret->data, ret->length);
99#endif
100 if (!ASN1_UTCTIME_check(ret)) 85 if (!ASN1_UTCTIME_check(ret))
101 { 86 {
102 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_INVALID_TIME_FORMAT); 87 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_INVALID_TIME_FORMAT);
@@ -233,9 +218,6 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
233 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); 218 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
234 s->length=strlen(p); 219 s->length=strlen(p);
235 s->type=V_ASN1_UTCTIME; 220 s->type=V_ASN1_UTCTIME;
236#ifdef CHARSET_EBCDIC_not
237 ebcdic2ascii(s->data, s->data, s->length);
238#endif
239 return(s); 221 return(s);
240 } 222 }
241 223
diff --git a/src/lib/libssl/src/crypto/asn1/f_int.c b/src/lib/libssl/src/crypto/asn1/f_int.c
index 9494e597ab..8b92fad9df 100644
--- a/src/lib/libssl/src/crypto/asn1/f_int.c
+++ b/src/lib/libssl/src/crypto/asn1/f_int.c
@@ -123,18 +123,9 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
123 123
124 for (j=0; j<i; j++) 124 for (j=0; j<i; j++)
125 { 125 {
126#ifndef CHARSET_EBCDIC
127 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) || 126 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) ||
128 ((buf[j] >= 'a') && (buf[j] <= 'f')) || 127 ((buf[j] >= 'a') && (buf[j] <= 'f')) ||
129 ((buf[j] >= 'A') && (buf[j] <= 'F')))) 128 ((buf[j] >= 'A') && (buf[j] <= 'F'))))
130#else
131 /* This #ifdef is not strictly necessary, since
132 * the characters A...F a...f 0...9 are contiguous
133 * (yes, even in EBCDIC - but not the whole alphabet).
134 * Nevertheless, isxdigit() is faster.
135 */
136 if (!isxdigit(buf[j]))
137#endif
138 { 129 {
139 i=j; 130 i=j;
140 break; 131 break;
diff --git a/src/lib/libssl/src/crypto/asn1/f_string.c b/src/lib/libssl/src/crypto/asn1/f_string.c
index 968698a798..f7d36adac7 100644
--- a/src/lib/libssl/src/crypto/asn1/f_string.c
+++ b/src/lib/libssl/src/crypto/asn1/f_string.c
@@ -123,18 +123,9 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
123 123
124 for (j=i-1; j>0; j--) 124 for (j=i-1; j>0; j--)
125 { 125 {
126#ifndef CHARSET_EBCDIC
127 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) || 126 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) ||
128 ((buf[j] >= 'a') && (buf[j] <= 'f')) || 127 ((buf[j] >= 'a') && (buf[j] <= 'f')) ||
129 ((buf[j] >= 'A') && (buf[j] <= 'F')))) 128 ((buf[j] >= 'A') && (buf[j] <= 'F'))))
130#else
131 /* This #ifdef is not strictly necessary, since
132 * the characters A...F a...f 0...9 are contiguous
133 * (yes, even in EBCDIC - but not the whole alphabet).
134 * Nevertheless, isxdigit() is faster.
135 */
136 if (!isxdigit(buf[j]))
137#endif
138 { 129 {
139 i=j; 130 i=j;
140 break; 131 break;
diff --git a/src/lib/libssl/src/crypto/asn1/t_x509.c b/src/lib/libssl/src/crypto/asn1/t_x509.c
index edbb39a02f..bbf00c7a29 100644
--- a/src/lib/libssl/src/crypto/asn1/t_x509.c
+++ b/src/lib/libssl/src/crypto/asn1/t_x509.c
@@ -485,7 +485,6 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
485 c=s; 485 c=s;
486 for (;;) 486 for (;;)
487 { 487 {
488#ifndef CHARSET_EBCDIC
489 if ( ((*s == '/') && 488 if ( ((*s == '/') &&
490 ((s[1] >= 'A') && (s[1] <= 'Z') && ( 489 ((s[1] >= 'A') && (s[1] <= 'Z') && (
491 (s[2] == '=') || 490 (s[2] == '=') ||
@@ -493,15 +492,6 @@ int X509_NAME_print(BIO *bp, X509_NAME *name, int obase)
493 (s[3] == '=')) 492 (s[3] == '='))
494 ))) || 493 ))) ||
495 (*s == '\0')) 494 (*s == '\0'))
496#else
497 if ( ((*s == '/') &&
498 (isupper(s[1]) && (
499 (s[2] == '=') ||
500 (isupper(s[2]) &&
501 (s[3] == '='))
502 ))) ||
503 (*s == '\0'))
504#endif
505 { 495 {
506 i=s-c; 496 i=s-c;
507 if (BIO_write(bp,c,i) != i) goto err; 497 if (BIO_write(bp,c,i) != i) goto err;
diff --git a/src/lib/libssl/src/crypto/bf/bftest.c b/src/lib/libssl/src/crypto/bf/bftest.c
index 97e6634d37..20caf0f3f8 100644
--- a/src/lib/libssl/src/crypto/bf/bftest.c
+++ b/src/lib/libssl/src/crypto/bf/bftest.c
@@ -75,10 +75,6 @@ int main(int argc, char *argv[])
75#else 75#else
76#include <openssl/blowfish.h> 76#include <openssl/blowfish.h>
77 77
78#ifdef CHARSET_EBCDIC
79#include <openssl/ebcdic.h>
80#endif
81
82static char *bf_key[2]={ 78static char *bf_key[2]={
83 "abcdefghijklmnopqrstuvwxyz", 79 "abcdefghijklmnopqrstuvwxyz",
84 "Who is John Galt?" 80 "Who is John Galt?"
@@ -361,16 +357,9 @@ static int test(void)
361 unsigned char out[8]; 357 unsigned char out[8];
362 BF_LONG len; 358 BF_LONG len;
363 359
364#ifdef CHARSET_EBCDIC
365 ebcdic2ascii(cbc_data, cbc_data, strlen(cbc_data));
366#endif
367
368 printf("testing blowfish in raw ecb mode\n"); 360 printf("testing blowfish in raw ecb mode\n");
369 for (n=0; n<2; n++) 361 for (n=0; n<2; n++)
370 { 362 {
371#ifdef CHARSET_EBCDIC
372 ebcdic2ascii(bf_key[n], bf_key[n], strlen(bf_key[n]));
373#endif
374 BF_set_key(&key,strlen(bf_key[n]),(unsigned char *)bf_key[n]); 363 BF_set_key(&key,strlen(bf_key[n]),(unsigned char *)bf_key[n]);
375 364
376 data[0]=bf_plain[n][0]; 365 data[0]=bf_plain[n][0];
diff --git a/src/lib/libssl/src/crypto/bio/b_dump.c b/src/lib/libssl/src/crypto/bio/b_dump.c
index bea94969a2..32d523563e 100644
--- a/src/lib/libssl/src/crypto/bio/b_dump.c
+++ b/src/lib/libssl/src/crypto/bio/b_dump.c
@@ -125,14 +125,8 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),
125 if (((i*dump_width) + j) >= len) 125 if (((i*dump_width) + j) >= len)
126 break; 126 break;
127 ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff; 127 ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff;
128#ifndef CHARSET_EBCDIC
129 (void) snprintf(tmp, sizeof tmp, "%c", 128 (void) snprintf(tmp, sizeof tmp, "%c",
130 ((ch >= ' ') && (ch <= '~')) ? ch : '.'); 129 ((ch >= ' ') && (ch <= '~')) ? ch : '.');
131#else
132 (void) snprintf(tmp, sizeof tmp, "%c",
133 ((ch >= os_toascii[' ']) && (ch <= os_toascii['~']))
134 ? os_toebcdic[ch] : '.');
135#endif
136 BUF_strlcat(buf, tmp, sizeof buf); 130 BUF_strlcat(buf, tmp, sizeof buf);
137 } 131 }
138 BUF_strlcat(buf, "\n", sizeof buf); 132 BUF_strlcat(buf, "\n", sizeof buf);
diff --git a/src/lib/libssl/src/crypto/conf/conf_def.h b/src/lib/libssl/src/crypto/conf/conf_def.h
index 92a7d8ad77..b18e6e2728 100644
--- a/src/lib/libssl/src/crypto/conf/conf_def.h
+++ b/src/lib/libssl/src/crypto/conf/conf_def.h
@@ -78,7 +78,6 @@
78 CONF_PUNCTUATION) 78 CONF_PUNCTUATION)
79 79
80#define KEYTYPES(c) ((unsigned short *)((c)->meth_data)) 80#define KEYTYPES(c) ((unsigned short *)((c)->meth_data))
81#ifndef CHARSET_EBCDIC
82#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT) 81#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
83#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT) 82#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
84#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF) 83#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
@@ -92,22 +91,6 @@
92#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE) 91#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
93#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT) 92#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
94 93
95#else /*CHARSET_EBCDIC*/
96
97#define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_COMMENT)
98#define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_FCOMMENT)
99#define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_EOF)
100#define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ESC)
101#define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_NUMBER)
102#define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_WS)
103#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC)
104#define IS_ALPHA_NUMERIC_PUNCT(c,a) \
105 (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
106#define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_QUOTE)
107#define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_DQUOTE)
108#define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_HIGHBIT)
109#endif /*CHARSET_EBCDIC*/
110
111static unsigned short CONF_type_default[256]={ 94static unsigned short CONF_type_default[256]={
112 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 95 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
113 0x0000,0x0010,0x0010,0x0000,0x0000,0x0010,0x0000,0x0000, 96 0x0000,0x0010,0x0010,0x0000,0x0000,0x0010,0x0000,0x0000,
diff --git a/src/lib/libssl/src/crypto/conf/keysets.pl b/src/lib/libssl/src/crypto/conf/keysets.pl
index 50ed67fa52..fe17be57fe 100644
--- a/src/lib/libssl/src/crypto/conf/keysets.pl
+++ b/src/lib/libssl/src/crypto/conf/keysets.pl
@@ -132,7 +132,6 @@ print <<"EOF";
132 CONF_PUNCTUATION) 132 CONF_PUNCTUATION)
133 133
134#define KEYTYPES(c) ((unsigned short *)((c)->meth_data)) 134#define KEYTYPES(c) ((unsigned short *)((c)->meth_data))
135#ifndef CHARSET_EBCDIC
136#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT) 135#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
137#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT) 136#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
138#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF) 137#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
@@ -146,21 +145,6 @@ print <<"EOF";
146#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE) 145#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
147#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT) 146#define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
148 147
149#else /*CHARSET_EBCDIC*/
150
151#define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_COMMENT)
152#define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_FCOMMENT)
153#define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_EOF)
154#define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ESC)
155#define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_NUMBER)
156#define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_WS)
157#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC)
158#define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
159 (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
160#define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_QUOTE)
161#define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_DQUOTE)
162#define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a]&0xff]&CONF_HIGHBIT)
163#endif /*CHARSET_EBCDIC*/
164 148
165EOF 149EOF
166 150
diff --git a/src/lib/libssl/src/crypto/crypto.h b/src/lib/libssl/src/crypto/crypto.h
index baeba25b99..351ccfd35b 100644
--- a/src/lib/libssl/src/crypto/crypto.h
+++ b/src/lib/libssl/src/crypto/crypto.h
@@ -130,10 +130,6 @@
130#include <openssl/opensslv.h> 130#include <openssl/opensslv.h>
131#include <openssl/ossl_typ.h> 131#include <openssl/ossl_typ.h>
132 132
133#ifdef CHARSET_EBCDIC
134#include <openssl/ebcdic.h>
135#endif
136
137#ifdef __cplusplus 133#ifdef __cplusplus
138extern "C" { 134extern "C" {
139#endif 135#endif
diff --git a/src/lib/libssl/src/crypto/des/fcrypt.c b/src/lib/libssl/src/crypto/des/fcrypt.c
index ccbdff250f..d02189b290 100644
--- a/src/lib/libssl/src/crypto/des/fcrypt.c
+++ b/src/lib/libssl/src/crypto/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;
diff --git a/src/lib/libssl/src/crypto/ebcdic.c b/src/lib/libssl/src/crypto/ebcdic.c
deleted file mode 100644
index 2ac26abc72..0000000000
--- a/src/lib/libssl/src/crypto/ebcdic.c
+++ /dev/null
@@ -1,221 +0,0 @@
1/* crypto/ebcdic.c */
2
3#ifndef CHARSET_EBCDIC
4
5#include <openssl/e_os2.h>
6#if defined(PEDANTIC) || defined(__DECC) || defined(OPENSSL_SYS_MACOSX)
7static void *dummy = &dummy;
8#endif
9
10#else /*CHARSET_EBCDIC*/
11
12#include "ebcdic.h"
13/* Initial Port for Apache-1.3 by <Martin.Kraemer@Mch.SNI.De>
14 * Adapted for OpenSSL-0.9.4 by <Martin.Kraemer@Mch.SNI.De>
15 */
16
17#ifdef _OSD_POSIX
18/*
19 "BS2000 OSD" is a POSIX subsystem on a main frame.
20 It is made by Siemens AG, Germany, for their BS2000 mainframe machines.
21 Within the POSIX subsystem, the same character set was chosen as in
22 "native BS2000", namely EBCDIC. (EDF04)
23
24 The name "ASCII" in these routines is misleading: actually, conversion
25 is not between EBCDIC and ASCII, but EBCDIC(EDF04) and ISO-8859.1;
26 that means that (western european) national characters are preserved.
27
28 This table is identical to the one used by rsh/rcp/ftp and other POSIX tools.
29*/
30
31/* Here's the bijective ebcdic-to-ascii table: */
32const unsigned char os_toascii[256] = {
33/*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f,
34 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
35/*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97,
36 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
37/*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b,
38 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................*/
39/*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
40 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................*/
41/*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
42 0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|*/
43/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
44 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);.*/
45/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
46 0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /*-/........^,%_>?*/
47/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
48 0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'="*/
49/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
50 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi......*/
51/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
52 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr......*/
53/*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
54 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz......*/
55/*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
56 0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\]..*/
57/*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
58 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI......*/
59/*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
60 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR......*/
61/*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
62 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ......*/
63/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
64 0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e /*0123456789.{.}.~*/
65};
66
67
68/* The ascii-to-ebcdic table: */
69const unsigned char os_toebcdic[256] = {
70/*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
71 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
72/*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
73 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
74/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
75 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
76/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
77 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/
78/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
79 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/
80/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
81 0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/
82/*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
83 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/
84/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
85 0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/
86/*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
87 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/
88/*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
89 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/
90/*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
91 0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/
92/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
93 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/
94/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
95 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/
96/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
97 0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/
98/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
99 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/
100/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
101 0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/
102};
103
104#else /*_OSD_POSIX*/
105
106/*
107This code does basic character mapping for IBM's TPF and OS/390 operating systems.
108It is a modified version of the BS2000 table.
109
110Bijective EBCDIC (character set IBM-1047) to US-ASCII table:
111This table is bijective - there are no ambigous or duplicate characters.
112*/
113const unsigned char os_toascii[256] = {
114 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */
115 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
116 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */
117 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
118 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */
119 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */
120 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */
121 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */
122 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */
123 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */
124 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */
125 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */
126 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */
127 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */
128 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */
129 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */
130 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */
131 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */
132 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */
133 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */
134 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */
135 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */
136 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */
137 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */
138 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */
139 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */
140 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */
141 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */
142 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */
143 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */
144 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */
145 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */
146};
147
148
149/*
150The US-ASCII to EBCDIC (character set IBM-1047) table:
151This table is bijective (no ambiguous or duplicate characters)
152*/
153const unsigned char os_toebcdic[256] = {
154 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f: */
155 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
156 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f: */
157 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
158 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f: */
159 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
160 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f: */
161 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */
162 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f: */
163 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */
164 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f: */
165 0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */
166 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f: */
167 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */
168 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f: */
169 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */
170 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f: */
171 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */
172 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f: */
173 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */
174 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af: */
175 0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */
176 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf: */
177 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */
178 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf: */
179 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */
180 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df: */
181 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */
182 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef: */
183 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */
184 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff: */
185 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /* ................ */
186};
187#endif /*_OSD_POSIX*/
188
189/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset)
190 * dest and srce may be identical, or separate memory blocks, but
191 * should not overlap. These functions intentionally have an interface
192 * compatible to memcpy(3).
193 */
194
195void *
196ebcdic2ascii(void *dest, const void *srce, size_t count)
197{
198 unsigned char *udest = dest;
199 const unsigned char *usrce = srce;
200
201 while (count-- != 0) {
202 *udest++ = os_toascii[*usrce++];
203 }
204
205 return dest;
206}
207
208void *
209ascii2ebcdic(void *dest, const void *srce, size_t count)
210{
211 unsigned char *udest = dest;
212 const unsigned char *usrce = srce;
213
214 while (count-- != 0) {
215 *udest++ = os_toebcdic[*usrce++];
216 }
217
218 return dest;
219}
220
221#endif
diff --git a/src/lib/libssl/src/crypto/ebcdic.h b/src/lib/libssl/src/crypto/ebcdic.h
deleted file mode 100644
index 6d65afcf9e..0000000000
--- a/src/lib/libssl/src/crypto/ebcdic.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/* crypto/ebcdic.h */
2
3#ifndef HEADER_EBCDIC_H
4#define HEADER_EBCDIC_H
5
6#include <sys/types.h>
7
8/* Avoid name clashes with other applications */
9#define os_toascii _openssl_os_toascii
10#define os_toebcdic _openssl_os_toebcdic
11#define ebcdic2ascii _openssl_ebcdic2ascii
12#define ascii2ebcdic _openssl_ascii2ebcdic
13
14extern const unsigned char os_toascii[256];
15extern const unsigned char os_toebcdic[256];
16void *ebcdic2ascii(void *dest, const void *srce, size_t count);
17void *ascii2ebcdic(void *dest, const void *srce, size_t count);
18
19#endif
diff --git a/src/lib/libssl/src/crypto/evp/encode.c b/src/lib/libssl/src/crypto/evp/encode.c
index 28546a84bc..7af9a2780b 100644
--- a/src/lib/libssl/src/crypto/evp/encode.c
+++ b/src/lib/libssl/src/crypto/evp/encode.c
@@ -60,19 +60,8 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62 62
63#ifndef CHARSET_EBCDIC
64#define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f]) 63#define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f])
65#define conv_ascii2bin(a) (data_ascii2bin[(a)&0x7f]) 64#define conv_ascii2bin(a) (data_ascii2bin[(a)&0x7f])
66#else
67/* We assume that PEM encoded files are EBCDIC files
68 * (i.e., printable text files). Convert them here while decoding.
69 * When encoding, output is EBCDIC (text) format again.
70 * (No need for conversion in the conv_bin2ascii macro, as the
71 * underlying textstring data_bin2ascii[] is already EBCDIC)
72 */
73#define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f])
74#define conv_ascii2bin(a) (data_ascii2bin[os_toascii[a]&0x7f])
75#endif
76 65
77/* 64 char lines 66/* 64 char lines
78 * pad input with 0 67 * pad input with 0
diff --git a/src/lib/libssl/src/crypto/hmac/hmactest.c b/src/lib/libssl/src/crypto/hmac/hmactest.c
index 1b906b81af..282e06e53e 100644
--- a/src/lib/libssl/src/crypto/hmac/hmactest.c
+++ b/src/lib/libssl/src/crypto/hmac/hmactest.c
@@ -74,9 +74,6 @@ int main(int argc, char *argv[])
74#include <openssl/md5.h> 74#include <openssl/md5.h>
75#endif 75#endif
76 76
77#ifdef CHARSET_EBCDIC
78#include <openssl/ebcdic.h>
79#endif
80 77
81#ifndef OPENSSL_NO_MD5 78#ifndef OPENSSL_NO_MD5
82static struct test_st 79static struct test_st
@@ -132,14 +129,6 @@ int main(int argc, char *argv[])
132#ifdef OPENSSL_NO_MD5 129#ifdef OPENSSL_NO_MD5
133 printf("test skipped: MD5 disabled\n"); 130 printf("test skipped: MD5 disabled\n");
134#else 131#else
135
136#ifdef CHARSET_EBCDIC
137 ebcdic2ascii(test[0].data, test[0].data, test[0].data_len);
138 ebcdic2ascii(test[1].data, test[1].data, test[1].data_len);
139 ebcdic2ascii(test[2].key, test[2].key, test[2].key_len);
140 ebcdic2ascii(test[2].data, test[2].data, test[2].data_len);
141#endif
142
143 for (i=0; i<4; i++) 132 for (i=0; i<4; i++)
144 { 133 {
145 p=pt(HMAC(EVP_md5(), 134 p=pt(HMAC(EVP_md5(),
diff --git a/src/lib/libssl/src/crypto/md2/md2_one.c b/src/lib/libssl/src/crypto/md2/md2_one.c
index f7fef5cc0a..cb8594e085 100644
--- a/src/lib/libssl/src/crypto/md2/md2_one.c
+++ b/src/lib/libssl/src/crypto/md2/md2_one.c
@@ -71,23 +71,7 @@ unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md)
71 if (md == NULL) md=m; 71 if (md == NULL) md=m;
72 if (!MD2_Init(&c)) 72 if (!MD2_Init(&c))
73 return NULL; 73 return NULL;
74#ifndef CHARSET_EBCDIC
75 MD2_Update(&c,d,n); 74 MD2_Update(&c,d,n);
76#else
77 {
78 char temp[1024];
79 unsigned long chunk;
80
81 while (n > 0)
82 {
83 chunk = (n > sizeof(temp)) ? sizeof(temp) : n;
84 ebcdic2ascii(temp, d, chunk);
85 MD2_Update(&c,temp,chunk);
86 n -= chunk;
87 d += chunk;
88 }
89 }
90#endif
91 MD2_Final(md,&c); 75 MD2_Final(md,&c);
92 OPENSSL_cleanse(&c,sizeof(c)); /* Security consideration */ 76 OPENSSL_cleanse(&c,sizeof(c)); /* Security consideration */
93 return(md); 77 return(md);
diff --git a/src/lib/libssl/src/crypto/md2/md2test.c b/src/lib/libssl/src/crypto/md2/md2test.c
index db5f5bc6d2..0195214036 100644
--- a/src/lib/libssl/src/crypto/md2/md2test.c
+++ b/src/lib/libssl/src/crypto/md2/md2test.c
@@ -72,10 +72,6 @@ int main(int argc, char *argv[])
72#include <openssl/evp.h> 72#include <openssl/evp.h>
73#include <openssl/md2.h> 73#include <openssl/md2.h>
74 74
75#ifdef CHARSET_EBCDIC
76#include <openssl/ebcdic.h>
77#endif
78
79static char *test[]={ 75static char *test[]={
80 "", 76 "",
81 "a", 77 "a",
diff --git a/src/lib/libssl/src/crypto/md4/md4_one.c b/src/lib/libssl/src/crypto/md4/md4_one.c
index bb64362638..ed6ce33650 100644
--- a/src/lib/libssl/src/crypto/md4/md4_one.c
+++ b/src/lib/libssl/src/crypto/md4/md4_one.c
@@ -61,10 +61,6 @@
61#include <openssl/md4.h> 61#include <openssl/md4.h>
62#include <openssl/crypto.h> 62#include <openssl/crypto.h>
63 63
64#ifdef CHARSET_EBCDIC
65#include <openssl/ebcdic.h>
66#endif
67
68unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md) 64unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md)
69 { 65 {
70 MD4_CTX c; 66 MD4_CTX c;
@@ -73,23 +69,7 @@ unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md)
73 if (md == NULL) md=m; 69 if (md == NULL) md=m;
74 if (!MD4_Init(&c)) 70 if (!MD4_Init(&c))
75 return NULL; 71 return NULL;
76#ifndef CHARSET_EBCDIC
77 MD4_Update(&c,d,n); 72 MD4_Update(&c,d,n);
78#else
79 {
80 char temp[1024];
81 unsigned long chunk;
82
83 while (n > 0)
84 {
85 chunk = (n > sizeof(temp)) ? sizeof(temp) : n;
86 ebcdic2ascii(temp, d, chunk);
87 MD4_Update(&c,temp,chunk);
88 n -= chunk;
89 d += chunk;
90 }
91 }
92#endif
93 MD4_Final(md,&c); 73 MD4_Final(md,&c);
94 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */ 74 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
95 return(md); 75 return(md);
diff --git a/src/lib/libssl/src/crypto/md5/md5_one.c b/src/lib/libssl/src/crypto/md5/md5_one.c
index 43fee89379..839e27e972 100644
--- a/src/lib/libssl/src/crypto/md5/md5_one.c
+++ b/src/lib/libssl/src/crypto/md5/md5_one.c
@@ -61,10 +61,6 @@
61#include <openssl/md5.h> 61#include <openssl/md5.h>
62#include <openssl/crypto.h> 62#include <openssl/crypto.h>
63 63
64#ifdef CHARSET_EBCDIC
65#include <openssl/ebcdic.h>
66#endif
67
68unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md) 64unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)
69 { 65 {
70 MD5_CTX c; 66 MD5_CTX c;
@@ -73,23 +69,7 @@ unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)
73 if (md == NULL) md=m; 69 if (md == NULL) md=m;
74 if (!MD5_Init(&c)) 70 if (!MD5_Init(&c))
75 return NULL; 71 return NULL;
76#ifndef CHARSET_EBCDIC
77 MD5_Update(&c,d,n); 72 MD5_Update(&c,d,n);
78#else
79 {
80 char temp[1024];
81 unsigned long chunk;
82
83 while (n > 0)
84 {
85 chunk = (n > sizeof(temp)) ? sizeof(temp) : n;
86 ebcdic2ascii(temp, d, chunk);
87 MD5_Update(&c,temp,chunk);
88 n -= chunk;
89 d += chunk;
90 }
91 }
92#endif
93 MD5_Final(md,&c); 73 MD5_Final(md,&c);
94 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */ 74 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
95 return(md); 75 return(md);
diff --git a/src/lib/libssl/src/crypto/mdc2/mdc2test.c b/src/lib/libssl/src/crypto/mdc2/mdc2test.c
index 017b31add2..cf8f65cf27 100644
--- a/src/lib/libssl/src/crypto/mdc2/mdc2test.c
+++ b/src/lib/libssl/src/crypto/mdc2/mdc2test.c
@@ -76,10 +76,6 @@ int main(int argc, char *argv[])
76#include <openssl/evp.h> 76#include <openssl/evp.h>
77#include <openssl/mdc2.h> 77#include <openssl/mdc2.h>
78 78
79#ifdef CHARSET_EBCDIC
80#include <openssl/ebcdic.h>
81#endif
82
83static unsigned char pad1[16]={ 79static unsigned char pad1[16]={
84 0x42,0xE5,0x0C,0xD2,0x24,0xBA,0xCE,0xBA, 80 0x42,0xE5,0x0C,0xD2,0x24,0xBA,0xCE,0xBA,
85 0x76,0x0B,0xDD,0x2B,0xD4,0x09,0x28,0x1A 81 0x76,0x0B,0xDD,0x2B,0xD4,0x09,0x28,0x1A
@@ -98,10 +94,6 @@ int main(int argc, char *argv[])
98 EVP_MD_CTX c; 94 EVP_MD_CTX c;
99 static char *text="Now is the time for all "; 95 static char *text="Now is the time for all ";
100 96
101#ifdef CHARSET_EBCDIC
102 ebcdic2ascii(text,text,strlen(text));
103#endif
104
105 EVP_MD_CTX_init(&c); 97 EVP_MD_CTX_init(&c);
106 EVP_DigestInit_ex(&c,EVP_mdc2(), NULL); 98 EVP_DigestInit_ex(&c,EVP_mdc2(), NULL);
107 EVP_DigestUpdate(&c,(unsigned char *)text,strlen(text)); 99 EVP_DigestUpdate(&c,(unsigned char *)text,strlen(text));
diff --git a/src/lib/libssl/src/crypto/objects/obj_dat.c b/src/lib/libssl/src/crypto/objects/obj_dat.c
index a597284c80..bced796e62 100644
--- a/src/lib/libssl/src/crypto/objects/obj_dat.c
+++ b/src/lib/libssl/src/crypto/objects/obj_dat.c
@@ -705,22 +705,6 @@ const void *OBJ_bsearch_ex_(const void *key, const void *base_, int num,
705 else 705 else
706 break; 706 break;
707 } 707 }
708#ifdef CHARSET_EBCDIC
709/* THIS IS A KLUDGE - Because the *_obj is sorted in ASCII order, and
710 * I don't have perl (yet), we revert to a *LINEAR* search
711 * when the object wasn't found in the binary search.
712 */
713 if (c != 0)
714 {
715 for (i=0; i<num; ++i)
716 {
717 p= &(base[i*size]);
718 c = (*cmp)(key,p);
719 if (c == 0 || (c < 0 && (flags & OBJ_BSEARCH_VALUE_ON_NOMATCH)))
720 return p;
721 }
722 }
723#endif
724 if (c != 0 && !(flags & OBJ_BSEARCH_VALUE_ON_NOMATCH)) 708 if (c != 0 && !(flags & OBJ_BSEARCH_VALUE_ON_NOMATCH))
725 p = NULL; 709 p = NULL;
726 else if (c == 0 && (flags & OBJ_BSEARCH_FIRST_VALUE_ON_MATCH)) 710 else if (c == 0 && (flags & OBJ_BSEARCH_FIRST_VALUE_ON_MATCH))
diff --git a/src/lib/libssl/src/crypto/pem/pem_lib.c b/src/lib/libssl/src/crypto/pem/pem_lib.c
index 5a421fc4b6..74baa2ec1c 100644
--- a/src/lib/libssl/src/crypto/pem/pem_lib.c
+++ b/src/lib/libssl/src/crypto/pem/pem_lib.c
@@ -382,10 +382,6 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp,
382 PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,PEM_R_READ_KEY); 382 PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,PEM_R_READ_KEY);
383 goto err; 383 goto err;
384 } 384 }
385#ifdef CHARSET_EBCDIC
386 /* Convert the pass phrase from EBCDIC */
387 ebcdic2ascii(buf, buf, klen);
388#endif
389 kstr=(unsigned char *)buf; 385 kstr=(unsigned char *)buf;
390 } 386 }
391 RAND_add(data,i,0);/* put in the RSA key. */ 387 RAND_add(data,i,0);/* put in the RSA key. */
@@ -458,11 +454,6 @@ int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen,
458 PEMerr(PEM_F_PEM_DO_HEADER,PEM_R_BAD_PASSWORD_READ); 454 PEMerr(PEM_F_PEM_DO_HEADER,PEM_R_BAD_PASSWORD_READ);
459 return(0); 455 return(0);
460 } 456 }
461#ifdef CHARSET_EBCDIC
462 /* Convert the pass phrase from EBCDIC */
463 ebcdic2ascii(buf, buf, klen);
464#endif
465
466 if (!EVP_BytesToKey(cipher->cipher,EVP_md5(),&(cipher->iv[0]), 457 if (!EVP_BytesToKey(cipher->cipher,EVP_md5(),&(cipher->iv[0]),
467 (unsigned char *)buf,klen,1,key,NULL)) 458 (unsigned char *)buf,klen,1,key,NULL))
468 return 0; 459 return 0;
@@ -516,15 +507,9 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher)
516 for (;;) 507 for (;;)
517 { 508 {
518 c= *header; 509 c= *header;
519#ifndef CHARSET_EBCDIC
520 if (!( ((c >= 'A') && (c <= 'Z')) || (c == '-') || 510 if (!( ((c >= 'A') && (c <= 'Z')) || (c == '-') ||
521 ((c >= '0') && (c <= '9')))) 511 ((c >= '0') && (c <= '9'))))
522 break; 512 break;
523#else
524 if (!( isupper(c) || (c == '-') ||
525 isdigit(c)))
526 break;
527#endif
528 header++; 513 header++;
529 } 514 }
530 *header='\0'; 515 *header='\0';
diff --git a/src/lib/libssl/src/crypto/ripemd/rmdtest.c b/src/lib/libssl/src/crypto/ripemd/rmdtest.c
index fb34e0e836..b32fda96ed 100644
--- a/src/lib/libssl/src/crypto/ripemd/rmdtest.c
+++ b/src/lib/libssl/src/crypto/ripemd/rmdtest.c
@@ -72,10 +72,6 @@ int main(int argc, char *argv[])
72#include <openssl/ripemd.h> 72#include <openssl/ripemd.h>
73#include <openssl/evp.h> 73#include <openssl/evp.h>
74 74
75#ifdef CHARSET_EBCDIC
76#include <openssl/ebcdic.h>
77#endif
78
79static char *test[]={ 75static char *test[]={
80 "", 76 "",
81 "a", 77 "a",
@@ -112,9 +108,6 @@ int main(int argc, char *argv[])
112 i=1; 108 i=1;
113 while (*P != NULL) 109 while (*P != NULL)
114 { 110 {
115#ifdef CHARSET_EBCDIC
116 ebcdic2ascii((char *)*P, (char *)*P, strlen((char *)*P));
117#endif
118 EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_ripemd160(), NULL); 111 EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_ripemd160(), NULL);
119 p=pt(md); 112 p=pt(md);
120 if (strcmp(p,(char *)*R) != 0) 113 if (strcmp(p,(char *)*R) != 0)
diff --git a/src/lib/libssl/src/crypto/sha/sha1test.c b/src/lib/libssl/src/crypto/sha/sha1test.c
index 6feb3964c7..ad9e3dc407 100644
--- a/src/lib/libssl/src/crypto/sha/sha1test.c
+++ b/src/lib/libssl/src/crypto/sha/sha1test.c
@@ -72,10 +72,6 @@ int main(int argc, char *argv[])
72#include <openssl/evp.h> 72#include <openssl/evp.h>
73#include <openssl/sha.h> 73#include <openssl/sha.h>
74 74
75#ifdef CHARSET_EBCDIC
76#include <openssl/ebcdic.h>
77#endif
78
79#undef SHA_0 /* FIPS 180 */ 75#undef SHA_0 /* FIPS 180 */
80#define SHA_1 /* FIPS 180-1 */ 76#define SHA_1 /* FIPS 180-1 */
81 77
@@ -112,11 +108,6 @@ int main(int argc, char *argv[])
112 EVP_MD_CTX c; 108 EVP_MD_CTX c;
113 unsigned char md[SHA_DIGEST_LENGTH]; 109 unsigned char md[SHA_DIGEST_LENGTH];
114 110
115#ifdef CHARSET_EBCDIC
116 ebcdic2ascii(test[0], test[0], strlen(test[0]));
117 ebcdic2ascii(test[1], test[1], strlen(test[1]));
118#endif
119
120 EVP_MD_CTX_init(&c); 111 EVP_MD_CTX_init(&c);
121 P=test; 112 P=test;
122 R=ret; 113 R=ret;
@@ -139,9 +130,6 @@ int main(int argc, char *argv[])
139 } 130 }
140 131
141 memset(buf,'a',1000); 132 memset(buf,'a',1000);
142#ifdef CHARSET_EBCDIC
143 ebcdic2ascii(buf, buf, 1000);
144#endif /*CHARSET_EBCDIC*/
145 EVP_DigestInit_ex(&c,EVP_sha1(), NULL); 133 EVP_DigestInit_ex(&c,EVP_sha1(), NULL);
146 for (i=0; i<1000; i++) 134 for (i=0; i<1000; i++)
147 EVP_DigestUpdate(&c,buf,1000); 135 EVP_DigestUpdate(&c,buf,1000);
diff --git a/src/lib/libssl/src/crypto/sha/shatest.c b/src/lib/libssl/src/crypto/sha/shatest.c
index 27614646d1..6c93c39590 100644
--- a/src/lib/libssl/src/crypto/sha/shatest.c
+++ b/src/lib/libssl/src/crypto/sha/shatest.c
@@ -72,10 +72,6 @@ int main(int argc, char *argv[])
72#include <openssl/evp.h> 72#include <openssl/evp.h>
73#include <openssl/sha.h> 73#include <openssl/sha.h>
74 74
75#ifdef CHARSET_EBCDIC
76#include <openssl/ebcdic.h>
77#endif
78
79#define SHA_0 /* FIPS 180 */ 75#define SHA_0 /* FIPS 180 */
80#undef SHA_1 /* FIPS 180-1 */ 76#undef SHA_1 /* FIPS 180-1 */
81 77
@@ -112,11 +108,6 @@ int main(int argc, char *argv[])
112 EVP_MD_CTX c; 108 EVP_MD_CTX c;
113 unsigned char md[SHA_DIGEST_LENGTH]; 109 unsigned char md[SHA_DIGEST_LENGTH];
114 110
115#ifdef CHARSET_EBCDIC
116 ebcdic2ascii(test[0], test[0], strlen(test[0]));
117 ebcdic2ascii(test[1], test[1], strlen(test[1]));
118#endif
119
120 EVP_MD_CTX_init(&c); 111 EVP_MD_CTX_init(&c);
121 P=test; 112 P=test;
122 R=ret; 113 R=ret;
@@ -139,9 +130,6 @@ int main(int argc, char *argv[])
139 } 130 }
140 131
141 memset(buf,'a',1000); 132 memset(buf,'a',1000);
142#ifdef CHARSET_EBCDIC
143 ebcdic2ascii(buf, buf, 1000);
144#endif /*CHARSET_EBCDIC*/
145 EVP_DigestInit_ex(&c,EVP_sha(), NULL); 133 EVP_DigestInit_ex(&c,EVP_sha(), NULL);
146 for (i=0; i<1000; i++) 134 for (i=0; i<1000; i++)
147 EVP_DigestUpdate(&c,buf,1000); 135 EVP_DigestUpdate(&c,buf,1000);
diff --git a/src/lib/libssl/src/crypto/x509/x509_obj.c b/src/lib/libssl/src/crypto/x509/x509_obj.c
index 21fed9f838..bcc1e7429e 100644
--- a/src/lib/libssl/src/crypto/x509/x509_obj.c
+++ b/src/lib/libssl/src/crypto/x509/x509_obj.c
@@ -75,9 +75,6 @@ int i;
75 static const char hex[17]="0123456789ABCDEF"; 75 static const char hex[17]="0123456789ABCDEF";
76 int gs_doit[4]; 76 int gs_doit[4];
77 char tmp_buf[80]; 77 char tmp_buf[80];
78#ifdef CHARSET_EBCDIC
79 char ebcdic_buf[1024];
80#endif
81 78
82 if (buf == NULL) 79 if (buf == NULL)
83 { 80 {
@@ -114,20 +111,6 @@ int i;
114 type=ne->value->type; 111 type=ne->value->type;
115 num=ne->value->length; 112 num=ne->value->length;
116 q=ne->value->data; 113 q=ne->value->data;
117#ifdef CHARSET_EBCDIC
118 if (type == V_ASN1_GENERALSTRING ||
119 type == V_ASN1_VISIBLESTRING ||
120 type == V_ASN1_PRINTABLESTRING ||
121 type == V_ASN1_TELETEXSTRING ||
122 type == V_ASN1_VISIBLESTRING ||
123 type == V_ASN1_IA5STRING) {
124 ascii2ebcdic(ebcdic_buf, q,
125 (num > sizeof ebcdic_buf)
126 ? sizeof ebcdic_buf : num);
127 q=ebcdic_buf;
128 }
129#endif
130
131 if ((type == V_ASN1_GENERALSTRING) && ((num%4) == 0)) 114 if ((type == V_ASN1_GENERALSTRING) && ((num%4) == 0))
132 { 115 {
133 gs_doit[0]=gs_doit[1]=gs_doit[2]=gs_doit[3]=0; 116 gs_doit[0]=gs_doit[1]=gs_doit[2]=gs_doit[3]=0;
@@ -149,12 +132,7 @@ int i;
149 { 132 {
150 if (!gs_doit[j&3]) continue; 133 if (!gs_doit[j&3]) continue;
151 l2++; 134 l2++;
152#ifndef CHARSET_EBCDIC
153 if ((q[j] < ' ') || (q[j] > '~')) l2+=3; 135 if ((q[j] < ' ') || (q[j] > '~')) l2+=3;
154#else
155 if ((os_toascii[q[j]] < os_toascii[' ']) ||
156 (os_toascii[q[j]] > os_toascii['~'])) l2+=3;
157#endif
158 } 136 }
159 137
160 lold=l; 138 lold=l;
@@ -173,15 +151,10 @@ int i;
173 *(p++)='/'; 151 *(p++)='/';
174 memcpy(p,s,(unsigned int)l1); p+=l1; 152 memcpy(p,s,(unsigned int)l1); p+=l1;
175 *(p++)='='; 153 *(p++)='=';
176
177#ifndef CHARSET_EBCDIC /* q was assigned above already. */
178 q=ne->value->data; 154 q=ne->value->data;
179#endif
180
181 for (j=0; j<num; j++) 155 for (j=0; j<num; j++)
182 { 156 {
183 if (!gs_doit[j&3]) continue; 157 if (!gs_doit[j&3]) continue;
184#ifndef CHARSET_EBCDIC
185 n=q[j]; 158 n=q[j];
186 if ((n < ' ') || (n > '~')) 159 if ((n < ' ') || (n > '~'))
187 { 160 {
@@ -192,19 +165,6 @@ int i;
192 } 165 }
193 else 166 else
194 *(p++)=n; 167 *(p++)=n;
195#else
196 n=os_toascii[q[j]];
197 if ((n < os_toascii[' ']) ||
198 (n > os_toascii['~']))
199 {
200 *(p++)='\\';
201 *(p++)='x';
202 *(p++)=hex[(n>>4)&0x0f];
203 *(p++)=hex[n&0x0f];
204 }
205 else
206 *(p++)=q[j];
207#endif
208 } 168 }
209 *p='\0'; 169 *p='\0';
210 } 170 }
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_ia5.c b/src/lib/libssl/src/crypto/x509v3/v3_ia5.c
index 4ff12b52b5..ab1c5188b8 100644
--- a/src/lib/libssl/src/crypto/x509v3/v3_ia5.c
+++ b/src/lib/libssl/src/crypto/x509v3/v3_ia5.c
@@ -105,9 +105,6 @@ static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method,
105 M_ASN1_IA5STRING_free(ia5); 105 M_ASN1_IA5STRING_free(ia5);
106 goto err; 106 goto err;
107 } 107 }
108#ifdef CHARSET_EBCDIC
109 ebcdic2ascii(ia5->data, ia5->data, ia5->length);
110#endif /*CHARSET_EBCDIC*/
111 return ia5; 108 return ia5;
112 err: 109 err:
113 X509V3err(X509V3_F_S2I_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE); 110 X509V3err(X509V3_F_S2I_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE);
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_prn.c b/src/lib/libssl/src/crypto/x509v3/v3_prn.c
index 3146218708..2124b447b4 100644
--- a/src/lib/libssl/src/crypto/x509v3/v3_prn.c
+++ b/src/lib/libssl/src/crypto/x509v3/v3_prn.c
@@ -83,22 +83,7 @@ void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml)
83 nval = sk_CONF_VALUE_value(val, i); 83 nval = sk_CONF_VALUE_value(val, i);
84 if(!nval->name) BIO_puts(out, nval->value); 84 if(!nval->name) BIO_puts(out, nval->value);
85 else if(!nval->value) BIO_puts(out, nval->name); 85 else if(!nval->value) BIO_puts(out, nval->name);
86#ifndef CHARSET_EBCDIC
87 else BIO_printf(out, "%s:%s", nval->name, nval->value); 86 else BIO_printf(out, "%s:%s", nval->name, nval->value);
88#else
89 else {
90 int len;
91 char *tmp;
92 len = strlen(nval->value)+1;
93 tmp = OPENSSL_malloc(len);
94 if (tmp)
95 {
96 ascii2ebcdic(tmp, nval->value, len);
97 BIO_printf(out, "%s:%s", nval->name, tmp);
98 OPENSSL_free(tmp);
99 }
100 }
101#endif
102 if(ml) BIO_puts(out, "\n"); 87 if(ml) BIO_puts(out, "\n");
103 } 88 }
104} 89}
@@ -127,22 +112,7 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int inde
127 ok = 0; 112 ok = 0;
128 goto err; 113 goto err;
129 } 114 }
130#ifndef CHARSET_EBCDIC
131 BIO_printf(out, "%*s%s", indent, "", value); 115 BIO_printf(out, "%*s%s", indent, "", value);
132#else
133 {
134 int len;
135 char *tmp;
136 len = strlen(value)+1;
137 tmp = OPENSSL_malloc(len);
138 if (tmp)
139 {
140 ascii2ebcdic(tmp, value, len);
141 BIO_printf(out, "%*s%s", indent, "", tmp);
142 OPENSSL_free(tmp);
143 }
144 }
145#endif
146 } else if(method->i2v) { 116 } else if(method->i2v) {
147 if(!(nval = method->i2v(method, ext_str, NULL))) { 117 if(!(nval = method->i2v(method, ext_str, NULL))) {
148 ok = 0; 118 ok = 0;
diff --git a/src/lib/libssl/src/crypto/x509v3/v3_utl.c b/src/lib/libssl/src/crypto/x509v3/v3_utl.c
index e030234540..c4b6143eff 100644
--- a/src/lib/libssl/src/crypto/x509v3/v3_utl.c
+++ b/src/lib/libssl/src/crypto/x509v3/v3_utl.c
@@ -378,10 +378,6 @@ char *hex_to_string(const unsigned char *buffer, long len)
378 *q++ = ':'; 378 *q++ = ':';
379 } 379 }
380 q[-1] = 0; 380 q[-1] = 0;
381#ifdef CHARSET_EBCDIC
382 ebcdic2ascii(tmp, tmp, q - tmp - 1);
383#endif
384
385 return tmp; 381 return tmp;
386} 382}
387 383
@@ -400,14 +396,8 @@ unsigned char *string_to_hex(const char *str, long *len)
400 if(!(hexbuf = OPENSSL_malloc(strlen(str) >> 1))) goto err; 396 if(!(hexbuf = OPENSSL_malloc(strlen(str) >> 1))) goto err;
401 for(p = (unsigned char *)str, q = hexbuf; *p;) { 397 for(p = (unsigned char *)str, q = hexbuf; *p;) {
402 ch = *p++; 398 ch = *p++;
403#ifdef CHARSET_EBCDIC
404 ch = os_toebcdic[ch];
405#endif
406 if(ch == ':') continue; 399 if(ch == ':') continue;
407 cl = *p++; 400 cl = *p++;
408#ifdef CHARSET_EBCDIC
409 cl = os_toebcdic[cl];
410#endif
411 if(!cl) { 401 if(!cl) {
412 X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS); 402 X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS);
413 OPENSSL_free(hexbuf); 403 OPENSSL_free(hexbuf);
@@ -844,21 +834,13 @@ int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk,
844 * multiple instances 834 * multiple instances
845 */ 835 */
846 for(p = type; *p ; p++) 836 for(p = type; *p ; p++)
847#ifndef CHARSET_EBCDIC
848 if ((*p == ':') || (*p == ',') || (*p == '.')) 837 if ((*p == ':') || (*p == ',') || (*p == '.'))
849#else
850 if ((*p == os_toascii[':']) || (*p == os_toascii[',']) || (*p == os_toascii['.']))
851#endif
852 { 838 {
853 p++; 839 p++;
854 if(*p) type = p; 840 if(*p) type = p;
855 break; 841 break;
856 } 842 }
857#ifndef CHARSET_EBCDIC
858 if (*type == '+') 843 if (*type == '+')
859#else
860 if (*type == os_toascii['+'])
861#endif
862 { 844 {
863 mval = -1; 845 mval = -1;
864 type++; 846 type++;
diff --git a/src/lib/libssl/src/ssl/s2_lib.c b/src/lib/libssl/src/ssl/s2_lib.c
index d3764ebbe9..76ed912927 100644
--- a/src/lib/libssl/src/ssl/s2_lib.c
+++ b/src/lib/libssl/src/ssl/s2_lib.c
@@ -475,10 +475,6 @@ ssl2_generate_key_material(SSL *s)
475 475
476 md5 = EVP_md5(); 476 md5 = EVP_md5();
477 477
478#ifdef CHARSET_EBCDIC
479 c = os_toascii['0']; /* Must be an ASCII '0', not EBCDIC '0',
480 see SSLv2 docu */
481#endif
482 EVP_MD_CTX_init(&ctx); 478 EVP_MD_CTX_init(&ctx);
483 km = s->s2->key_material; 479 km = s->s2->key_material;
484 480
diff --git a/src/lib/libssl/src/ssl/s3_enc.c b/src/lib/libssl/src/ssl/s3_enc.c
index 4536ca5995..9ed5850e73 100644
--- a/src/lib/libssl/src/ssl/s3_enc.c
+++ b/src/lib/libssl/src/ssl/s3_enc.c
@@ -170,9 +170,6 @@ ssl3_generate_key_block(SSL *s, unsigned char *km, int num)
170 unsigned char c = 'A'; 170 unsigned char c = 'A';
171 unsigned int i, j, k; 171 unsigned int i, j, k;
172 172
173#ifdef CHARSET_EBCDIC
174 c = os_toascii[c]; /*'A' in ASCII */
175#endif
176 k = 0; 173 k = 0;
177 EVP_MD_CTX_init(&m5); 174 EVP_MD_CTX_init(&m5);
178 EVP_MD_CTX_set_flags(&m5, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); 175 EVP_MD_CTX_set_flags(&m5, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
@@ -796,15 +793,9 @@ ssl3_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p,
796 int len) 793 int len)
797{ 794{
798 static const unsigned char *salt[3] = { 795 static const unsigned char *salt[3] = {
799#ifndef CHARSET_EBCDIC
800 (const unsigned char *)"A", 796 (const unsigned char *)"A",
801 (const unsigned char *)"BB", 797 (const unsigned char *)"BB",
802 (const unsigned char *)"CCC", 798 (const unsigned char *)"CCC",
803#else
804 (const unsigned char *)"\x41",
805 (const unsigned char *)"\x42\x42",
806 (const unsigned char *)"\x43\x43\x43",
807#endif
808 }; 799 };
809 unsigned char buf[EVP_MAX_MD_SIZE]; 800 unsigned char buf[EVP_MAX_MD_SIZE];
810 EVP_MD_CTX ctx; 801 EVP_MD_CTX ctx;
diff --git a/src/lib/libssl/src/ssl/ssl_ciph.c b/src/lib/libssl/src/ssl/ssl_ciph.c
index 0e24e0a5c6..ed2e78bdcc 100644
--- a/src/lib/libssl/src/ssl/ssl_ciph.c
+++ b/src/lib/libssl/src/ssl/ssl_ciph.c
@@ -1130,14 +1130,10 @@ const SSL_CIPHER **ca_list)
1130 ch = *l; 1130 ch = *l;
1131 buf = l; 1131 buf = l;
1132 buflen = 0; 1132 buflen = 0;
1133#ifndef CHARSET_EBCDIC
1134 while (((ch >= 'A') && (ch <= 'Z')) || 1133 while (((ch >= 'A') && (ch <= 'Z')) ||
1135 ((ch >= '0') && (ch <= '9')) || 1134 ((ch >= '0') && (ch <= '9')) ||
1136 ((ch >= 'a') && (ch <= 'z')) || 1135 ((ch >= 'a') && (ch <= 'z')) ||
1137 (ch == '-') || (ch == '.')) 1136 (ch == '-') || (ch == '.'))
1138#else
1139 while (isalnum(ch) || (ch == '-') || (ch == '.'))
1140#endif
1141 { 1137 {
1142 ch = *(++l); 1138 ch = *(++l);
1143 buflen++; 1139 buflen++;
diff --git a/src/lib/libssl/src/ssl/tls1.h b/src/lib/libssl/src/ssl/tls1.h
index 95d6660ac3..43879f82af 100644
--- a/src/lib/libssl/src/ssl/tls1.h
+++ b/src/lib/libssl/src/ssl/tls1.h
@@ -699,25 +699,6 @@ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb)
699#define TLS_MD_MASTER_SECRET_CONST "master secret" 699#define TLS_MD_MASTER_SECRET_CONST "master secret"
700#define TLS_MD_MASTER_SECRET_CONST_SIZE 13 700#define TLS_MD_MASTER_SECRET_CONST_SIZE 13
701 701
702#ifdef CHARSET_EBCDIC
703#undef TLS_MD_CLIENT_FINISH_CONST
704#define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" /*client finished*/
705#undef TLS_MD_SERVER_FINISH_CONST
706#define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" /*server finished*/
707#undef TLS_MD_SERVER_WRITE_KEY_CONST
708#define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*server write key*/
709#undef TLS_MD_KEY_EXPANSION_CONST
710#define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" /*key expansion*/
711#undef TLS_MD_CLIENT_WRITE_KEY_CONST
712#define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*client write key*/
713#undef TLS_MD_SERVER_WRITE_KEY_CONST
714#define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*server write key*/
715#undef TLS_MD_IV_BLOCK_CONST
716#define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" /*IV block*/
717#undef TLS_MD_MASTER_SECRET_CONST
718#define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" /*master secret*/
719#endif
720
721/* TLS Session Ticket extension struct */ 702/* TLS Session Ticket extension struct */
722struct tls_session_ticket_ext_st { 703struct tls_session_ticket_ext_st {
723 unsigned short length; 704 unsigned short length;
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c
index 0e24e0a5c6..ed2e78bdcc 100644
--- a/src/lib/libssl/ssl_ciph.c
+++ b/src/lib/libssl/ssl_ciph.c
@@ -1130,14 +1130,10 @@ const SSL_CIPHER **ca_list)
1130 ch = *l; 1130 ch = *l;
1131 buf = l; 1131 buf = l;
1132 buflen = 0; 1132 buflen = 0;
1133#ifndef CHARSET_EBCDIC
1134 while (((ch >= 'A') && (ch <= 'Z')) || 1133 while (((ch >= 'A') && (ch <= 'Z')) ||
1135 ((ch >= '0') && (ch <= '9')) || 1134 ((ch >= '0') && (ch <= '9')) ||
1136 ((ch >= 'a') && (ch <= 'z')) || 1135 ((ch >= 'a') && (ch <= 'z')) ||
1137 (ch == '-') || (ch == '.')) 1136 (ch == '-') || (ch == '.'))
1138#else
1139 while (isalnum(ch) || (ch == '-') || (ch == '.'))
1140#endif
1141 { 1137 {
1142 ch = *(++l); 1138 ch = *(++l);
1143 buflen++; 1139 buflen++;
diff --git a/src/lib/libssl/tls1.h b/src/lib/libssl/tls1.h
index 95d6660ac3..43879f82af 100644
--- a/src/lib/libssl/tls1.h
+++ b/src/lib/libssl/tls1.h
@@ -699,25 +699,6 @@ SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb)
699#define TLS_MD_MASTER_SECRET_CONST "master secret" 699#define TLS_MD_MASTER_SECRET_CONST "master secret"
700#define TLS_MD_MASTER_SECRET_CONST_SIZE 13 700#define TLS_MD_MASTER_SECRET_CONST_SIZE 13
701 701
702#ifdef CHARSET_EBCDIC
703#undef TLS_MD_CLIENT_FINISH_CONST
704#define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" /*client finished*/
705#undef TLS_MD_SERVER_FINISH_CONST
706#define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" /*server finished*/
707#undef TLS_MD_SERVER_WRITE_KEY_CONST
708#define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*server write key*/
709#undef TLS_MD_KEY_EXPANSION_CONST
710#define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" /*key expansion*/
711#undef TLS_MD_CLIENT_WRITE_KEY_CONST
712#define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*client write key*/
713#undef TLS_MD_SERVER_WRITE_KEY_CONST
714#define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" /*server write key*/
715#undef TLS_MD_IV_BLOCK_CONST
716#define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" /*IV block*/
717#undef TLS_MD_MASTER_SECRET_CONST
718#define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" /*master secret*/
719#endif
720
721/* TLS Session Ticket extension struct */ 702/* TLS Session Ticket extension struct */
722struct tls_session_ticket_ext_st { 703struct tls_session_ticket_ext_st {
723 unsigned short length; 704 unsigned short length;