Skip to content

Commit

Permalink
ASN: move DecodedCert.extSubjKeyIdSz and .extAuthKeyIdSz out of the O…
Browse files Browse the repository at this point in the history
…PENSSL_EXTRA gate. fixes test.c:certext_test(), broken by f8c968d for some valid configs.
  • Loading branch information
douzzer committed Aug 14, 2024
1 parent 21484ec commit 1fa2d2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions wolfcrypt/src/asn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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. */
Expand Down
4 changes: 2 additions & 2 deletions wolfssl/wolfcrypt/asn.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
Expand Down

0 comments on commit 1fa2d2d

Please sign in to comment.