Skip to content

fix forcezero linking on every build - #10935

Open
stenslae wants to merge 4 commits into
wolfSSL:masterfrom
stenslae:fix/wcForceZero
Open

stenslae wants to merge 4 commits into
wolfSSL:masterfrom
stenslae:fix/wcForceZero

Conversation

@stenslae

@stenslae stenslae commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

Description

  • Moved wc_ForceZero() and wc_ConstantCompare() from memory.c into wc_port.c so they are always available across builds. The declarations, including the WOLFSSL_NO_FORCE_ZERO alias from 20261029-misc-fixes #11934, now are in wc_port.h, so the duplicate in wc_compat.h is dropped.
  • Updated blake2 to use ForceZero() instead of hand rolled volatile loop.
  • Export wc_BarrierDataSink() on every build. The portable WC_BARRIER_DATA() sink merged in ISO 19790 Zeroization for v7 #11434, but only on that arm; code including misc.c picks its arm from its own compiler and flags, so an MSVC/IAR or WOLFSSL_NO_ASM caller of a GCC-built library could fail to link.
  • Stop settings.h from auto-defining WOLFSSL_NO_FORCE_ZERO / WOLFSSL_NO_CONST_CMP for minimal WOLFCRYPT_ONLY builds. SHA-1 (on by default) calls ForceZero(), so every build that heuristic fired on failed to link. Cost is under 200 bytes. WOLFSSL_USE_FORCE_ZERO is now a no-op.

A follow up PR will add disassembly DSE coverage for ForceZero.

Testing

Added regression tests.

Checklist

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

@stenslae stenslae self-assigned this Jul 16, 2026

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

Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src

No new issues found in the changed files. ✅

@github-actions

github-actions Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

gcc-arm-cortex-m0plus

  • FLASH: .text +16 B (+0.0%, 70,739 B / 262,144 B, total: 27% used)

gcc-arm-cortex-m3

  • FLASH: .text +12 B (+0.0%, 131,693 B / 262,144 B, total: 50% used)

gcc-arm-cortex-m4

  • FLASH: +4 B (+0.0%, 208,976 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m4-baremetal

  • FLASH: +4 B (+0.0%, 73,467 B / 262,144 B, total: 28% used)

gcc-arm-cortex-m4-crypto-only

  • FLASH: +4 B (+0.0%, 181,655 B / 262,144 B, total: 69% used)

gcc-arm-cortex-m4-dtls13

  • FLASH: .rodata +4 B (+0.0%, 195,932 B / 1,048,576 B, total: 19% used)

gcc-arm-cortex-m4-min-ecc

  • FLASH: +4 B (+0.0%, 67,997 B / 262,144 B, total: 26% used)

gcc-arm-cortex-m4-pkcs7

  • FLASH: .text +64 B (+0.0%, 222,808 B / 262,144 B, total: 85% used)

gcc-arm-cortex-m4-pq

  • FLASH: .rodata +4 B (+0.0%, 312,788 B / 1,048,576 B, total: 30% used)

gcc-arm-cortex-m4-sp-math

  • FLASH: +4 B (+0.0%, 67,997 B / 262,144 B, total: 26% used)

gcc-arm-cortex-m4-tls12

  • FLASH: +4 B (+0.0%, 132,437 B / 262,144 B, total: 51% used)

gcc-arm-cortex-m4-tls13

  • FLASH: +4 B (+0.0%, 249,510 B / 262,144 B, total: 95% used)

gcc-arm-cortex-m7

  • FLASH: +4 B (+0.0%, 208,976 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m7-pq

  • FLASH: .rodata +4 B (+0.0%, 313,620 B / 1,048,576 B, total: 30% used)

gcc-arm-cortex-m7-tls13

  • FLASH: +4 B (+0.0%, 249,510 B / 262,144 B, total: 95% used)

zephyr-frdm_rw612

  • FLASH: log_const_area -8 B, rodata -8 B, text +1,592 B (+0.6%, 284,040 B / 67,108,864 B, total: 0% used)

No memory changes detected for:


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 #10935

Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread wolfssl/wolfcrypt/wc_port.h Resolved
Comment thread wolfssl/wolfcrypt/wc_port.h Resolved

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

Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src

No new issues found in the changed files. ✅

@stenslae

Copy link
Copy Markdown
Member Author

jenkins retest this please

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

Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src

No new issues found in the changed files. ✅

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

Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-rs-bugs, wolfcrypt-src, wolfssl-bugs, wolfssl-src

No new issues found in the changed files. ✅

@stenslae
stenslae force-pushed the fix/wcForceZero branch 2 times, most recently from 1844d19 to 6bf96b1 Compare July 20, 2026 20:37
@stenslae

Copy link
Copy Markdown
Member Author

jenkins retest this please

@stenslae

Copy link
Copy Markdown
Member Author

jenkins retest this please

@stenslae
stenslae requested review from wolfSSL-Fenrir-bot and removed request for wolfSSL-Fenrir-bot July 23, 2026 17:50
@philljj

philljj commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

These two PRs are going to collide with same changes:

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.

🟡 Changes recommended

The Arm Compiler 5 path still permits dead-store elimination, and the security hardening lacks regression coverage.

2 open findings
3 resolved since last review

🧠 Review effort: Balanced

Comment thread wolfssl/wolfcrypt/wc_port.h Resolved
Comment thread wolfcrypt/src/wc_port.c Resolved

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
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: Lite

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.

🟡 Changes recommended

The security guarantee lacks permanent DSE/LTO regression coverage, and the changelog misdocuments armcc5 behavior.

2 open findings
2 resolved since last review

🧠 Review effort: Balanced

Comment thread wolfcrypt/src/wc_port.c Resolved
Comment thread ChangeLog.md Resolved

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.

🟡 Changes recommended

The security and build regressions being fixed need automated coverage in this pull request.

1 open finding
2 resolved since last review

🧠 Review effort: Balanced

Comment thread wolfcrypt/src/wc_port.c Resolved

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Coverage: 1 of 1 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: Lite

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

Scan targets checked: none
Unchanged since last review (not re-run): wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs

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

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.

🔵 Needs a closer look

Security-sensitive, compiler-specific barrier behavior lacks the planned regression and DSE coverage.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

Comment thread wolfcrypt/src/misc.c

@julek-wolfssl julek-wolfssl Oct 21, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Once #11809 goes in the changes on this file will be redundant.

@stenslae

Copy link
Copy Markdown
Member Author

claude @review

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.

🔵 Needs a closer look

The short-buffer alignment correction remains missing, and security-critical compiler barrier behavior needs final cross-toolchain validation.

1 open issue

Review effort: Balanced

Comment thread wolfcrypt/src/wc_port.c Resolved

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): .wolfssl_known_macro_extras, ChangeLog.md
Coverage: 3 of 8 in-scope changed file(s) opened by the reviewer; not opened: wolfcrypt/src/blake2b.c, wolfcrypt/src/blake2s.c, wolfcrypt/src/memory.c, wolfssl/wolfcrypt/blake2-impl.h, wolfssl/wolfcrypt/memory.h

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

@stenslae

Copy link
Copy Markdown
Member Author

Removed xfence barriers to keep this pr more focused.

@stenslae

stenslae commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

@claude review

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

No active review issues are reported for the helper-linkage and zeroization changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

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

Code review found no issues

No high-confidence issues detected in this change.

This review covers commit db5c8b6, which is no longer the latest commit on this pull request; later commits are not covered by it.

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): .github/configs/os-check-linux.json, .wolfssl_known_macro_extras, ChangeLog.md, tests/api/test_port.h
Coverage: 2 of 5 in-scope changed file(s) opened by the reviewer; not opened: tests/api/test_port.c, wolfcrypt/src/memory.c, wolfssl/wolfcrypt/settings.h

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

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

No active review issues are reported for the helper-linking and zeroization changes.

No open issues 🎉

Review effort: Balanced

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

No active review issues remain for the changes addressing utility linking in minimal and memory-disabled wolfCrypt builds.

No open issues 🎉

Review effort: Balanced

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): .github/configs/os-check-linux.json, .wolfssl_known_macro_extras, ChangeLog.md, tests/api/test_port.h
Coverage: 3 of 5 in-scope changed file(s) opened by the reviewer; not opened: wolfcrypt/src/memory.c, wolfssl/wolfcrypt/memory.h

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

Code that includes misc.c picks its WC_BARRIER_DATA() arm from its own
compiler and flags, so a sink only on the library's arm could be missing.
@stenslae

stenslae commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Rebased onto upstream and resolved merge conflicts.

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

No active review issues remain for the shared-helper portability changes.

No open issues 🎉

Review effort: Balanced

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

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): .github/configs/os-check-linux.json, .wolfssl_known_macro_extras, ChangeLog.md, tests/api/test_port.h
Coverage: 10 of 10 in-scope changed file(s) opened by the reviewer

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Review tier: Max

Comment thread tests/api/test_port.c Resolved
Emma Stensland added 3 commits November 6, 2026 12:42
memory.c is excluded from some builds, which left the two exported
wrappers undefined; wc_port.c is always compiled.
They took ForceZero() and ConstantCompare() away from minimal builds
whose algorithms still call them, so those builds failed to link.
The one-off byte-at-a-time helper bypassed the barrier-hardened wipe
path every other part of wolfCrypt goes through.

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

No active review issues are reported for the helper-linking and zeroization changes.

No open issues 🎉

Review effort: Balanced

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

Scan targets checked: wolfssl-src, wolfssl-bugs
Unchanged since last review (not re-run): wolfcrypt-src, wolfcrypt-bugs
Not reviewed (no scan target covers them): .github/configs/os-check-linux.json, .wolfssl_known_macro_extras, ChangeLog.md, tests/api/test_port.h
Coverage: 1 of 1 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: Lite

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.

10 participants