Hi again,
Here are some fixes for EBCDIC systems. The "string correctness" test
routines in asn1/a_mbstr.c were not prepared for EBCDIC yet.
Also, I *think* I also fixed a bug in req.c which didn't convert
a line read from the user (at least, Ralf's mkcert.sh and an Apache+mod_ssl
server work fine with this patch).
Martin
--
<[EMAIL PROTECTED]> | Fujitsu Siemens
Fon: +49-89-636-46021, FAX: +49-89-636-41143 | 81730 Munich, Germany
--- apps/req.c.orig Tue Mar 14 00:54:07 2000
+++ apps/req.c Thu Jul 20 01:14:04 2000
@@ -1081,11 +1081,15 @@
type=v->name;
/* Skip past any leading X. X: X, etc to allow for
* 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;
}
if (!X509_NAME_add_entry_by_txt(subj,type, MBSTRING_ASC,
@@ -1197,10 +1201,13 @@
{
BIO_printf(bio_err,"weird input :-(\n");
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,
(unsigned char *)buf, -1)) {
BIO_printf(bio_err, "Error adding attribute\n");
--- crypto/asn1/a_mbstr.c.orig Thu Jul 20 01:16:14 2000
+++ crypto/asn1/a_mbstr.c Thu Jul 20 01:34:05 2000
@@ -380,11 +380,18 @@
if(value > 0x7f) return 0;
ch = (int) 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;
}