Here's the set of EBCDIC patches again which make openssl-0.9.5a and
openssl-0.9.6-dev work better: X509v3 attributes were handled incorrectly
and caused errors in a_mbstr.c when using the "openssl x509" and "req"
commands.

-- 
<[EMAIL PROTECTED]>             |     Fujitsu Siemens
Fon: +49-89-636-46021, FAX: +49-89-636-41143 | 81730  Munich,  Germany
? ebcdic.diff
Index: apps/req.c
===================================================================
RCS file: /home/cvs/OpenSSL/openssl/apps/req.c,v
retrieving revision 1.62
diff -u -r1.62 req.c
--- apps/req.c  2000/07/12 23:55:28     1.62
+++ apps/req.c  2000/08/21 13:02:15
@@ -1099,7 +1099,11 @@
                 * multiple instances 
                 */
                for(p = v->name; *p ; p++) 
+#ifndef CHARSET_EBCDIC
                        if ((*p == ':') || (*p == ',') || (*p == '.')) {
+#else
+                       if ((*p == os_toascii[':']) || (*p == os_toascii[',']) || (*p 
+== os_toascii['.'])) {
+#endif
                                p++;
                                if(*p) type = p;
                                break;
@@ -1215,6 +1219,9 @@
                return(0);
                }
        buf[--i]='\0';
+#ifdef CHARSET_EBCDIC
+       ebcdic2ascii(buf, buf, i);
+#endif
        if(!req_check_len(i, min, max)) goto start;
 
        if(!X509_REQ_add1_attr_by_NID(req, nid, MBSTRING_ASC,
Index: crypto/asn1/a_mbstr.c
===================================================================
RCS file: /home/cvs/OpenSSL/openssl/crypto/asn1/a_mbstr.c,v
retrieving revision 1.10
diff -u -r1.10 a_mbstr.c
--- crypto/asn1/a_mbstr.c       2000/06/05 13:50:57     1.10
+++ crypto/asn1/a_mbstr.c       2000/08/21 13:02:17
@@ -382,9 +382,16 @@
        /* 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;
 }
Index: crypto/x509v3/v3_utl.c
===================================================================
RCS file: /home/cvs/OpenSSL/openssl/crypto/x509v3/v3_utl.c,v
retrieving revision 1.18
diff -u -r1.18 v3_utl.c
--- crypto/x509v3/v3_utl.c      2000/06/11 12:18:11     1.18
+++ crypto/x509v3/v3_utl.c      2000/08/21 13:02:24
@@ -351,6 +351,10 @@
                *q++ = ':';
        }
        q[-1] = 0;
+#ifdef CHARSET_EBCDIC
+       ebcdic2ascii(tmp, tmp, q - tmp - 1);
+#endif
+
        return tmp;
 }
 
@@ -369,8 +373,15 @@
        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);

Reply via email to