Don't include x509.h when we just need asn1.h
[openssl.git] / crypto / asn1 / f_int.c
index 4d6c9b22783b3c50289479a664fa947d7a1bc37a..55560dd814ade9dec8fd21e26e3d3cc710f55241 100644 (file)
@@ -59,7 +59,7 @@
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/buffer.h>
-#include <openssl/x509.h>
+#include <openssl/asn1.h>
 
 int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a)
        {
@@ -117,9 +117,18 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
 
                for (j=0; j<i; j++)
                        {
+#ifndef CHARSET_EBCDIC
                        if (!(  ((buf[j] >= '0') && (buf[j] <= '9')) ||
                                ((buf[j] >= 'a') && (buf[j] <= 'f')) ||
                                ((buf[j] >= 'A') && (buf[j] <= 'F'))))
+#else
+                       /* This #ifdef is not strictly necessary, since
+                        * the characters A...F a...f 0...9 are contiguous
+                        * (yes, even in EBCDIC - but not the whole alphabet).
+                        * Nevertheless, isxdigit() is faster.
+                        */
+                       if (!isxdigit(buf[j]))
+#endif
                                {
                                i=j;
                                break;