Here are some more patches which fix the external representation of
x509v3 stuff on EBCDIC machines (esp. hex strings).

    Martin
-- 
<[EMAIL PROTECTED]>             |     Fujitsu Siemens
Fon: +49-89-636-46021, FAX: +49-89-636-41143 | 81730  Munich,  Germany
--- openssl-0.9.5a/crypto/x509v3/v3_utl.c.orig  Mon Jan 31 00:33:32 2000
+++ openssl-0.9.5a/crypto/x509v3/v3_utl.c       Thu Jul 20 22:49:33 2000
@@ -325,10 +325,11 @@
 
 /* hex string utilities */
 
 /* Given a buffer of length 'len' return a 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)
 {
        char *tmp, *q;
@@ -345,10 +346,14 @@
                *q++ = hexdig[(*p >> 4) & 0xf];
                *q++ = hexdig[*p & 0xf];
                *q++ = ':';
        }
        q[-1] = 0;
+#ifdef CHARSET_EBCDIC
+       ebcdic2ascii(tmp, tmp, q - tmp - 1);
+#endif
+
        return tmp;
 }
 
 /* Give a string of hex digits convert to
  * a buffer
@@ -363,12 +368,19 @@
                return NULL;
        }
        if(!(hexbuf = 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);
                        Free(hexbuf);
                        return NULL;
                }

Reply via email to