Unwind ASN1_AFLG_BROKEN.

This is never used. Remove the logic so we can gradually simply the
legacy ASN.1 code.

Update-Note: Types using ASN1_BROKEN_SEQUENCE from openssl/asn1t.h will
fail to compile. This CL should not affect certificate parsing.

Change-Id: I06b61ae2656a657aed81cd467051a494155b0963
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/43887
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
chromium-5359
David Benjamin 5 years ago
parent a93545c2e0
commit cf1c925ddb
  1. 9
      crypto/asn1/tasn_dec.c
  2. 8
      include/openssl/asn1t.h

@ -174,7 +174,6 @@ static int asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in,
unsigned char *wp = NULL; /* BIG FAT WARNING! BREAKS CONST WHERE USED */ unsigned char *wp = NULL; /* BIG FAT WARNING! BREAKS CONST WHERE USED */
unsigned char imphack = 0, oclass; unsigned char imphack = 0, oclass;
char seq_eoc, seq_nolen, cst, isopt; char seq_eoc, seq_nolen, cst, isopt;
long tmplen;
int i; int i;
int otag; int otag;
int ret = 0; int ret = 0;
@ -373,7 +372,6 @@ static int asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in,
case ASN1_ITYPE_NDEF_SEQUENCE: case ASN1_ITYPE_NDEF_SEQUENCE:
case ASN1_ITYPE_SEQUENCE: case ASN1_ITYPE_SEQUENCE:
p = *in; p = *in;
tmplen = len;
/* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */ /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */
if (tag == -1) { if (tag == -1) {
@ -388,13 +386,8 @@ static int asn1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in,
goto err; goto err;
} else if (ret == -1) } else if (ret == -1)
return -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 */ /* If indefinite we don't do a length check */
else seq_nolen = seq_eoc;
seq_nolen = seq_eoc;
if (!cst) { if (!cst) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_SEQUENCE_NOT_CONSTRUCTED); OPENSSL_PUT_ERROR(ASN1, ASN1_R_SEQUENCE_NOT_CONSTRUCTED);
goto err; goto err;

@ -151,10 +151,6 @@ extern "C" {
static const ASN1_AUX tname##_aux = {NULL, 0, 0, cb, 0}; \ static const ASN1_AUX tname##_aux = {NULL, 0, 0, cb, 0}; \
ASN1_SEQUENCE(tname) ASN1_SEQUENCE(tname)
#define ASN1_BROKEN_SEQUENCE(tname) \
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0}; \
ASN1_SEQUENCE(tname)
#define ASN1_SEQUENCE_ref(tname, cb) \ #define ASN1_SEQUENCE_ref(tname, cb) \
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), cb, 0}; \ static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), cb, 0}; \
ASN1_SEQUENCE(tname) ASN1_SEQUENCE(tname)
@ -175,8 +171,6 @@ extern "C" {
#tname \ #tname \
ASN1_ITEM_end(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_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) #define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
@ -699,8 +693,6 @@ typedef struct ASN1_STREAM_ARG_st {
#define ASN1_AFLG_REFCOUNT 1 #define ASN1_AFLG_REFCOUNT 1
/* Save the encoding of structure (useful for signatures) */ /* Save the encoding of structure (useful for signatures) */
#define ASN1_AFLG_ENCODING 2 #define ASN1_AFLG_ENCODING 2
/* The Sequence length is invalid */
#define ASN1_AFLG_BROKEN 4
/* operation values for asn1_cb */ /* operation values for asn1_cb */

Loading…
Cancel
Save