Skip to content

Fix multiple Fenrir issues - #11181

Open
kareem-wolfssl wants to merge 20 commits into
wolfSSL:masterfrom
kareem-wolfssl:fbatch2
Open

Fix multiple Fenrir issues#11181
kareem-wolfssl wants to merge 20 commits into
wolfSSL:masterfrom
kareem-wolfssl:fbatch2

Conversation

@kareem-wolfssl

Copy link
Copy Markdown
Contributor

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

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

@kareem-wolfssl kareem-wolfssl self-assigned this Aug 15, 2026
Copilot AI lite review requested due to automatic review settings August 15, 2026 01:00

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

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.

Comment thread wolfcrypt/src/evp.c
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

gcc-arm-cortex-m0plus

  • FLASH: .text +12 B (+0.0%, 66,971 B / 262,144 B, total: 26% used)

gcc-arm-cortex-m3

  • FLASH: .text +8 B (+0.0%, 125,783 B / 262,144 B, total: 48% used)

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .text +64 B (+0.0%, 783,268 B / 1,048,576 B, total: 75% used)

gcc-arm-cortex-m4-pkcs7

  • FLASH: .text +128 B (+0.1%, 217,756 B / 262,144 B, total: 83% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .text +64 B (+0.0%, 242,191 B / 262,144 B, total: 92% used)

linuxkm-pie

  • Data: __patchable_function_entries +8 B (+0.0%, 27,008 B)

linuxkm-standard

  • Data: __patchable_function_entries +8 B (+0.0%, 49,800 B)

stm32-sim-stm32h753

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread wolfcrypt/test/test.c
Comment thread wolfcrypt/test/test.c
Comment thread wolfcrypt/test/test.c
Comment thread wolfcrypt/src/random.c
@kareem-wolfssl kareem-wolfssl self-assigned this Aug 19, 2026

@philljj philljj 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.

Some of the Fenrir findings look valid.

Also, check with Douzzer on the rng_bank change.

Comment thread wolfssl/openssl/evp.h
Comment thread wolfcrypt/src/rng_bank.c
Comment thread wolfcrypt/src/random.c
Comment thread wolfcrypt/test/test.c
Comment thread wolfcrypt/test/test.c
Comment thread wolfcrypt/test/test.c
@philljj
philljj requested a review from douzzer August 20, 2026 02:26
@kareem-wolfssl
kareem-wolfssl force-pushed the fbatch2 branch 2 times, most recently from 7697170 to 29fabbf Compare August 22, 2026 00:34
@kareem-wolfssl

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please

@philljj
philljj requested review from philljj and wolfSSL-Fenrir-bot and removed request for wolfSSL-Fenrir-bot August 24, 2026 21:45

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread wolfcrypt/src/pkcs7.c Outdated
Comment thread wolfcrypt/src/pkcs7.c Outdated
Comment thread wolfcrypt/src/pkcs7.c Outdated
Comment thread wolfcrypt/src/pkcs7.c Outdated
Comment thread wolfcrypt/src/pkcs7.c Outdated
Comment thread wolfcrypt/src/pkcs7.c Outdated
@philljj

philljj commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Tests good with multi-test with:

  • all-gcc-c89
  • all-c89-clang-tidy
  • defaults-openssl-coexist-fips-v2
  • quantum-safe-wolfssl-all-smallstack-clang-tidy
  • quantum-safe-wolfssl-all-noasm-smallstack-sanitizer
  • quantum-safe-wolfssl-all-intelasm-sp-asm-[valgrind, sanitizer, clang-sanitizer]
  • linuxkm-fips-dev-module-update-fips-hash-intelasm-LKCAPI-insmod

Comment thread wolfcrypt/src/pkcs7.c Outdated
…ove word32 max are handled correctly. (F-7103)
…y written and does not exceed the given size. (F-7631)
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.

5 participants