Fix ASN1_INTEGER handling. Only treat an ASN1_ANY type as an integer if it has the V_ASN1_INTEGER tag: V_ASN1_NEG_INTEGER is an internal only value which is never used for on the wire encoding. (Imported from upstream's d4b25980020821d4685752ecb9105c0902109ab5.) This is redundant with our fb2c6f8c8565e1e2d85c24408050c96521acbcdc which I think is a much better fix (having two notions of "type" depending on whether we're in an ASN1_TYPE or an ASN1_STRING is fragile), so I think we should keep our restriction too. Still, this is also worth doing. Change-Id: I6ea54aae7b517a59c6e563d8c993d0ee22e25bee Reviewed-on: https://boringssl-review.googlesource.com/7848 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/asn1/a_type.c b/crypto/asn1/a_type.c index ecd4734..734ff8b 100644 --- a/crypto/asn1/a_type.c +++ b/crypto/asn1/a_type.c
@@ -122,9 +122,7 @@ result = a->value.boolean - b->value.boolean; break; case V_ASN1_INTEGER: - case V_ASN1_NEG_INTEGER: case V_ASN1_ENUMERATED: - case V_ASN1_NEG_ENUMERATED: case V_ASN1_BIT_STRING: case V_ASN1_OCTET_STRING: case V_ASN1_SEQUENCE:
diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c index 40d575d..616b587 100644 --- a/crypto/asn1/tasn_dec.c +++ b/crypto/asn1/tasn_dec.c
@@ -894,9 +894,7 @@ break; case V_ASN1_INTEGER: - case V_ASN1_NEG_INTEGER: case V_ASN1_ENUMERATED: - case V_ASN1_NEG_ENUMERATED: tint = (ASN1_INTEGER **)pval; if (!c2i_ASN1_INTEGER(tint, &cont, len)) goto err;
diff --git a/crypto/asn1/tasn_enc.c b/crypto/asn1/tasn_enc.c index a56d08e..409d138 100644 --- a/crypto/asn1/tasn_enc.c +++ b/crypto/asn1/tasn_enc.c
@@ -609,9 +609,7 @@ break; case V_ASN1_INTEGER: - case V_ASN1_NEG_INTEGER: case V_ASN1_ENUMERATED: - case V_ASN1_NEG_ENUMERATED: /* * These are all have the same content format as ASN1_INTEGER */