From 35ad30b2b37f9b86b8a1c6007e15ab97d2c59aaf Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Sun, 24 Jan 2021 21:36:26 -0600 Subject: [PATCH] asn1/hx509: Undo workaround for fixed bug Now that the ASN.1 compiler properly supports IMPLICIT tagging of named CHOICE types (meaning: treat them as EXPLICIT tags), we can remove one workaround for that. --- lib/asn1/rfc2459.asn1 | 4 +--- lib/hx509/ca.c | 3 +-- lib/hx509/cert.c | 2 +- lib/hx509/req.c | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/asn1/rfc2459.asn1 b/lib/asn1/rfc2459.asn1 index 4b493b018..2583d0a21 100644 --- a/lib/asn1/rfc2459.asn1 +++ b/lib/asn1/rfc2459.asn1 @@ -298,9 +298,7 @@ GeneralName ::= CHOICE { rfc822Name [1] IMPLICIT IA5String, dNSName [2] IMPLICIT IA5String, -- x400Address [3] IMPLICIT ORAddress,-- - directoryName [4] IMPLICIT -- Name -- CHOICE { - rdnSequence RDNSequence - }, + directoryName [4] IMPLICIT Name, -- ediPartyName [5] IMPLICIT EDIPartyName, -- uniformResourceIdentifier [6] IMPLICIT IA5String, iPAddress [7] IMPLICIT OCTET STRING, diff --git a/lib/hx509/ca.c b/lib/hx509/ca.c index e2353f54c..e93366fe4 100644 --- a/lib/hx509/ca.c +++ b/lib/hx509/ca.c @@ -2194,8 +2194,7 @@ get_AuthorityKeyIdentifier(hx509_context context, memset(&gn, 0, sizeof(gn)); gn.element = choice_GeneralName_directoryName; - gn.u.directoryName.element = - choice_GeneralName_directoryName_rdnSequence; + gn.u.directoryName.element = choice_GeneralName_directoryName; gn.u.directoryName.u.rdnSequence = name.u.rdnSequence; ret = add_GeneralNames(&gns, &gn); diff --git a/lib/hx509/cert.c b/lib/hx509/cert.c index f81542eef..355da4014 100644 --- a/lib/hx509/cert.c +++ b/lib/hx509/cert.c @@ -2074,7 +2074,7 @@ match_tree(const GeneralSubtrees *t, const Certificate *c, int *match) memset(&certname, 0, sizeof(certname)); certname.element = choice_GeneralName_directoryName; - certname.u.directoryName.element = (enum GeneralName_directoryName_enum) + certname.u.directoryName.element = (enum Name_enum) c->tbsCertificate.subject.element; certname.u.directoryName.u.rdnSequence = c->tbsCertificate.subject.u.rdnSequence; diff --git a/lib/hx509/req.c b/lib/hx509/req.c index e5e316201..1d5a2f39a 100644 --- a/lib/hx509/req.c +++ b/lib/hx509/req.c @@ -1360,8 +1360,7 @@ hx509_request_get_san(hx509_request req, case HX509_SAN_TYPE_DN: { Name name; - if (san->u.directoryName.element == - choice_GeneralName_directoryName_rdnSequence) { + if (san->u.directoryName.element == choice_Name_rdnSequence) { name.element = choice_Name_rdnSequence; name.u.rdnSequence = san->u.directoryName.u.rdnSequence; return _hx509_Name_to_string(&name, out);