Skip to content

PKCS7 additional sanity checks - #12086

Merged
philljj merged 3 commits into
wolfSSL:masterfrom
JacobBarthelmeh:pkcs7
Nov 19, 2026
Merged

philljj merged 3 commits into
wolfSSL:masterfrom
JacobBarthelmeh:pkcs7

Conversation

@JacobBarthelmeh

Copy link
Copy Markdown
Contributor

F-12379 and F-16275

@JacobBarthelmeh JacobBarthelmeh self-assigned this Nov 10, 2026
Copilot AI balanced review requested due to automatic review settings November 10, 2026 23:32

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.

🟢 Approval recommended

There are no active review issues for the PKCS#7 input-validation changes and regression coverage.

No open issues 🎉

What changed in this PR

Tightens wolfCrypt’s PKCS#7 input validation and adds regression coverage for malformed signed and enveloped data.

Changes:

  • Returns ASN_PARSE_E when the initial SignedData sequence cannot be parsed.
  • Rejects empty KTRI encrypted keys before allocation and decryption.
  • Adds tests for malformed inputs and repeated verification failures.
File Description
wolfcrypt/​src/​pkcs7.c Adds explicit parse errors for invalid SignedData sequences and empty encrypted keys.
tests/​api/​test_pkcs7.h Declares and registers the two new regression tests.
tests/​api/​test_pkcs7.c Tests malformed KTRI input and rejection of non-sequence SignedData input.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

gcc-arm-cortex-m0plus

  • FLASH: .text +224 B (+0.3%, 71,287 B / 262,144 B, total: 27% used)

gcc-arm-cortex-m3

  • FLASH: .text +252 B (+0.2%, 132,265 B / 262,144 B, total: 50% used)

gcc-arm-cortex-m4

  • FLASH: .rodata.wolfSSL_ERR_reason_error_string.str1.1 +28 B, .text +320 B (+0.2%, 209,640 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m4-baremetal

  • FLASH: .text +320 B (+0.4%, 74,095 B / 262,144 B, total: 28% used)

gcc-arm-cortex-m4-crypto-only

  • FLASH: .text +768 B (+0.4%, 182,795 B / 262,144 B, total: 70% used)

gcc-arm-cortex-m4-dtls13

  • FLASH: .rodata +8 B, .text +1,024 B (+0.5%, 197,280 B / 1,048,576 B, total: 19% used)

gcc-arm-cortex-m4-min-ecc

  • FLASH: .text +128 B (+0.2%, 68,497 B / 262,144 B, total: 26% used)

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .rodata +96 B, .text +3,392 B (+0.4%, 805,380 B / 1,048,576 B, total: 77% used)
  • RAM: .bss +48 B (+0.0%, 121,820 B / 262,144 B, total: 46% used)

gcc-arm-cortex-m4-pkcs7

  • FLASH: .text +960 B (+0.4%, 224,076 B / 262,144 B, total: 85% used)

gcc-arm-cortex-m4-pq

  • FLASH: .rodata +32 B, .text +2,048 B (+0.7%, 315,184 B / 1,048,576 B, total: 30% used)
  • RAM: .bss +264 B (+1.6%, 16,944 B / 262,144 B, total: 6% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .rodata +24 B, .text +1,664 B (+0.5%, 345,448 B / 1,048,576 B, total: 33% used)
  • RAM: .bss +264 B (+1.5%, 18,260 B / 262,144 B, total: 7% used)

gcc-arm-cortex-m4-sp-math

  • FLASH: .text +128 B (+0.2%, 68,497 B / 262,144 B, total: 26% used)

gcc-arm-cortex-m4-tls12

  • FLASH: .text +192 B (+0.1%, 133,001 B / 262,144 B, total: 51% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .rodata.wolfSSL_ERR_reason_error_string.str1.1 +28 B, .text +1,984 B (+0.8%, 251,906 B / 262,144 B, total: 96% used)
  • RAM: .bss +264 B (+1.6%, 16,892 B / 65,536 B, total: 26% used)

gcc-arm-cortex-m7

  • FLASH: .rodata.wolfSSL_ERR_reason_error_string.str1.1 +28 B, .text +256 B (+0.1%, 209,640 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m7-pq

  • FLASH: .rodata +32 B, .text +1,984 B (+0.6%, 316,016 B / 1,048,576 B, total: 30% used)
  • RAM: .bss +264 B (+1.6%, 16,944 B / 262,144 B, total: 6% used)

gcc-arm-cortex-m7-tls13

  • FLASH: .rodata.wolfSSL_ERR_reason_error_string.str1.1 +28 B, .text +1,984 B (+0.8%, 251,906 B / 262,144 B, total: 96% used)
  • RAM: .bss +264 B (+1.6%, 16,892 B / 65,536 B, total: 26% used)

stm32-sim-stm32h753

  • FLASH: .text +3,384 B (+1.7%, 207,460 B / 2,097,152 B, total: 10% used)

zephyr-frdm_rw612

  • FLASH: rodata +8 B, text +1,704 B (+0.6%, 294,220 B / 67,108,864 B, total: 0% used)

Catch memory regressions in CI with MemBrowse. Free for open source.

@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 #12086

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-bugs
Not reviewed (no scan target covers them): tests/api/test_pkcs7.h
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer

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: Max

@philljj
philljj merged commit 88674fc into wolfSSL:master Nov 19, 2026
447 checks passed
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