2 suggestions
Optional improvements
[suggestion] · secp256k1 hardening lacks before/after performance evidence
Forwarding hardening flags changes release secp256k1 code generation, but the performance cost for signature verification and signing has not been quantified.
Location: cmake/secp256k1.cmake:67 (head).
Details and suggested fix
The subtree appends SECP256K1_APPEND_CFLAGS after its normal compiler options. Depending on the platform and successful C++ and C probes, this now adds stack canaries, FORTIFY and control-flow protection to secp256k1. In particular, -fstack-protector-all can override a weaker compiler default; user APPEND_CPPFLAGS and APPEND_CFLAGS still follow it and can override the selection. Please provide before/after measurements from the Core build, for example the bench_bitcoin VerifyScript* and ConnectBlock* benchmarks, so the verification cost can be weighed against the added protection. No slowdown or secret-dependent mechanism has been demonstrated, and bitcoin_crypto already receives these flags through core_interface. As an optional additional check, run the built ctime_tests under Valgrind with the new flags: Core CI's CTest invocation does not execute it, because the subtree does not register it with add_test. Replacing -all with -strong would weaken stack-protection coverage, so that would be a tradeoff rather than a behavior-preserving fix.
[suggestion] · Hardening probes share secp256k1's compiler-check cache namespace
The new filter shares cache keys with subtree probes that test different flag contexts, although the currently checked flag sets do not overlap.
Location: cmake/secp256k1.cmake:28 (head).
Details and suggested fix
filter_c_flags caches compile results as C_SUPPORTS_<FLAG> using the same MAKE_C_IDENTIFIER and TOUPPER transformation as the subtree's secp256k1_check_c_flags_internal. Both operate in one CMake cache, but the new check includes previously accepted flags and Core's warning-as-error option, whereas the subtree checks its requested flag separately. If a future subtree update probes a hardening flag, CMake can silently reuse the wrapper's cached result instead of running the subtree's check. On a fresh configure, the wrapper runs first. There is no collision in the current flag sets. Give this filter dedicated compile and linker result prefixes, such as SECP256K1_HARDENING_C_SUPPORTS_ and SECP256K1_HARDENING_C_LINKER_SUPPORTS_, to isolate the checks without changing the intended flag selection.