diff options
author | tb <> | 2021-11-18 15:58:31 +0000 |
---|---|---|
committer | tb <> | 2021-11-18 15:58:31 +0000 |
commit | 92b13b248651f8593c8898bbdd8dc9823b1c1afd (patch) | |
tree | 36ced11a167b18f3291215909133f992261e8c01 /src/lib | |
parent | 9a6e983510f485da5b791291059e631e08827ed4 (diff) | |
download | openbsd-92b13b248651f8593c8898bbdd8dc9823b1c1afd.tar.gz openbsd-92b13b248651f8593c8898bbdd8dc9823b1c1afd.tar.bz2 openbsd-92b13b248651f8593c8898bbdd8dc9823b1c1afd.zip |
Remove the last pointless use of ASN1_const_CTX. Both ASN1_CTX and
ASN1_const_CTX are now unused and will be garbage collected in the
next libcrypto bump.
ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/asn1/a_d2i_fp.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/libcrypto/asn1/a_d2i_fp.c b/src/lib/libcrypto/asn1/a_d2i_fp.c index 390a1072d5..907ddd0aa9 100644 --- a/src/lib/libcrypto/asn1/a_d2i_fp.c +++ b/src/lib/libcrypto/asn1/a_d2i_fp.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_d2i_fp.c,v 1.16 2017/01/29 17:49:22 beck Exp $ */ | 1 | /* $OpenBSD: a_d2i_fp.c,v 1.17 2021/11/18 15:58:31 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -150,8 +150,9 @@ asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) | |||
150 | { | 150 | { |
151 | BUF_MEM *b; | 151 | BUF_MEM *b; |
152 | unsigned char *p; | 152 | unsigned char *p; |
153 | int i; | 153 | const unsigned char *q; |
154 | ASN1_const_CTX c; | 154 | long slen; |
155 | int i, inf, tag, xclass; | ||
155 | size_t want = HEADER_SIZE; | 156 | size_t want = HEADER_SIZE; |
156 | int eos = 0; | 157 | int eos = 0; |
157 | size_t off = 0; | 158 | size_t off = 0; |
@@ -189,10 +190,9 @@ asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) | |||
189 | /* else data already loaded */ | 190 | /* else data already loaded */ |
190 | 191 | ||
191 | p = (unsigned char *) & (b->data[off]); | 192 | p = (unsigned char *) & (b->data[off]); |
192 | c.p = p; | 193 | q = p; |
193 | c.inf = ASN1_get_object(&(c.p), &(c.slen), &(c.tag), | 194 | inf = ASN1_get_object(&q, &slen, &tag, &xclass, len - off); |
194 | &(c.xclass), len - off); | 195 | if (inf & 0x80) { |
195 | if (c.inf & 0x80) { | ||
196 | unsigned long e; | 196 | unsigned long e; |
197 | 197 | ||
198 | e = ERR_GET_REASON(ERR_peek_error()); | 198 | e = ERR_GET_REASON(ERR_peek_error()); |
@@ -201,10 +201,10 @@ asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) | |||
201 | else | 201 | else |
202 | ERR_clear_error(); /* clear error */ | 202 | ERR_clear_error(); /* clear error */ |
203 | } | 203 | } |
204 | i = c.p - p; /* header length */ | 204 | i = q - p; /* header length */ |
205 | off += i; /* end of data */ | 205 | off += i; /* end of data */ |
206 | 206 | ||
207 | if (c.inf & 1) { | 207 | if (inf & 1) { |
208 | /* no data body so go round again */ | 208 | /* no data body so go round again */ |
209 | eos++; | 209 | eos++; |
210 | if (eos < 0) { | 210 | if (eos < 0) { |
@@ -212,7 +212,7 @@ asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) | |||
212 | goto err; | 212 | goto err; |
213 | } | 213 | } |
214 | want = HEADER_SIZE; | 214 | want = HEADER_SIZE; |
215 | } else if (eos && (c.slen == 0) && (c.tag == V_ASN1_EOC)) { | 215 | } else if (eos && slen == 0 && tag == V_ASN1_EOC) { |
216 | /* eos value, so go back and read another header */ | 216 | /* eos value, so go back and read another header */ |
217 | eos--; | 217 | eos--; |
218 | if (eos <= 0) | 218 | if (eos <= 0) |
@@ -220,8 +220,8 @@ asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) | |||
220 | else | 220 | else |
221 | want = HEADER_SIZE; | 221 | want = HEADER_SIZE; |
222 | } else { | 222 | } else { |
223 | /* suck in c.slen bytes of data */ | 223 | /* suck in slen bytes of data */ |
224 | want = c.slen; | 224 | want = slen; |
225 | if (want > (len - off)) { | 225 | if (want > (len - off)) { |
226 | size_t chunk_max = ASN1_CHUNK_INITIAL_SIZE; | 226 | size_t chunk_max = ASN1_CHUNK_INITIAL_SIZE; |
227 | 227 | ||
@@ -262,11 +262,11 @@ asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) | |||
262 | chunk_max *= 2; | 262 | chunk_max *= 2; |
263 | } | 263 | } |
264 | } | 264 | } |
265 | if (off + c.slen < off) { | 265 | if (off + slen < off) { |
266 | ASN1error(ASN1_R_TOO_LONG); | 266 | ASN1error(ASN1_R_TOO_LONG); |
267 | goto err; | 267 | goto err; |
268 | } | 268 | } |
269 | off += c.slen; | 269 | off += slen; |
270 | if (eos <= 0) { | 270 | if (eos <= 0) { |
271 | break; | 271 | break; |
272 | } else | 272 | } else |