Reject empty PKCS11 ECDSA integers - #11339
Conversation
aidangarske
commented
Sep 1, 2026
There was a problem hiding this comment.
Pull request overview
This PR hardens PKCS#11 ECDSA signature DER decoding in wc_pkcs11 by rejecting empty INTEGER encodings for r/s, preventing malformed signatures from progressing to PKCS#11 verify operations.
Changes:
- Tighten
Pkcs11ECDSASig_Decode()bounds checks and explicitly reject zero-length ASN.1 INTEGERs. - Add an API test that exercises empty-
rand empty-sECDSA signatures and asserts earlyASN_PARSE_Ewithout invokingC_VerifyInit. - Wire the new PKCS#11 API test into both Autotools and CMake test builds.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| wolfcrypt/src/wc_pkcs11.c | Adds explicit empty-INTEGER rejection and safer length/bounds validation during ECDSA DER signature decode. |
| tests/api/test_pkcs11.h | Declares the new PKCS#11 API test and integrates it into the test case registry via TEST_DECL_GROUP. |
| tests/api/test_pkcs11.c | Adds a targeted regression test covering empty r/s INTEGERs and ensuring no PKCS#11 verify calls occur. |
| tests/api/include.am | Registers the new PKCS#11 API test source/header in the Autotools test build. |
| tests/api.c | Includes the new test header and registers the PKCS#11 test group in the global API test list. |
| CMakeLists.txt | Adds the new PKCS#11 API test source to the CMake test build inputs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11339
Scan targets checked: wolfcrypt-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
|
retest this please |
|
|
retest this please |
|
Jenkins retest this please |