From 1fa2d2d6256dfda99ffd57f10c995be2357d6024 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Wed, 14 Aug 2024 14:42:56 -0500 Subject: [PATCH] ASN: move DecodedCert.extSubjKeyIdSz and .extAuthKeyIdSz out of the OPENSSL_EXTRA gate. fixes test.c:certext_test(), broken by f8c968d8d1 for some valid configs. --- wolfcrypt/src/asn.c | 5 +++-- wolfssl/wolfcrypt/asn.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 58391e31a..2d9d2b46e 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -19717,13 +19717,14 @@ static int DecodeAuthKeyId(const byte* input, word32 sz, DecodedCert* cert) return ASN_PARSE_E; } + cert->extAuthKeyIdSz = length; + #if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) #ifdef WOLFSSL_AKID_NAME cert->extRawAuthKeyIdSrc = input; cert->extRawAuthKeyIdSz = sz; #endif cert->extAuthKeyIdSrc = &input[idx]; - cert->extAuthKeyIdSz = length; #endif /* OPENSSL_EXTRA */ return GetHashId(input + idx, length, cert->extAuthKeyId, @@ -19819,9 +19820,9 @@ static int DecodeSubjKeyId(const byte* input, word32 sz, DecodedCert* cert) ret = GetOctetString(input, &idx, &length, sz); if (ret > 0) { + cert->extSubjKeyIdSz = (word32)length; #if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) cert->extSubjKeyIdSrc = &input[idx]; - cert->extSubjKeyIdSz = (word32)length; #endif /* OPENSSL_EXTRA */ /* Get the hash or hash of the hash if wrong size. */ diff --git a/wolfssl/wolfcrypt/asn.h b/wolfssl/wolfcrypt/asn.h index 4d8c63721..d9465a0d9 100644 --- a/wolfssl/wolfcrypt/asn.h +++ b/wolfssl/wolfcrypt/asn.h @@ -1724,7 +1724,9 @@ struct DecodedCert { const byte* extCrlInfo; /* CRL Distribution Points */ int extCrlInfoSz; /* length of the URI */ byte extSubjKeyId[KEYID_SIZE]; /* Subject Key ID */ + word32 extSubjKeyIdSz; byte extAuthKeyId[KEYID_SIZE]; /* Authority Key ID */ + word32 extAuthKeyIdSz; #ifdef WOLFSSL_AKID_NAME const byte* extAuthKeyIdIssuer; /* Authority Key ID authorityCertIssuer */ word32 extAuthKeyIdIssuerSz; /* Authority Key ID authorityCertIssuer length */ @@ -1751,9 +1753,7 @@ struct DecodedCert { word32 extRawAuthKeyIdSz; #endif const byte* extAuthKeyIdSrc; - word32 extAuthKeyIdSz; const byte* extSubjKeyIdSrc; - word32 extSubjKeyIdSz; #endif #ifdef OPENSSL_ALL const byte* extSubjAltNameSrc;