From c77ab724f0145e63b3ecc727d8947f1130024af2 Mon Sep 17 00:00:00 2001 From: jsing Date: Thu, 12 May 2022 19:11:14 +0000 Subject: [PATCH] Remove ASN1_AFLG_BROKEN. This workaround was used by ASN1_BROKEN_SEQUENCE, which existed for NETSCAPE_ENCRYPTED_PKEY. Remove the workaround since the only consumer has already been removed. ok tb@ --- lib/libcrypto/asn1/asn1t.h | 10 +--------- lib/libcrypto/asn1/tasn_dec.c | 12 ++---------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/lib/libcrypto/asn1/asn1t.h b/lib/libcrypto/asn1/asn1t.h index 2d38b0d0066..d02fde4ced1 100644 --- a/lib/libcrypto/asn1/asn1t.h +++ b/lib/libcrypto/asn1/asn1t.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1t.h,v 1.20 2022/05/10 05:19:22 jsing Exp $ */ +/* $OpenBSD: asn1t.h,v 1.21 2022/05/12 19:11:14 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -183,10 +183,6 @@ extern "C" { static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ ASN1_SEQUENCE(tname) -#define ASN1_BROKEN_SEQUENCE(tname) \ - static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ - ASN1_SEQUENCE(tname) - #define ASN1_SEQUENCE_ref(tname, cb, lck) \ static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \ ASN1_SEQUENCE(tname) @@ -219,8 +215,6 @@ extern "C" { #tname \ ASN1_ITEM_end(tname) -#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) - #define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) #define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) @@ -745,8 +739,6 @@ typedef struct ASN1_STREAM_ARG_st { #define ASN1_AFLG_REFCOUNT 1 /* Save the encoding of structure (useful for signatures) */ #define ASN1_AFLG_ENCODING 2 -/* The Sequence length is invalid */ -#define ASN1_AFLG_BROKEN 4 /* operation values for asn1_cb */ diff --git a/lib/libcrypto/asn1/tasn_dec.c b/lib/libcrypto/asn1/tasn_dec.c index f3e032c1c1b..8732ab53cf8 100644 --- a/lib/libcrypto/asn1/tasn_dec.c +++ b/lib/libcrypto/asn1/tasn_dec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tasn_dec.c,v 1.63 2022/05/10 18:40:06 jsing Exp $ */ +/* $OpenBSD: tasn_dec.c,v 1.64 2022/05/12 19:11:14 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -249,7 +249,6 @@ asn1_item_ex_d2i_sequence(ASN1_VALUE **pval, const unsigned char **in, long len, ASN1_aux_cb *asn1_cb = NULL; char seq_eoc, seq_nolen, cst, isopt; const unsigned char *p = NULL, *q; - long tmplen; int i; int ret = 0; @@ -261,7 +260,6 @@ asn1_item_ex_d2i_sequence(ASN1_VALUE **pval, const unsigned char **in, long len, asn1_cb = aux->asn1_cb; p = *in; - tmplen = len; /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */ if (tag == -1) { @@ -276,13 +274,7 @@ asn1_item_ex_d2i_sequence(ASN1_VALUE **pval, const unsigned char **in, long len, goto err; } else if (ret == -1) return -1; - if (aux && (aux->flags & ASN1_AFLG_BROKEN)) { - len = tmplen - (p - *in); - seq_nolen = 1; - } - /* If indefinite we don't do a length check */ - else - seq_nolen = seq_eoc; + seq_nolen = seq_eoc; if (!cst) { ASN1error(ASN1_R_SEQUENCE_NOT_CONSTRUCTED); goto err; -- 2.20.1