Fix multiple Fenrir issues - #11181
kareem-wolfssl wants to merge 17 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a set of reported “Fenrir” issues across the wolfCrypt and OpenSSL-compat layers, focusing on correctness fixes (buffer bounds, memory lifecycle, and API sizing) and adding regression tests to prevent reintroductions.
Changes:
- Align EVP DigestSignUpdate/DigestUpdate handling with size_t semantics and harden digest update behavior for large inputs.
- Fix/strengthen memory and bounds handling in SRP, PKCS7 (attributes + streaming), ECC ECIES decrypt behavior, and RNG/DRBG zeroization paths.
- Add targeted regression and boundary tests for PKCS7 streaming/attribute limits, ECC decrypt pubKey preservation, and SRP overwrite cleanup.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| wolfssl/openssl/evp.h | Updates OpenSSL-compat EVP_DigestSignUpdate prototype to use size_t. |
| wolfcrypt/src/evp.c | Refactors EVP digest update/sign/verify update behavior (chunking, HMAC path handling, memcpy safety). |
| wolfcrypt/src/srp.c | Ensures prior username/key buffers are freed and zeroized on overwrite to avoid leaks. |
| wolfcrypt/src/rng_bank.c | Simplifies reseed error handling to return any non-zero reseed result. |
| wolfcrypt/src/random.c | Adds tracking and explicit zeroization of DRBG digest temporaries. |
| wolfcrypt/src/pkcs7.c | Enforces attribute-array bounds, fixes streaming encode buffer sizing, and hardens streamed BER decode output bounds/overflow. |
| wolfcrypt/src/ecc.c | Prevents wc_ecc_decrypt() from freeing/overwriting a caller-supplied pubKey in default ECIES message format. |
| wolfcrypt/src/aes.c | Clarifies AES CFB1 doc comments about bit-length processing and buffer sizing. |
| wolfcrypt/test/test.c | Adds SRP regression coverage and PKCS7 auth/unauth attribute boundary regression test. |
| tests/api/test_pkcs7.h | Registers new PKCS7 streaming chunk boundary test. |
| tests/api/test_pkcs7.c | Adds BER multi-segment decode bounds regression and streaming encoder boundary tests. |
| tests/api/test_ecc.h | Registers new ECC decrypt pubKey preservation test. |
| tests/api/test_ecc.c | Adds ECC decrypt pubKey preservation regression and long-OID decode boundary test. |
| doc/dox_comments/header_files/ecc.h | Updates ECC decrypt Doxygen to reflect that pubKey is ignored/unchanged in the default message format. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
1469e23 to
fd2aea3
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11181
Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Findings: 11
11 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
philljj
left a comment
There was a problem hiding this comment.
Some of the Fenrir findings look valid.
Also, check with Douzzer on the rng_bank change.
7697170 to
29fabbf
Compare
|
Jenkins retest this please |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11181
Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-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.
29fabbf to
2d68432
Compare
…ove word32 max are handled correctly. (F-7103)
…t (bits not bytes). (F-9329)
…ase in unit tests.
…ed_range. (F-7414)
7c158d5 to
3bfdf35
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11181
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Coverage: 10 of 12 in-scope changed file(s) opened by the reviewer; not opened: tests/api/test_ossl_p7p12.c, wolfcrypt/src/aes.c
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
Fenrir's latest completed scan found no issues; clearing the prior automated change request.
| if ((ret == WC_NO_ERR_TRACE(WC_TIMEOUT_E)) || | ||
| (ret == WC_NO_ERR_TRACE(INTERRUPTED_E))) | ||
| { | ||
| if (ret != 0) |
There was a problem hiding this comment.
We want to continue, reseeding everything that we can, and percolate up an encountered error code at the end.
But we do need to break on timeout and interruption, as the incumbent code does.
… rather than exiting early in wc_rng_bank_reseed_range.
|
Retest this please Jenkins. FIPS 140-3 test failure. |
Description
Fixes F-7103, F-7105, F-7135, F-7400, F-7414, F-7446, F-7623, F-7624, F-7631, F-8166, F-9329
Testing
Built in tests + added tests
Checklist