Skip to content

crypto: declare the backends' canaries constinit in place of four clang-tidy suppressions - #52

Merged
pinhopro merged 1 commit into
mainfrom
crypto/canary-lint
Nov 22, 2026
Merged

pinhopro merged 1 commit into
mainfrom
crypto/canary-lint

Conversation

@pinhopro

Copy link
Copy Markdown
Contributor

Bumps libs/crypto to webcpporg/crypto#15 (merge 171e091): the four backends' canaries (BearSSL, libsodium, ctaes, libsecp256k1) are declared constinit, which bugprone-dynamic-static-initializers reads, in place of the four NOLINTNEXTLINE that suppressed it. trystero's lint reported the finding at backends/secp256k1.hpp in its Emscripten units.

Rulings

  • Fixed at the cause: the canary's definition, src/canary_<name>.c's = 0, is a C constant, so its initialisation is static; constinit on the header's declaration states it, and the check honours it. No suppression remains.
  • All four canaries change, not only libsecp256k1's: they share one declaration form.
  • The two MSVC tests that define a canary in C++ repeat constinit on that initialising declaration, as [dcl.constinit] asks.
  • webcpp::hash's canaries keep their suppressions: another stream's library, left for it.

Verified

crypto's tests and examples natively (clang), on Emscripten and on wasip2, all passing; the full macOS lint and the Linux lint, clean; MSVC 14.3 on libs/crypto/test, every canary test passing, only the lane's known Wine artifacts failing. Details in webcpporg/crypto#15.

@pinhopro
pinhopro merged commit 09e3d48 into main Nov 22, 2026
2 of 12 checks passed
@pinhopro
pinhopro deleted the crypto/canary-lint branch November 22, 2026 17:30
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.

1 participant