Skip to content

Commit

Permalink
Restore the X509_EXTENSION ASN1_ITEM too
Browse files Browse the repository at this point in the history
wpa_supplicant also depends on that one.

Change-Id: I6abb505d076eb258e6b8d68be42e624f4aedc725
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/64947
Auto-Submit: David Benjamin <[email protected]>
Commit-Queue: Bob Beck <[email protected]>
Reviewed-by: Bob Beck <[email protected]>
  • Loading branch information
davidben authored and Boringssl LUCI CQ committed Dec 19, 2023
1 parent 89dd8d9 commit 538b2a6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
22 changes: 22 additions & 0 deletions crypto/asn1/asn1_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2828,6 +2828,12 @@ struct EMBED_X509_ALGOR {
STACK_OF(X509_ALGOR) *seq;
};

struct EMBED_X509_EXTENSION {
X509_EXTENSION *simple;
X509_EXTENSION *opt;
STACK_OF(X509_EXTENSION) *seq;
};

struct EMBED_X509_NAME {
X509_NAME *simple;
X509_NAME *opt;
Expand Down Expand Up @@ -2856,6 +2862,14 @@ ASN1_SEQUENCE(EMBED_X509_NAME) = {
} ASN1_SEQUENCE_END(EMBED_X509_NAME)
IMPLEMENT_ASN1_FUNCTIONS(EMBED_X509_NAME)

DECLARE_ASN1_FUNCTIONS(EMBED_X509_EXTENSION)
ASN1_SEQUENCE(EMBED_X509_EXTENSION) = {
ASN1_SIMPLE(EMBED_X509_EXTENSION, simple, X509_EXTENSION),
ASN1_EXP_OPT(EMBED_X509_EXTENSION, opt, X509_EXTENSION, 0),
ASN1_IMP_SEQUENCE_OF_OPT(EMBED_X509_EXTENSION, seq, X509_EXTENSION, 1),
} ASN1_SEQUENCE_END(EMBED_X509_EXTENSION)
IMPLEMENT_ASN1_FUNCTIONS(EMBED_X509_EXTENSION)

DECLARE_ASN1_FUNCTIONS(EMBED_X509)
ASN1_SEQUENCE(EMBED_X509) = {
ASN1_SIMPLE(EMBED_X509, simple, X509),
Expand Down Expand Up @@ -2940,6 +2954,14 @@ TEST(ASN1Test, EmbedTypes) {
EMBED_X509_NAME_free, d2i_EMBED_X509_NAME, i2d_EMBED_X509_NAME,
sk_X509_NAME_num, sk_X509_NAME_value);

static const uint8_t kTestExtension[] = {0x30, 0x0c, 0x06, 0x03, 0x55,
0x1d, 0x13, 0x04, 0x05, 0x30,
0x03, 0x01, 0x01, 0xf};
TestEmbedType(kTestExtension, i2d_X509_EXTENSION, EMBED_X509_EXTENSION_new,
EMBED_X509_EXTENSION_free, d2i_EMBED_X509_EXTENSION,
i2d_EMBED_X509_EXTENSION, sk_X509_EXTENSION_num,
sk_X509_EXTENSION_value);

static const uint8_t kTestCert[] = {
0x30, 0x82, 0x01, 0xcf, 0x30, 0x82, 0x01, 0x76, 0xa0, 0x03, 0x02, 0x01,
0x02, 0x02, 0x09, 0x00, 0xd9, 0x4c, 0x04, 0xda, 0x49, 0x7d, 0xbf, 0xeb,
Expand Down
4 changes: 4 additions & 0 deletions include/openssl/x509.h
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,10 @@ OPENSSL_EXPORT const ASN1_BIT_STRING *X509_PUBKEY_get0_public_key(
// determined by the extension type. This library represents extensions with the
// |X509_EXTENSION| type.

// X509_EXTENSION is an |ASN1_ITEM| whose ASN.1 type is X.509 Extension (RFC
// 5280) and C type is |X509_EXTENSION*|.
DECLARE_ASN1_ITEM(X509_EXTENSION)

// X509_EXTENSION_new returns a newly-allocated, empty |X509_EXTENSION| object
// or NULL on error.
OPENSSL_EXPORT X509_EXTENSION *X509_EXTENSION_new(void);
Expand Down

0 comments on commit 538b2a6

Please sign in to comment.