summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/asn1_lib.c
diff options
context:
space:
mode:
authorjsing <>2018-10-24 17:57:22 +0000
committerjsing <>2018-10-24 17:57:22 +0000
commit4110681dbe8efbf5d13eeff4afa956673068e8fd (patch)
treec4bde435c9466178df1c42e0747e9ccbe096ea27 /src/lib/libcrypto/asn1/asn1_lib.c
parente8a59701f7438ac9a23dda80591f6a625f5d6054 (diff)
downloadopenbsd-4110681dbe8efbf5d13eeff4afa956673068e8fd.tar.gz
openbsd-4110681dbe8efbf5d13eeff4afa956673068e8fd.tar.bz2
openbsd-4110681dbe8efbf5d13eeff4afa956673068e8fd.zip
Remove a bunch of ancient and highly crufty ASN.1 related code from
libcrypto (the "new" stuff replaced this back around 2000 or so...). ok tb@
Diffstat (limited to 'src/lib/libcrypto/asn1/asn1_lib.c')
-rw-r--r--src/lib/libcrypto/asn1/asn1_lib.c58
1 files changed, 1 insertions, 57 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c
index ffd3ad6a46..2a123d1d9a 100644
--- a/src/lib/libcrypto/asn1/asn1_lib.c
+++ b/src/lib/libcrypto/asn1/asn1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_lib.c,v 1.41 2018/04/25 11:48:21 tb Exp $ */ 1/* $OpenBSD: asn1_lib.c,v 1.42 2018/10/24 17:57:22 jsing 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 *
@@ -285,62 +285,6 @@ ASN1_object_size(int constructed, int length, int tag)
285 return (ret); 285 return (ret);
286} 286}
287 287
288static int
289_asn1_Finish(ASN1_const_CTX *c)
290{
291 if ((c->inf == (1|V_ASN1_CONSTRUCTED)) && (!c->eos)) {
292 if (!ASN1_const_check_infinite_end(&c->p, c->slen)) {
293 c->error = ERR_R_MISSING_ASN1_EOS;
294 return (0);
295 }
296 }
297 if (((c->slen != 0) && !(c->inf & 1)) ||
298 ((c->slen < 0) && (c->inf & 1))) {
299 c->error = ERR_R_ASN1_LENGTH_MISMATCH;
300 return (0);
301 }
302 return (1);
303}
304
305int
306asn1_Finish(ASN1_CTX *c)
307{
308 return _asn1_Finish((ASN1_const_CTX *)c);
309}
310
311int
312asn1_const_Finish(ASN1_const_CTX *c)
313{
314 return _asn1_Finish(c);
315}
316
317int
318asn1_GetSequence(ASN1_const_CTX *c, long *length)
319{
320 const unsigned char *q;
321
322 q = c->p;
323 c->inf = ASN1_get_object(&(c->p), &(c->slen), &(c->tag), &(c->xclass),
324 *length);
325 if (c->inf & 0x80) {
326 c->error = ERR_R_BAD_GET_ASN1_OBJECT_CALL;
327 return (0);
328 }
329 if (c->tag != V_ASN1_SEQUENCE) {
330 c->error = ERR_R_EXPECTING_AN_ASN1_SEQUENCE;
331 return (0);
332 }
333 (*length) -= (c->p - q);
334 if (c->max && (*length < 0)) {
335 c->error = ERR_R_ASN1_LENGTH_MISMATCH;
336 return (0);
337 }
338 if (c->inf == (1|V_ASN1_CONSTRUCTED))
339 c->slen= *length+ *(c->pp) - c->p;
340 c->eos = 0;
341 return (1);
342}
343
344int 288int
345ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str) 289ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)
346{ 290{