Repository navigation
Check rfc822Name SANs in wolfSSL_X509_check_email() - #11928
Merged
Merged
Conversation
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Email SAN matching incorrectly treats domains as case-sensitive, and the new tests lack signing and RNG feature guards, causing failures in reduced-feature builds.
2 open issues
What changed in this PR
Updates wolfSSL’s OpenSSL-compatible email verification to prioritize certificate rfc822Name subject alternative names (SANs) over the subject email address.
Changes:
- Checks email SANs first and blocks subject fallback when SAN decoding is unavailable.
- Normalizes explicit email lengths and rejects embedded NULs.
- Adds regression coverage for SAN/subject combinations and length handling.
| File | Description |
|---|---|
tests/api/test_ossl_x509.h |
Declares and registers the new SAN regression test. |
tests/api/test_ossl_x509.c |
Adds generated certificate cases and updates configuration-dependent expectations. |
src/x509.c |
Implements SAN-first email matching and input-length validation. |
Review effort: Balanced
wolfSSL_X509_check_email() only compared the subject emailAddress, so a certificate whose rfc822Name SAN named a different mailbox still matched on its subject, and one with a matching SAN but different subject was rejected. Match the rfc822Name SANs first and fall back to the subject only when there are none (RFC 6125 6.4.4, as OpenSSL does). If rfc822Name SANs aren't decoded (IGNORE_NAME_CONSTRAINTS, or WOLFSSL_X509_TINY without WOLFSSL_X509_TINY_SAN_EMAIL), fail for any certificate with a SAN extension rather than trusting the subject. Handle chkLen like check_host: reject embedded NULs and drop one trailing NUL. Add a regression test covering the SAN/subject matrix and chkLen cases.
holtrop-wolfssl
force-pushed
the
zd22694-b
branch
from
October 30, 2026 11:31
a615d68 to
1fceb52
Compare
Contributor
Author
|
retest this please |
philljj
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
wolfSSL_X509_check_email() only compared the subject emailAddress, so a certificate whose rfc822Name SAN named a different mailbox still matched on its subject, and one with a matching SAN but different subject was rejected.
Match the rfc822Name SANs first and fall back to the subject only when there are none (RFC 6125 6.4.4, as OpenSSL does). If rfc822Name SANs aren't decoded (IGNORE_NAME_CONSTRAINTS, or WOLFSSL_X509_TINY without WOLFSSL_X509_TINY_SAN_EMAIL), fail for any certificate with a SAN extension rather than trusting the subject. Handle chkLen like check_host: reject embedded NULs and drop one trailing NUL.
Add a regression test covering the SAN/subject matrix and chkLen cases.
Fixes ZD#22694 issue B.
Testing
How did you test?
Checklist