From bfacbf9764ff9cb4b94e302eeb6cde682e9e5f9b Mon Sep 17 00:00:00 2001 From: Kareem Date: Thu, 10 Jul 2025 11:47:47 -0700 Subject: [PATCH] Update ASN original to also allow larger pathLen values in Basic Constraints. --- wolfcrypt/src/asn.c | 6 +++--- wolfssl/wolfcrypt/asn.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 6abeb22a7..bf859b1e6 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -2744,7 +2744,7 @@ int GetASNInt(const byte* input, word32* inOutIdx, int* len, } #ifndef WOLFSSL_ASN_TEMPLATE -#ifndef NO_CERTS +#if !defined(NO_CERTS) && defined(WOLFSSL_CUSTOM_CURVES) /* Get the DER/BER encoding of an ASN.1 INTEGER that has a value of no more than * 7 bits. * @@ -2776,7 +2776,7 @@ static int GetInteger7Bit(const byte* input, word32* inOutIdx, word32 maxIdx) } #endif /* !NO_CERTS */ -#if defined(WC_RSA_PSS) && !defined(NO_RSA) +#if ((defined(WC_RSA_PSS) && !defined(NO_RSA)) || !defined(NO_CERTS)) /* Get the DER/BER encoding of an ASN.1 INTEGER that has a value of no more than * 16 bits. * @@ -20611,7 +20611,7 @@ static int DecodeBasicCaConstraint(const byte* input, int sz, DecodedCert* cert) return 0; } - ret = GetInteger7Bit(input, &idx, (word32)sz); + ret = GetInteger16Bit(input, &idx, (word32)sz); if (ret < 0) return ret; cert->pathLength = (byte)ret; diff --git a/wolfssl/wolfcrypt/asn.h b/wolfssl/wolfcrypt/asn.h index 5aab67207..a2e63e5c5 100644 --- a/wolfssl/wolfcrypt/asn.h +++ b/wolfssl/wolfcrypt/asn.h @@ -1943,7 +1943,7 @@ struct Signer { word32 pubKeySize; word32 keyOID; /* key type */ word16 keyUsage; - word16 maxPathLen; + word16 maxPathLen; WC_BITFIELD selfSigned:1; const byte* publicKey; int nameLen;