diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/f_string.c')
-rw-r--r-- | src/lib/libcrypto/asn1/f_string.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/lib/libcrypto/asn1/f_string.c b/src/lib/libcrypto/asn1/f_string.c index ab2837824e..5d0cf5a46d 100644 --- a/src/lib/libcrypto/asn1/f_string.c +++ b/src/lib/libcrypto/asn1/f_string.c | |||
@@ -58,16 +58,13 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include "buffer.h" | 61 | #include <openssl/buffer.h> |
62 | #include "x509.h" | 62 | #include <openssl/asn1.h> |
63 | 63 | ||
64 | int i2a_ASN1_STRING(bp, a, type) | 64 | int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type) |
65 | BIO *bp; | ||
66 | ASN1_STRING *a; | ||
67 | int type; | ||
68 | { | 65 | { |
69 | int i,n=0; | 66 | int i,n=0; |
70 | static char *h="0123456789ABCDEF"; | 67 | static const char *h="0123456789ABCDEF"; |
71 | char buf[2]; | 68 | char buf[2]; |
72 | 69 | ||
73 | if (a == NULL) return(0); | 70 | if (a == NULL) return(0); |
@@ -97,11 +94,7 @@ err: | |||
97 | return(-1); | 94 | return(-1); |
98 | } | 95 | } |
99 | 96 | ||
100 | int a2i_ASN1_STRING(bp,bs,buf,size) | 97 | int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size) |
101 | BIO *bp; | ||
102 | ASN1_STRING *bs; | ||
103 | char *buf; | ||
104 | int size; | ||
105 | { | 98 | { |
106 | int ret=0; | 99 | int ret=0; |
107 | int i,j,k,m,n,again,bufsize; | 100 | int i,j,k,m,n,again,bufsize; |
@@ -130,9 +123,18 @@ int size; | |||
130 | 123 | ||
131 | for (j=i-1; j>0; j--) | 124 | for (j=i-1; j>0; j--) |
132 | { | 125 | { |
126 | #ifndef CHARSET_EBCDIC | ||
133 | if (!( ((buf[j] >= '0') && (buf[j] <= '9')) || | 127 | if (!( ((buf[j] >= '0') && (buf[j] <= '9')) || |
134 | ((buf[j] >= 'a') && (buf[j] <= 'f')) || | 128 | ((buf[j] >= 'a') && (buf[j] <= 'f')) || |
135 | ((buf[j] >= 'A') && (buf[j] <= 'F')))) | 129 | ((buf[j] >= 'A') && (buf[j] <= 'F')))) |
130 | #else | ||
131 | /* This #ifdef is not strictly necessary, since | ||
132 | * the characters A...F a...f 0...9 are contiguous | ||
133 | * (yes, even in EBCDIC - but not the whole alphabet). | ||
134 | * Nevertheless, isxdigit() is faster. | ||
135 | */ | ||
136 | if (!isxdigit(buf[j])) | ||
137 | #endif | ||
136 | { | 138 | { |
137 | i=j; | 139 | i=j; |
138 | break; | 140 | break; |