summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/f_int.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_int.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_int.c')
-rw-r--r--src/lib/libcrypto/asn1/f_int.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/lib/libcrypto/asn1/f_int.c b/src/lib/libcrypto/asn1/f_int.c
index 4817c45cb7..55560dd814 100644
--- a/src/lib/libcrypto/asn1/f_int.c
+++ b/src/lib/libcrypto/asn1/f_int.c
@@ -58,15 +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_INTEGER(bp, a) 64int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a)
65BIO *bp;
66ASN1_INTEGER *a;
67 { 65 {
68 int i,n=0; 66 int i,n=0;
69 static char *h="0123456789ABCDEF"; 67 static const char *h="0123456789ABCDEF";
70 char buf[2]; 68 char buf[2];
71 69
72 if (a == NULL) return(0); 70 if (a == NULL) return(0);
@@ -96,11 +94,7 @@ err:
96 return(-1); 94 return(-1);
97 } 95 }
98 96
99int a2i_ASN1_INTEGER(bp,bs,buf,size) 97int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
100BIO *bp;
101ASN1_INTEGER *bs;
102char *buf;
103int size;
104 { 98 {
105 int ret=0; 99 int ret=0;
106 int i,j,k,m,n,again,bufsize; 100 int i,j,k,m,n,again,bufsize;
@@ -123,9 +117,18 @@ int size;
123 117
124 for (j=0; j<i; j++) 118 for (j=0; j<i; j++)
125 { 119 {
120#ifndef CHARSET_EBCDIC
126 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) || 121 if (!( ((buf[j] >= '0') && (buf[j] <= '9')) ||
127 ((buf[j] >= 'a') && (buf[j] <= 'f')) || 122 ((buf[j] >= 'a') && (buf[j] <= 'f')) ||
128 ((buf[j] >= 'A') && (buf[j] <= 'F')))) 123 ((buf[j] >= 'A') && (buf[j] <= 'F'))))
124#else
125 /* This #ifdef is not strictly necessary, since
126 * the characters A...F a...f 0...9 are contiguous
127 * (yes, even in EBCDIC - but not the whole alphabet).
128 * Nevertheless, isxdigit() is faster.
129 */
130 if (!isxdigit(buf[j]))
131#endif
129 { 132 {
130 i=j; 133 i=j;
131 break; 134 break;