asn: verify KeyPurposeId OID bytes before setting extended key usage bits - #11205
Open
gasbytes wants to merge 1 commit into
Open
asn: verify KeyPurposeId OID bytes before setting extended key usage bits#11205gasbytes wants to merge 1 commit into
gasbytes wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Improves EKU (Extended Key Usage) decoding safety by ensuring a KeyPurposeId’s raw OID bytes match the known OID associated with its wc_oid_sum() before mapping it to an authorization bit (preventing checksum-collision misclassification, e.g., falsely granting serverAuth).
Changes:
- Hardened
DecodeExtKeyUsage()to validate OID bytes against the known OID before setting EKU bits. - Added regression coverage (whitebox + API-level) for an OID checksum collision against
id-kp-serverAuth. - Registered the new API test in the ASN test suite header.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| wolfcrypt/src/asn.c | Adds OID-byte verification to prevent wc_oid_sum() collision from setting the wrong EKU bit. |
| tests/unit-mcdc/test_asn_ext_whitebox.c | Adds a whitebox regression case for a colliding OID not being treated as serverAuth. |
| tests/api/test_asn.h | Registers the new API regression test function in the ASN test list. |
| tests/api/test_asn.c | Adds an API-level regression test generating/parsing certs to validate EKU collision handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…ded key usage bit
gasbytes
force-pushed
the
eku-oid-checksum-fix
branch
from
August 19, 2026 14:36
d79d27a to
369a439
Compare
gasbytes
marked this pull request as ready for review
August 19, 2026 14:44
|
retest this please |
|
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
Verify a KeyPurposeId's OID bytes before mapping its wc_oid_sum() to an extended key usage bit.
Fixes zd#22337
Testing
Added a regression test that tests the behaviour with an actual id-kp-serverAuth as oid and one that must collide and check that it still doesn't allow server authentication.
Checklist