Fix multiple Fenrir issues - #11181
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
|
Tests good with multi-test with:
|
77e8038 to
0284a5f
Compare
…ove word32 max are handled correctly. (F-7103)
…y written and does not exceed the given size. (F-7631)
…t (bits not bytes). (F-9329)
…ase in unit tests.
0284a5f to
7c158d5
Compare
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