From 1af3ea56c8673903123139e6d3d0d01d155367dd Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Thu, 20 Jan 2022 16:16:09 +1000 Subject: [PATCH] Cert: allow allocation of fields even with WOLFSSL_NO_MALLOC subjectCN and publicKey in a DecodedCert are needed by the certificate store in some cases. For embedded, allow them to be allocated even with WOLFSSL_NO_MALLOC defined. --- wolfcrypt/src/asn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 71a87cb6d..b0668c2ba 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -17629,7 +17629,7 @@ static int DecodeCertReq(DecodedCert* cert, int* criticalExt) int ParseCert(DecodedCert* cert, int type, int verify, void* cm) { int ret; -#ifndef WOLFSSL_NO_MALLOC +#if !defined(WOLFSSL_NO_MALLOC) || defined(WOLFSSL_DYN_CERT) char* ptr; #endif @@ -17637,7 +17637,7 @@ int ParseCert(DecodedCert* cert, int type, int verify, void* cm) if (ret < 0) return ret; -#ifndef WOLFSSL_NO_MALLOC +#if !defined(WOLFSSL_NO_MALLOC) || defined(WOLFSSL_DYN_CERT) /* cert->subjectCN not stored as copy of WOLFSSL_NO_MALLOC defind */ if (cert->subjectCNLen > 0) { ptr = (char*) XMALLOC(cert->subjectCNLen + 1, cert->heap, @@ -17651,7 +17651,7 @@ int ParseCert(DecodedCert* cert, int type, int verify, void* cm) } #endif -#ifndef WOLFSSL_NO_MALLOC +#if !defined(WOLFSSL_NO_MALLOC) || defined(WOLFSSL_DYN_CERT) /* cert->publicKey not stored as copy if WOLFSSL_NO_MALLOC defined */ if (cert->keyOID == RSAk && cert->publicKey != NULL && cert->pubKeySize > 0) {