summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/f_string.c
diff options
context:
space:
mode:
authorbeck <>1999-09-29 04:37:45 +0000
committerbeck <>1999-09-29 04:37:45 +0000
commitde8f24ea083384bb66b32ec105dc4743c5663cdf (patch)
tree1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/asn1/f_string.c
parentcb929d29896bcb87c2a97417fbd03e50078fc178 (diff)
downloadopenbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz
openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2
openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip
OpenSSL 0.9.4 merge
Diffstat (limited to 'src/lib/libcrypto/asn1/f_string.c')
-rw-r--r--src/lib/libcrypto/asn1/f_string.c26
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
64int i2a_ASN1_STRING(bp, a, type) 64int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type)
65BIO *bp;
66ASN1_STRING *a;
67int 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
100int a2i_ASN1_STRING(bp,bs,buf,size) 97int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
101BIO *bp;
102ASN1_STRING *bs;
103char *buf;
104int 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;