summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2000-09-10 14:45:19 +0000
committerRichard Levitte <levitte@openssl.org>2000-09-10 14:45:19 +0000
commit97d8e82c4c622b8896e37634c6d4ee43ab6a4432 (patch)
tree9872033f9258a4032388a234c23659b31434cfea /crypto
parentd7b9c76c72bd6e744db2070d148738941ba38305 (diff)
Marin Kraemer <Martin.Kraemer@MchP.Siemens.De> sent us patches to make
the OpenSSL commands x50 and req work better on a EBCDIC system.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asn1/a_mbstr.c7
-rw-r--r--crypto/x509v3/v3_utl.c11
2 files changed, 18 insertions, 0 deletions
diff --git a/crypto/asn1/a_mbstr.c b/crypto/asn1/a_mbstr.c
index 9842b653e6..5d981c6553 100644
--- a/crypto/asn1/a_mbstr.c
+++ b/crypto/asn1/a_mbstr.c
@@ -385,9 +385,16 @@ static int is_printable(unsigned long value)
/* Note: we can't use 'isalnum' because certain accented
* characters may count as alphanumeric in some environments.
*/
+#ifndef CHARSET_EBCDIC
if((ch >= 'a') && (ch <= 'z')) return 1;
if((ch >= 'A') && (ch <= 'Z')) return 1;
if((ch >= '0') && (ch <= '9')) return 1;
if ((ch == ' ') || strchr("'()+,-./:=?", ch)) return 1;
+#else /*CHARSET_EBCDIC*/
+ if((ch >= os_toascii['a']) && (ch <= os_toascii['z'])) return 1;
+ if((ch >= os_toascii['A']) && (ch <= os_toascii['Z'])) return 1;
+ if((ch >= os_toascii['0']) && (ch <= os_toascii['9'])) return 1;
+ if ((ch == os_toascii[' ']) || strchr("'()+,-./:=?", os_toebcdic[ch])) return 1;
+#endif /*CHARSET_EBCDIC*/
return 0;
}
diff --git a/crypto/x509v3/v3_utl.c b/crypto/x509v3/v3_utl.c
index 0976bcc711..e6e99b2d5c 100644
--- a/crypto/x509v3/v3_utl.c
+++ b/crypto/x509v3/v3_utl.c
@@ -331,6 +331,7 @@ static char *strip_spaces(char *name)
/* Given a buffer of length 'len' return a OPENSSL_malloc'ed string with its
* hex representation
+ * @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines)
*/
char *hex_to_string(unsigned char *buffer, long len)
@@ -351,6 +352,10 @@ char *hex_to_string(unsigned char *buffer, long len)
*q++ = ':';
}
q[-1] = 0;
+#ifdef CHARSET_EBCDIC
+ ebcdic2ascii(tmp, tmp, q - tmp - 1);
+#endif
+
return tmp;
}
@@ -369,8 +374,14 @@ unsigned char *string_to_hex(char *str, long *len)
if(!(hexbuf = OPENSSL_malloc(strlen(str) >> 1))) goto err;
for(p = (unsigned char *)str, q = hexbuf; *p;) {
ch = *p++;
+#ifdef CHARSET_EBCDIC
+ ch = os_toebcdic[ch];
+#endif
if(ch == ':') continue;
cl = *p++;
+#ifdef CHARSET_EBCDIC
+ cl = os_toebcdic[cl];
+#endif
if(!cl) {
X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS);
OPENSSL_free(hexbuf);