Remove ASN1_AFLG_BROKEN.
authorjsing <jsing@openbsd.org>
Thu, 12 May 2022 19:11:14 +0000 (19:11 +0000)
committerjsing <jsing@openbsd.org>
Thu, 12 May 2022 19:11:14 +0000 (19:11 +0000)
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
lib/libcrypto/asn1/tasn_dec.c

index 2d38b0d..d02fde4 100644 (file)
@@ -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 */
 
index f3e032c..8732ab5 100644 (file)
@@ -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;