Skip to content

Commit 0632c2b

Browse files
committed
Address PR review: style fixes and add arg/async checks to wc_SignCert_cb
1 parent e0eb6ed commit 0632c2b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

wolfcrypt/src/asn.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34343,7 +34343,7 @@ int wc_SignCert_cb(int requestSz, int sType, byte* buf, word32 buffSz,
3434334343
CertSignCtx certSignCtx_lcl;
3434434344
CertSignCtx* certSignCtx = &certSignCtx_lcl;
3434534345

34346-
if (signCb == NULL) {
34346+
if (signCb == NULL || buf == NULL) {
3434734347
return BAD_FUNC_ARG;
3434834348
}
3434934349

@@ -34365,6 +34365,14 @@ int wc_SignCert_cb(int requestSz, int sType, byte* buf, word32 buffSz,
3436534365
certSignCtx->sig, MAX_ENCODED_SIG_SZ, sType, keyType,
3436634366
signCb, signCtx, rng, NULL);
3436734367

34368+
#ifdef WOLFSSL_ASYNC_CRYPT
34369+
if (sigSz == WC_NO_ERR_TRACE(WC_PENDING_E)) {
34370+
/* Not free'ing certSignCtx->sig here because it could still be in use
34371+
* with async operations. */
34372+
return sigSz;
34373+
}
34374+
#endif
34375+
3436834376
if (sigSz >= 0) {
3436934377
if (requestSz + MAX_SEQ_SZ * 2 + sigSz > (int)buffSz) {
3437034378
sigSz = BUFFER_E;

0 commit comments

Comments
 (0)