Skip to content

Commit 78bba7e

Browse files
committed
Fix for TLS with WOLFSSL_SMALL_CERT_VERIFY
1 parent 8c30cfb commit 78bba7e

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

wolfcrypt/src/asn.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18474,17 +18474,22 @@ int ConfirmSignature(SignatureCtx* sigCtx,
1847418474
}
1847518475
#if defined(WC_ECC_NONBLOCK) && defined(WOLFSSL_ASYNC_CRYPT_SW) && \
1847618476
defined(WC_ASYNC_ENABLE_ECC)
18477-
nbCtx = (ecc_nb_ctx_t*)XMALLOC(sizeof(ecc_nb_ctx_t),
18478-
sigCtx->heap, DYNAMIC_TYPE_TMP_BUFFER);
18479-
if (nbCtx == NULL) {
18480-
ERROR_OUT(MEMORY_E, exit_cs);
18481-
}
18477+
/* Only set non-blocking context when async device is
18478+
* active. With INVALID_DEVID there is no async loop to
18479+
* retry on FP_WOULDBLOCK, so let the WC_ECC_NONBLOCK_ONLY
18480+
* blocking fallback handle it instead. */
18481+
if (sigCtx->devId != INVALID_DEVID) {
18482+
nbCtx = (ecc_nb_ctx_t*)XMALLOC(sizeof(ecc_nb_ctx_t),
18483+
sigCtx->heap, DYNAMIC_TYPE_TMP_BUFFER);
18484+
if (nbCtx == NULL) {
18485+
ERROR_OUT(MEMORY_E, exit_cs);
18486+
}
1848218487

18483-
ret = wc_ecc_set_nonblock(sigCtx->key.ecc, nbCtx);
18484-
if (ret != 0) {
18485-
goto exit_cs;
18488+
ret = wc_ecc_set_nonblock(sigCtx->key.ecc, nbCtx);
18489+
if (ret != 0) {
18490+
goto exit_cs;
18491+
}
1848618492
}
18487-
1848818493
#endif /* WC_ECC_NONBLOCK && WOLFSSL_ASYNC_CRYPT_SW &&
1848918494
WC_ASYNC_ENABLE_ECC */
1849018495
ret = wc_EccPublicKeyDecode(key, &idx, sigCtx->key.ecc,

0 commit comments

Comments
 (0)