Unwind ASN1_ANY_AS_STRING
Now that X509_NAME is decoded directly, the template machinery does not
need to support this anymore.
Bug: 42290417
Change-Id: Idb60fc391bac392ab302342c2407f507ed4452bb
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/81895
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/crypto/asn1/internal.h b/crypto/asn1/internal.h
index 1ab7fa5..0b45f52 100644
--- a/crypto/asn1/internal.h
+++ b/crypto/asn1/internal.h
@@ -365,11 +365,6 @@
// 5280) and C type is |ASN1_STRING*|.
DECLARE_ASN1_ITEM(DISPLAYTEXT)
-// ASN1_ANY_AS_STRING is an |ASN1_ITEM| with ASN.1 type ANY and C type
-// |ASN1_STRING*|. Types which are not represented with |ASN1_STRING|, such as
-// |ASN1_OBJECT|, are represented with type |V_ASN1_OTHER|.
-DECLARE_ASN1_ITEM(ASN1_ANY_AS_STRING)
-
#if defined(__cplusplus)
} // extern C
diff --git a/crypto/asn1/tasn_dec.cc b/crypto/asn1/tasn_dec.cc
index c749d88..525edd5 100644
--- a/crypto/asn1/tasn_dec.cc
+++ b/crypto/asn1/tasn_dec.cc
@@ -649,7 +649,7 @@
}
// Handle ANY types.
- if (utype == V_ASN1_ANY || utype == V_ASN1_ANY_AS_STRING) {
+ if (utype == V_ASN1_ANY) {
if (tag >= 0) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_TAGGED_ANY);
return 0;
@@ -657,8 +657,6 @@
if (opt && CBS_len(cbs) == 0) {
return -1; // Omitted OPTIONAL value.
}
- }
- if (utype == V_ASN1_ANY) {
ASN1_TYPE *typ;
if (!*pval) {
typ = ASN1_TYPE_new();
@@ -671,13 +669,6 @@
}
return asn1_parse_any(cbs, typ);
}
- if (utype == V_ASN1_ANY_AS_STRING) {
- ASN1_STRING *str = ensure_string(pval);
- if (str == nullptr) {
- return 0;
- }
- return asn1_parse_any_as_string(cbs, str);
- }
// Convert the crypto/asn1 tag into a CBS one.
if (tag == -1) {
diff --git a/crypto/asn1/tasn_enc.cc b/crypto/asn1/tasn_enc.cc
index 9aa2039..7db1ead 100644
--- a/crypto/asn1/tasn_enc.cc
+++ b/crypto/asn1/tasn_enc.cc
@@ -543,7 +543,7 @@
}
}
- if (it->itype == ASN1_ITYPE_MSTRING || it->utype == V_ASN1_ANY_AS_STRING) {
+ if (it->itype == ASN1_ITYPE_MSTRING) {
// If MSTRING type set the underlying type
strtmp = (ASN1_STRING *)*pval;
utype = strtmp->type;
diff --git a/crypto/asn1/tasn_typ.cc b/crypto/asn1/tasn_typ.cc
index 3c1e13f..05931ee 100644
--- a/crypto/asn1/tasn_typ.cc
+++ b/crypto/asn1/tasn_typ.cc
@@ -49,7 +49,6 @@
IMPLEMENT_ASN1_TYPE(ASN1_OBJECT)
IMPLEMENT_ASN1_TYPE(ASN1_ANY)
-IMPLEMENT_ASN1_TYPE(ASN1_ANY_AS_STRING)
// Just swallow an ASN1_SEQUENCE in an ASN1_STRING
IMPLEMENT_ASN1_TYPE(ASN1_SEQUENCE)
diff --git a/include/openssl/asn1.h b/include/openssl/asn1.h
index f439acb..ada13f4 100644
--- a/include/openssl/asn1.h
+++ b/include/openssl/asn1.h
@@ -77,10 +77,6 @@
// V_ASN1_ANY is used by the ASN.1 templates to indicate an ANY type.
#define V_ASN1_ANY (-4)
-// V_ASN1_ANY_AS_STRING is used by the ASN.1 templates to indicate an ANY type
-// represented with |ASN1_STRING| instead of |ASN1_TYPE|.
-#define V_ASN1_ANY_AS_STRING (-5)
-
// The following constants are tag numbers for universal types.
#define V_ASN1_EOC 0
#define V_ASN1_BOOLEAN 1