Skip to content

tests: cover extended key usage OID sum collisions in non-wolfSSH builds - #11205

Open
gasbytes wants to merge 1 commit into
wolfSSL:masterfrom
gasbytes:eku-oid-checksum-fix
Open

tests: cover extended key usage OID sum collisions in non-wolfSSH builds#11205
gasbytes wants to merge 1 commit into
wolfSSL:masterfrom
gasbytes:eku-oid-checksum-fix

Conversation

@gasbytes

@gasbytes gasbytes commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Description

The KeyPurposeId OID byte check landed upstream in #11361. Its regression test is gated on WOLFSSL_WOLFSSH, so a default build has no coverage for the check.

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. Also updated the MC/DC white-box coverage.

Checklist

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

@gasbytes gasbytes self-assigned this Aug 19, 2026
Copilot AI lite review requested due to automatic review settings August 19, 2026 14:23

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

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.

Comment thread tests/unit-mcdc/test_asn_ext_whitebox.c
Comment thread tests/api/test_asn.c
@gasbytes
gasbytes force-pushed the eku-oid-checksum-fix branch from d79d27a to 369a439 Compare August 19, 2026 14:36
@gasbytes
gasbytes marked this pull request as ready for review August 19, 2026 14:44
@github-actions

Copy link
Copy Markdown

retest this please

@gasbytes gasbytes assigned anhu and wolfSSL-Bot and unassigned gasbytes Aug 19, 2026
@gasbytes
gasbytes requested a review from anhu September 8, 2026 10:15
@gasbytes
gasbytes force-pushed the eku-oid-checksum-fix branch from 369a439 to b30d3c2 Compare September 8, 2026 11:01
@gasbytes gasbytes changed the title asn: verify KeyPurposeId OID bytes before setting extended key usage bits tests: cover extended key usage OID sum collisions in non-wolfSSH builds Sep 8, 2026
@gasbytes

gasbytes commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Fixed some conflicts against master.

The fix was superseed by:
#11361

Rebased to use 11a6e28 instead as fix, and left the coverage for non-wolfSSH builds.

@gasbytes
gasbytes force-pushed the eku-oid-checksum-fix branch from b30d3c2 to 0d9c824 Compare September 8, 2026 11:53
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.

4 participants