Skip to content

Report X509_VERIFY_PARAM hostname/IP mismatches to the verify callback so applications can inspect or override them - #11156

Open
gasbytes wants to merge 1 commit into
wolfSSL:masterfrom
gasbytes:x509_store_ctx_verify_cb_fix
Open

Report X509_VERIFY_PARAM hostname/IP mismatches to the verify callback so applications can inspect or override them#11156
gasbytes wants to merge 1 commit into
wolfSSL:masterfrom
gasbytes:x509_store_ctx_verify_cb_fix

Conversation

@gasbytes

Copy link
Copy Markdown
Contributor

Description

Call the application verify callback on X509_VERIFY_PARAM hostname/IP mismatches in wolfSSL_X509_verify_cert, letting it override by returning 1, as openSSL's check_id_error() does (compat layer).
Also moved the check above the exit cleanup so the callback runs with the chain and temporary intermediates still loaded.

Testing

Added test_wolfSSL_X509_STORE_CTX_verify_cb_check_id.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@gasbytes gasbytes self-assigned this Aug 12, 2026
Copilot AI lite review requested due to automatic review settings August 12, 2026 11:08

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

This PR updates wolfSSL’s OpenSSL-compat certificate verification path to report X509_VERIFY_PARAM hostname/IP mismatches to the application’s verify callback (so the callback can inspect and optionally override by returning 1), and moves the check earlier so the callback runs while the built chain and temporary intermediates are still present.

Changes:

  • Invoke the verify callback on X509_V_ERR_HOSTNAME_MISMATCH / X509_V_ERR_IP_ADDRESS_MISMATCH in wolfSSL_X509_verify_cert() and allow callback override.
  • Reorder the hostname/IP check to occur before exit: cleanup so callback inspection can see the active chain/intermediates.
  • Add a new API-level regression test covering callback behavior for hostname/IP mismatches.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/api/test_ossl_x509_str.h Registers the new test in declarations and the test group list.
tests/api/test_ossl_x509_str.c Adds a new test validating callback invocation/override on hostname and IP mismatches.
src/x509_str.c Reports hostname/IP mismatches via verify callback (OpenSSL-like check_id_error() behavior) and moves the check earlier.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/api/test_ossl_x509_str.c
@gasbytes
gasbytes force-pushed the x509_store_ctx_verify_cb_fix branch from fc70e66 to 16ab28a Compare August 12, 2026 12:27
@gasbytes
gasbytes marked this pull request as ready for review August 12, 2026 12:39
@github-actions

Copy link
Copy Markdown

retest this please

…k so applications can inspect or override them
@gasbytes
gasbytes force-pushed the x509_store_ctx_verify_cb_fix branch from 16ab28a to 2c9e443 Compare August 12, 2026 12:52
@gasbytes gasbytes assigned wolfSSL-Bot and unassigned gasbytes Aug 12, 2026
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