ffi: security rule enumeration API + FIPS mode foundation - #2424
Open
ronaldtse wants to merge 9 commits into
Open
ffi: security rule enumeration API + FIPS mode foundation#2424ronaldtse wants to merge 9 commits into
ronaldtse wants to merge 9 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2424 +/- ##
==========================================
+ Coverage 85.44% 85.49% +0.04%
==========================================
Files 125 125
Lines 22962 23033 +71
==========================================
+ Hits 19620 19691 +71
Misses 3342 3342 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ronaldtse
force-pushed
the
weak-cipher-reporting
branch
from
August 1, 2026 08:23
aad6962 to
e34ce5b
Compare
ronaldtse
force-pushed
the
weak-cipher-reporting
branch
2 times, most recently
from
August 9, 2026 23:06
feb9fbf to
6be024f
Compare
ronaldtse
force-pushed
the
weak-cipher-reporting
branch
from
August 20, 2026 10:11
6be024f to
c850f32
Compare
4 tasks
ronaldtse
force-pushed
the
weak-cipher-reporting
branch
from
August 20, 2026 22:47
cd67f7d to
c69d8ba
Compare
ronaldtse
force-pushed
the
weak-cipher-reporting
branch
from
August 29, 2026 01:42
1f2f722 to
e7f2b5a
Compare
7 tasks
Allows callers to enumerate the security profile's rule list, including the built-in defaults (SHA-1, MD5, CAST5/3DES/IDEA/BLOWFISH, RIPEMD). Useful for diagnostics, tooling, and letting downstream consumers report which features rnp considers insecure.
Extends test_ffi_security_rule_enumeration to also add a public-key rule (EdDSA, PROHIBITED) so the case rnp::FeatureType::PublicKey branch in rnp_get_security_rule_at and the SecurityLevel::Disabled → RNP_SECURITY_PROHIBITED mapping are exercised. Adds the same RNP_FEATURE_PK_ALG handling to get_feature_sec_value() that hash and cipher types already enjoy, so rnp_add_security_rule, rnp_get_security_rule, and rnp_remove_security_rule accept public-key features symmetrically with the other two types.
…#6) Foundation for FIPS-compliant mode. Adds a cmake build switch ENABLE_FIPS_MODE that: - forces CRYPTO_BACKEND=openssl (Botan has no validated FIPS provider) - requires OpenSSL 3.x (FIPS provider is a 3.x feature) - defines RNP_FIPS_MODE throughout the library - adds Disabled-level default security rules for non-FIPS algorithms (Twofish, CAST5, IDEA, Blowfish, SM4, MD5, SHA1, RIPEMD160, EdDSA, SM2, ElGamal) Adds the FFI query rnp_is_fips_mode_enabled() so callers can detect the compile-time setting at runtime. Documents the certification boundary in docs/security.adoc: rnp is a consumer of OpenSSL's validated FIPS provider module, not a validated module itself. Adds a CI leg that builds and tests under -DENABLE_FIPS_MODE=On. This is foundation only. Constant-time audit, zeroization, Argon2 → PBKDF2 S2K migration, and FIPS provider loading ceremony are intentionally out of scope and will land in follow-up PRs.
Adds test_ffi_fips_mode_default_rules which is compiled in only when RNP_FIPS_MODE is defined. It queries each algorithm the FIPS default profile marks Disabled (CAST5, IDEA, BLOWFISH, MD5, SHA1, RIPEMD160, EDDSA, ELGAMAL) via rnp_get_security_rule and asserts the level is RNP_SECURITY_PROHIBITED. AES-256 is sanity-checked to remain DEFAULT. Extends get_feature_sec_value() in the FFI to also accept RNP_FEATURE_PK_ALG so the Disabled public-key rules can be queried through the same API as hash and cipher rules.
When librnp-obj has no INTERFACE_COMPILE_DEFINITIONS set (any non-FIPS build), get_target_property() leaves val as the literal 'val-NOTFOUND'. set_property() then propagated it as a define, so every consumer target compiled with -Dval-NOTFOUND, defining a macro 'val' that broke any translation unit using 'val' as a parameter name (rnpcpp.hpp, rnpcfg.h, ...). All Linux/macOS/CodeQL builds failed with 'expected unqualified-id before - token'. Skip properties that come back *-NOTFOUND.
Main's lint now runs the clang-format 11.1.0 binary (a6b0b99); these files were formatted under the previous 11.0.x pin and drifted.
…ecks str_to_cipher()/str_to_hash_alg()/str_to_pubkey_alg() fold a backend availability check into name resolution, so under the OpenSSL FIPS provider every prohibited algorithm failed to resolve and rnp_get_security_rule() returned RNP_ERROR_BAD_PARAMETERS for exactly the algorithms whose rules users need to query (test_ffi_fips_mode_ default_rules, test_ffi_security_rule_enumeration). get_feature_sec_value() now resolves via the name tables directly; availability stays where it belongs, in the *_supported() queries. Also restrict the fips-mode workflow's test step to the FIPS/security tests: the provider prohibits legacy algorithms, so legacy fixtures (SHA-1 signatures, EdDSA/Curve25519 keyrings, IDEA ...) cannot pass in that job by design.
The FIPS default profile appends 12 Disabled rules and disables MD5/ SHA1 from time 0, so queries before the regular insecure cutoffs and the rule-removal counts differ under RNP_FIPS_MODE. Guard the affected assertions and match enumerated rules by from/flags instead of name alone. Verified locally with -DENABLE_FIPS_MODE=On against OpenSSL 3 (both tests pass in FIPS and non-FIPS builds).
ronaldtse
force-pushed
the
weak-cipher-reporting
branch
from
August 30, 2026 20:37
e7f2b5a to
3fdd8c3
Compare
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.
Summary
Two related security-profile changes, combined for one review (formerly #2424 + #2427):
rnp_get_security_rule_count()/rnp_get_security_rule_at(): enumerate the active security profile's rules (default SHA-1/MD5 rules plus user-added), covering hash/symmetric/public-key feature types, levels, timestamps and flags.ENABLE_FIPS_MODECMake switch +rnp_is_fips_mode_enabled(): compile-time tightening of the default SecurityProfile (non-FIPS algorithms Disabled, OpenSSL backend only). See docs/security.adoc for the certification boundary — rnp consumes OpenSSL's FIPS provider, it is not a validated module itself.Test plan
ENABLE_FIPS_MODEbuild