wolfcrypt/src/asn.c: fix WOLFSSL_ASYNC_CRYPT codepath in SignCert() -- fall through to non-async certSignCtx_lcl for algs without async support.

This commit is contained in:
Daniel Pouzzner
2023-03-01 17:51:25 -06:00
parent 6a7674a146
commit 51339edf47

View File

@@ -29260,15 +29260,10 @@ static int SignCert(int requestSz, int sType, byte* buf, word32 buffSz,
{ {
int sigSz = 0; int sigSz = 0;
void* heap = NULL; void* heap = NULL;
CertSignCtx* certSignCtx;
#ifndef WOLFSSL_ASYNC_CRYPT
CertSignCtx certSignCtx_lcl; CertSignCtx certSignCtx_lcl;
CertSignCtx* certSignCtx = &certSignCtx_lcl;
certSignCtx = &certSignCtx_lcl; XMEMSET(certSignCtx, 0, sizeof(*certSignCtx));
XMEMSET(certSignCtx, 0, sizeof(CertSignCtx));
#else
certSignCtx = NULL;
#endif
if (requestSz < 0) if (requestSz < 0)
return requestSz; return requestSz;
@@ -29295,12 +29290,6 @@ static int SignCert(int requestSz, int sType, byte* buf, word32 buffSz,
#endif /* HAVE_ECC */ #endif /* HAVE_ECC */
} }
#ifdef WOLFSSL_ASYNC_CRYPT
if (certSignCtx == NULL) {
return BAD_FUNC_ARG;
}
#endif
if (certSignCtx->sig == NULL) { if (certSignCtx->sig == NULL) {
certSignCtx->sig = (byte*)XMALLOC(MAX_ENCODED_SIG_SZ, heap, certSignCtx->sig = (byte*)XMALLOC(MAX_ENCODED_SIG_SZ, heap,
DYNAMIC_TYPE_TMP_BUFFER); DYNAMIC_TYPE_TMP_BUFFER);