EBCDIC support.
[openssl.git] / crypto / x509v3 / v3_prn.c
index dc20c6bdba60752c1b73f5c7378687aa7e9d4031..bee624c6be9a1f3dd0e0f6b31e2bcdd64c27ce08 100644 (file)
@@ -81,7 +81,15 @@ void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, int ml)
                nval = sk_CONF_VALUE_value(val, i);
                if(!nval->name) BIO_puts(out, nval->value);
                else if(!nval->value) BIO_puts(out, nval->name);
+#ifndef CHARSET_EBCDIC
                else BIO_printf(out, "%s:%s", nval->name, nval->value);
+#else
+               else {
+                       char tmp[10240]; /* 10k is BIO_printf's limit anyway */
+                       ascii2ebcdic(tmp, nval->value, strlen(nval->value)+1);
+                       BIO_printf(out, "%s:%s", nval->name, tmp);
+               }
+#endif
                if(ml) BIO_puts(out, "\n");
        }
 }
@@ -103,7 +111,15 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, int flag, int indent)
                        ok = 0;
                        goto err;
                }
+#ifndef CHARSET_EBCDIC
                BIO_printf(out, "%*s%s", indent, "", value);
+#else
+               {
+                       char tmp[10240]; /* 10k is BIO_printf's limit anyway */
+                       ascii2ebcdic(tmp, value, strlen(value)+1);
+                       BIO_printf(out, "%*s%s", indent, "", tmp);
+               }
+#endif
        } else if(method->i2v) {
                if(!(nval = method->i2v(method, ext_str, NULL))) {
                        ok = 0;