Skip to content

Make wolfCOSE build and CI ISO C99 conformant#37

Open
aidangarske wants to merge 1 commit into
mainfrom
c99-conformance
Open

Make wolfCOSE build and CI ISO C99 conformant#37
aidangarske wants to merge 1 commit into
mainfrom
c99-conformance

Conversation

@aidangarske
Copy link
Copy Markdown
Member

@aidangarske aidangarske commented Jun 1, 2026

Description

  • Add CI C99 compliance for wolfCOSE

Copilot AI review requested due to automatic review settings June 1, 2026 23:42

This comment was marked as resolved.

Switch the Makefile and every CI workflow from -std=c11 to -std=c99 and add
a c99-check gate (-pedantic-errors -Werror over all sources on gcc and clang,
default and WOLFCOSE_FLOAT feature sets) plus a C99 Compliance workflow, so
the C99 claim is enforced rather than asserted.

Two issues the C99 switch surfaced, fixed here:

- Define HAVE_ANONYMOUS_INLINE_AGGREGATES=1 on every wolfCOSE compile.
  -std=c99 otherwise disables it (wolfSSL gates it on __STDC_VERSION__ >=
  201101L), which shrinks WC_RNG. wolfSSL itself builds with the compiler
  default (gnu11) where the macro is on, so against a dilithium-enabled
  wolfSSL its WC_RNG is 8 bytes larger than wolfCOSE -std=c99 expects;
  wolfSSL writes past wolfCOSE's stack WC_RNG and corrupts the RNG, breaking
  every COSE ECDSA verify. EdDSA (deterministic) and AES-GCM/HMAC, which draw
  no nonce, were unaffected. Stable wolfSSL is identical under c99/c11, so
  only master failed.

- Key the master wolfSSL cache on its commit SHA. The workflows cached
  master under a static key and only rebuilt on a miss, freezing one master
  snapshot indefinitely. Pinned -stable caches keep their immutable keys.

Also fix a uint64_t/size_t mismatch in tests/test_cose.c exposed by the gate:
wc_CBOR_DecodeArrayStart takes size_t*, and the same variable doubled as a
uint64_t CBOR tag; split into a size_t count and a uint64_t tag.
Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #37

Scan targets checked: wolfcose-bugs, wolfcose-src

No new issues found in the changed files. ✅

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.

3 participants