Skip to content

Add WOLFSSL_ASYNC_CERT_YIELD: per-certificate non-blocking yield#10738

Open
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:zd_ecc_nonblock_certchain
Open

Add WOLFSSL_ASYNC_CERT_YIELD: per-certificate non-blocking yield#10738
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:zd_ecc_nonblock_certchain

Conversation

@dgarske

@dgarske dgarske commented Jun 18, 2026

Copy link
Copy Markdown
Member

Adds an opt-in build option, WOLFSSL_ASYNC_CERT_YIELD, that makes ProcessPeerCerts() return WC_PENDING_E to the caller after each certificate in the peer's chain (and after the leaf) is verified, instead of verifying the whole chain in one wolfSSL_connect() / wolfSSL_accept() call. This lets a cooperative, single-threaded scheduler regain control between certificates to service a watchdog. Requires WOLFSSL_ASYNC_CRYPT; off by default. Independent of WC_ECC_NONBLOCK (which subdivides each verify further).

ZD 21071

@dgarske dgarske self-assigned this Jun 18, 2026
Copilot AI review requested due to automatic review settings June 18, 2026 22:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in asynchronous handshake behavior (WOLFSSL_ASYNC_CERT_YIELD) to cooperatively yield control between peer certificate chain elements during verification, returning WC_PENDING_E after each certificate so single-threaded schedulers can regain control (e.g., to service a watchdog).

Changes:

  • Add a persistent ssl->options.certYieldPending flag (gated on WOLFSSL_ASYNC_CRYPT && WOLFSSL_ASYNC_CERT_YIELD) to reliably distinguish “fresh entry” vs “resume after deliberate yield”.
  • Update ProcessPeerCerts() to deliberately return WC_PENDING_E after each chain certificate verify and once after the leaf verify, and to resume correctly on re-entry.
  • Extend async examples + CI to exercise multi-certificate chains (--cert-chain) and validate the yield behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
wolfssl/internal.h Adds Options.certYieldPending bit to persist deliberate-yield state across re-entry.
src/ssl.c Clears certYieldPending in wolfSSL_clear() so abandoned handshakes can restart cleanly.
src/internal.c Implements per-certificate WC_PENDING_E yield points in ProcessPeerCerts() and a re-entry path keyed by certYieldPending.
README-async.md Documents WOLFSSL_ASYNC_CERT_YIELD, intended usage model, and the “no async event queued” caveat.
examples/async/async_server.c Adds --cert-chain option and constructs a 2-cert ECC chain in-memory for testing peer chain processing.
examples/async/async_client.c Adds --cert-chain option and loads the appropriate CA buffer for verifying the presented chain.
.github/workflows/async-examples.yml Adds a CI job to build/run async examples with -DWOLFSSL_ASYNC_CERT_YIELD and assert expected yielding behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dgarske dgarske force-pushed the zd_ecc_nonblock_certchain branch from bc00ce6 to c431ad6 Compare June 19, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants