Repository navigation
secure: genesis (the DIT guard, erase_secret, secret, constant_time_equal, declassify and the constant-time blocks) - #1
Merged
Merged
Conversation
added 30 commits
November 24, 2026 14:27
…secure-run and secure-compile
…tions section, so the reference and doc-check pass
… from config's withdrawn change, with its seam, its test support and its tests
…wipe and its test seam
…fy with its checkers' marks as test support
…byte comparisons, checked against a plain reference
…y, so a 64-bit entry keeps its top half on WebAssembly
…igned, as on Linux on ARM
…ment keeps to 80 columns
…the compiler cannot merge, hoist or drop it
… which reports an asm statement's uninitialised register input
…over every block, each with a planted leak that must fail
…comma, as clang-tidy asks
…o 100 columns, and the changelog lines keep to 30 words
…d it was measured under
…ained erase example, prose fixes
…test::exit_status, as every test does, so that a failure fails on Emscripten
…real buffers whose read or write would change the result, with no null span
…pto's test/msvc to secure's own
…pten destroys no static object at exit
added 12 commits
November 25, 2026 17:46
…t a vector's, for which MSVC's debug library also allocates a proxy
… that suspended loses its return value
…459): each takes two words, and user_globals checks it
…eters the headers now have
…ndows on ARM64 clears DIT after a catch Windows on ARM64 keeps PSTATE.DIT through the search for a handler and the unwinding, then resumes the thread after a catch block (or in an __except block) with DIT clear: RtlRestoreContext clears it whatever the context's Cpsr says (probes on the Windows 11 ARM64 VM, MSVC 14.3 and 14.5, debug and release). An exception caught inside a guard's scope thus left the scope with DIT clear, and a guard that had found DIT set did nothing at its end, so the call left a program's DIT clear (hash timing_botan_failure on MSVC arm64). The guard now remembers what it found: clear, it clears DIT at its end as before; set, it reads DIT again at its end and sets it if something inside cleared it. timing_guard_exceptions checks it on every target, with exceptions on and off: DIT cleared inside nested guards in every order, an exception caught inside a guard, and one thrown through nested guards (DIT during the unwinding as each guard found it; after the catch, what a guard-free catch leaves, clear on Windows on ARM64). The page says what Windows does, the performance page is measured again (the second read costs about a nanosecond), and `__try` and `__except` render as code.
… dudect_harness checks its lines without freopen and fopen, which MSVC deprecates (C4996), and on every target
…ide a guard, since on 64-bit ARM only DIT makes their time independent of their data MSVC 14.5's arm64 lookup failed dudect_blocks (|t| 12 to 17, five runs of five) on the Windows 11 ARM64 machine, while 14.3's passed. Its machine code is branch-free and index-free: per entry eor, sub, bic, neg (the mask), the volatile barrier's str and ldr at a fixed slot, ldr of every entry in order, and, orr, with the loop's public bound the only branch. The same program with an msr of DIT and an isb around the lookup gave |t| 14.6 to 17.5 writing 0 and 0.8 to 2.6 writing DIT's bit: the time depended on the data with DIT clear. Arm promises a data-independent time only with DIT set, and every function of webcpp that computes on a secret holds a guard, so the program now measures the blocks as those functions run them, and the blocks page says so.
…tion, and the constant-time Jamfile's comment keeps to 80 columns (lint fix)
…s with a bounds-checked loop in place of string_view::substr, which may throw from a noexcept function (clang-tidy's bugprone-exception-escape)
…that DIT after a catch is as the unwinding left it, names the guard around a catch that returns to a C library, the blocks need DIT on 64-bit ARM (constant_time.hpp, hex_digit holds a guard), and the dudect |t| is 11 to 17.5 as logged
…t the backslash, which Asciidoctor printed (no attribute reference to escape there)
…load 1.9): clear 37.0 ns, set 1.2 ns, disengaged 0.0 ns; the page drops its load NOTE
This was referenced Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
webcpp::secure's genesis: the side-channel and secret-in-memory primitives that crypto, hash and codecs share, every name under
webcpp::secure, depending on config alone, no algorithm.<webcpp/secure/timing_guard.hpp>:timing_guard,cpu_has_dit(),dit_is_set(), the seamWEBCPP_SECURE_TIMING_ENTERED; DIT on arm64 under Apple's systems, Linux and Windows (_ReadStatusReg/_WriteStatusReg, FEAT_DIT probed once under SEH). The guard leaves DIT as it found it, also when Windows on ARM64 clears DIT on resuming after a catch.erase_secret,secret<N>,constant_time_equal(any two byte sequences),declassify, moved from crypto with no alias;detail/wipe.hppwith its test seam.<webcpp/secure/constant_time.hpp>:value_barrier, masks,select,lookup,select_bytes, byte comparisons, tested exhaustively on 8 bits and at random above.constant-time: memcheck, MemorySanitizer, dudect with A/A controls and planted leaks that must fail.Verified locally before merge: clang 908, gcc-15 713, wasip2 808, wasip3 791, Emscripten 598, clang and Emscripten release, the constant-time lanes on Linux and macOS, macOS and Linux lint, MSVC 14.3 and 14.5 x64 debug, MSVC 14.5 arm64 debug for the DIT tests (over secure, hash and crypto together). Change: webcpporg/proposals,
libraries/securegenesis.🤖 Generated with Claude Code