Skip to content

cmake: turn crypto-refresh and PQC off on Botan without the SEC1 FFI loaders - #2602

Merged
ronaldtse merged 1 commit into
mainfrom
fix/botan-sec1-ffi-detect
Nov 27, 2026
Merged

ronaldtse merged 1 commit into
mainfrom
fix/botan-sec1-ffi-detect

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

The system-Botan builds on Fedora 43/44 and rawhide have been failing for the last few days with

error: use of undeclared identifier 'botan_pubkey_load_ecdsa_sec1'; did you mean 'botan_pubkey_load_ecdsa'?

at src/lib/crypto/exdsa_ecdhkem.cpp. This PR fixes the detection so those builds configure cleanly again.

Root cause

exdsa_ecdhkem.cpp loads the raw SEC1 point encodings through the botan_pubkey_load_ec*_sec1() FFI functions. Upstream Botan added those functions in 3.10.0 (randombit/botan commit b24417ca9b, between 3.9.0 and 3.10.0).

Our feature detection only checks the BOTAN_HAS_* module macros in botan/build.h. A Botan 3.5 to 3.9 build has all the modules we probe (HKDF, ED448, X448, ARGON2, and even the FIPS 203/204/205 APIs for PQC), so the configure passes, and the build then fails at the missing FFI declaration. The soft-off added in 4320a0a never had a chance because the check did not cover this requirement.

Fix

Probe botan_pubkey_load_ecdsa_sec1 directly with check_cxx_symbol_exists against botan/ffi.h, linking the detected Botan library. When it is missing, turn ENABLE_CRYPTO_REFRESH and ENABLE_PQC off with a warning, the same way the other soft-off cases work. Both flags go off together because the source list compiles exdsa_ecdhkem.cpp when either one is enabled.

I also updated the docs that stated the Botan 3.6+/3.7.0 floors, since the effective floor for crypto-refresh and PQC on the Botan backend is now spelled out as 3.10.0+.

Verification

  • Botan 3.12 locally: probe found, ENABLE_CRYPTO_REFRESH=On and ENABLE_PQC=On stay on, full build succeeds, and the 14 PQC/KEM tests pass (test_exdsa, test_dilithium_exdsa_direct, and the rest of the pqc/exdsa/ecdhkem set).
  • Botan 2.19 headers (no SEC1 declarations): probe correctly reports not found, so the turning-off path triggers.
  • The Fedora 43/44 and rawhide legs in CI will exercise the real negative path with their distro Botan.

…loaders

The botan_pubkey_load_ec*_sec1() FFI functions, which exdsa_ecdhkem.cpp
uses to load the raw point encodings, first exist in Botan 3.10.0. The
feature detection only checked the BOTAN_HAS_* module macros, so Botan
3.5-3.9 with all the required modules (HKDF, ED448, X448, ARGON2 and the
FIPS 203/204/205 APIs) passed the configure and then failed to compile
exdsa_ecdhkem.cpp, breaking the system-Botan builds on Fedora 43/44 and
rawhide.

Probe the FFI symbol directly and turn ENABLE_CRYPTO_REFRESH and
ENABLE_PQC off with a warning when it is missing, the same way the
other soft-off cases work. Both flags go off together because the
source list compiles exdsa_ecdhkem.cpp when either one is enabled.
Update the docs that stated the Botan 3.6+/3.7.0 floors.
@ronaldtse
ronaldtse merged commit 996e512 into main Nov 27, 2026
127 of 154 checks passed
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.

2 participants