diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/a_bytes.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_bytes.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/lib/libcrypto/asn1/a_bytes.c b/src/lib/libcrypto/asn1/a_bytes.c index 8d13f9c931..2407f7c87a 100644 --- a/src/lib/libcrypto/asn1/a_bytes.c +++ b/src/lib/libcrypto/asn1/a_bytes.c | |||
@@ -60,15 +60,14 @@ | |||
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
62 | 62 | ||
63 | static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c); | 63 | static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c); |
64 | /* type is a 'bitmap' of acceptable string types. | 64 | /* type is a 'bitmap' of acceptable string types. |
65 | */ | 65 | */ |
66 | ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp, | 66 | ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp, |
67 | long length, int type) | 67 | long length, int type) |
68 | { | 68 | { |
69 | ASN1_STRING *ret=NULL; | 69 | ASN1_STRING *ret=NULL; |
70 | const unsigned char *p; | 70 | unsigned char *p,*s; |
71 | unsigned char *s; | ||
72 | long len; | 71 | long len; |
73 | int inf,tag,xclass; | 72 | int inf,tag,xclass; |
74 | int i=0; | 73 | int i=0; |
@@ -79,7 +78,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
79 | 78 | ||
80 | if (tag >= 32) | 79 | if (tag >= 32) |
81 | { | 80 | { |
82 | i=ASN1_R_TAG_VALUE_TOO_HIGH;; | 81 | i=ASN1_R_TAG_VALUE_TOO_HIGH; |
83 | goto err; | 82 | goto err; |
84 | } | 83 | } |
85 | if (!(ASN1_tag2bit(tag) & type)) | 84 | if (!(ASN1_tag2bit(tag) & type)) |
@@ -154,12 +153,11 @@ int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass) | |||
154 | return(r); | 153 | return(r); |
155 | } | 154 | } |
156 | 155 | ||
157 | ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, | 156 | ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length, |
158 | long length, int Ptag, int Pclass) | 157 | int Ptag, int Pclass) |
159 | { | 158 | { |
160 | ASN1_STRING *ret=NULL; | 159 | ASN1_STRING *ret=NULL; |
161 | const unsigned char *p; | 160 | unsigned char *p,*s; |
162 | unsigned char *s; | ||
163 | long len; | 161 | long len; |
164 | int inf,tag,xclass; | 162 | int inf,tag,xclass; |
165 | int i=0; | 163 | int i=0; |
@@ -187,7 +185,7 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, | |||
187 | 185 | ||
188 | if (inf & V_ASN1_CONSTRUCTED) | 186 | if (inf & V_ASN1_CONSTRUCTED) |
189 | { | 187 | { |
190 | ASN1_const_CTX c; | 188 | ASN1_CTX c; |
191 | 189 | ||
192 | c.pp=pp; | 190 | c.pp=pp; |
193 | c.p=p; | 191 | c.p=p; |
@@ -249,7 +247,7 @@ err: | |||
249 | * them into the one structure that is then returned */ | 247 | * them into the one structure that is then returned */ |
250 | /* There have been a few bug fixes for this function from | 248 | /* There have been a few bug fixes for this function from |
251 | * Paul Keogh <paul.keogh@sse.ie>, many thanks to him */ | 249 | * Paul Keogh <paul.keogh@sse.ie>, many thanks to him */ |
252 | static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c) | 250 | static int asn1_collate_primitive(ASN1_STRING *a, ASN1_CTX *c) |
253 | { | 251 | { |
254 | ASN1_STRING *os=NULL; | 252 | ASN1_STRING *os=NULL; |
255 | BUF_MEM b; | 253 | BUF_MEM b; |
@@ -270,7 +268,7 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c) | |||
270 | { | 268 | { |
271 | if (c->inf & 1) | 269 | if (c->inf & 1) |
272 | { | 270 | { |
273 | c->eos=ASN1_const_check_infinite_end(&c->p, | 271 | c->eos=ASN1_check_infinite_end(&c->p, |
274 | (long)(c->max-c->p)); | 272 | (long)(c->max-c->p)); |
275 | if (c->eos) break; | 273 | if (c->eos) break; |
276 | } | 274 | } |
@@ -298,7 +296,7 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c) | |||
298 | num+=os->length; | 296 | num+=os->length; |
299 | } | 297 | } |
300 | 298 | ||
301 | if (!asn1_const_Finish(c)) goto err; | 299 | if (!asn1_Finish(c)) goto err; |
302 | 300 | ||
303 | a->length=num; | 301 | a->length=num; |
304 | if (a->data != NULL) OPENSSL_free(a->data); | 302 | if (a->data != NULL) OPENSSL_free(a->data); |