Skip to content

Declare wc_ForceZero once across memory.h and wc_compat.h - #12069

Merged
padelsbach merged 1 commit into
wolfSSL:masterfrom
aidangarske:fix-forcezero-redundant-decl
Nov 9, 2026
Merged

padelsbach merged 1 commit into
wolfSSL:masterfrom
aidangarske:fix-forcezero-redundant-decl

Conversation

@aidangarske

Copy link
Copy Markdown
Member
  • 847da6f2e9 added a second wc_ForceZero() (or ForceZero() with WOLFSSL_NO_FORCE_ZERO) prototype in wc_compat.h
    for the FIPS AES-GCM compat shims.
  • Whichever of memory.h and wc_compat.h is parsed second redeclares it, so any application built with -Wredundant-decls -Werror against a FIPS v2 build fails to compile, in either include order.
  • This currently blocks wolfEngine: its FIPSv2 Jenkins jobs fail in test/test_aestag.c, so Fix fenrir issues across wolfEngine wolfEngine#257 cannot
    go green until this lands.
  • Both headers now declare the zeroizer only when WC_FORCE_ZERO_DECLARED is not yet defined, and define it after
    declaring, so exactly one prototype is emitted.
  • No API or ABI change; the declarations and the wc_ForceZero to ForceZero alias are unchanged.
  • fix forcezero linking on every build #10935 also removes the duplicate, as part of moving wc_ForceZero() into wc_port.c. This is the minimal fix to unblock
    downstream now; it can be dropped when fix forcezero linking on every build #10935 merges.

@aidangarske aidangarske self-assigned this Nov 9, 2026
@aidangarske
aidangarske requested review from wolfSSL-Fenrir-bot and a balanced review from Copilot November 9, 2026 20:31

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 were identified for the change preventing duplicate zeroizer declarations.

No open issues 🎉

What changed in this PR

This PR prevents duplicate zeroizer declarations across memory.h and wc_compat.h, addressing FIPS v2 compilation failures for consumers using -Wredundant-decls -Werror, including wolfEngine.

Changes:

  • Adds a shared WC_FORCE_ZERO_DECLARED guard so either header can declare the zeroizer first without redeclaration.
  • Preserves the existing prototypes and WOLFSSL_NO_FORCE_ZERO alias without changing the API or ABI.
File Description
wolfssl/​wolfcrypt/​wc_compat.h Guards the zeroizer declaration needed by the FIPS compatibility shims.
wolfssl/​wolfcrypt/​memory.h Uses the same guard to avoid redeclaring the zeroizer.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

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

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

@padelsbach

Copy link
Copy Markdown
Contributor

jenkins retest this please

@padelsbach
padelsbach merged commit c5034ed into wolfSSL:master Nov 9, 2026
444 of 445 checks passed
@aidangarske
aidangarske deleted the fix-forcezero-redundant-decl branch November 9, 2026 22:16
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