Repository navigation
Conversation
dwoz
added a commit
to dwoz/salt
that referenced
this pull request
Dec 5, 2026
CI failed on Photon OS 4/5 FIPS runs with: cryptography.exceptions.UnsupportedAlgorithm: X25519 is not supported by this version of OpenSSL. The underlying issue is container-level: the Photon FIPS CI image bundles a pre-3.5 OpenSSL FIPS provider that excludes Curve25519-based algorithms. OpenSSL 3.5's FIPS module (FIPS 140-3 cert saltstack#4985) does cover X25519, so the "FIPS mode disables X25519" assumption is already becoming outdated. Rather than skip arbitrarily on FIPS_TESTRUN (which would stay wrong once the container is refreshed), add a runtime probe: - salt.crypt.x25519_available() -- attempt X25519 key generation, return True/False. Used by both the config-load validator and the test-skip markers so both respond to actual OpenSSL capability. - apply_minion_config / apply_master_config raise SaltConfigurationError with a clear "update OpenSSL or pick RSA OAEP" message when a KEX algorithm is configured but X25519 isn't available. - tests/pytests/unit/crypt/test_key_types.py: individual @skip_if_no_x25519 markers on the 8 KEX-exercising tests. - tests/pytests/unit/crypt/test_kex_integration.py: module-level pytestmark since every test uses X25519. - New test_config_load_rejects_kex_when_x25519_unavailable covers the config-load error path (skips when X25519 IS available). Local run: 88 passed, 12 skipped (the new skip plus pre-existing FIPS-related skips). When the Photon CI container ships OpenSSL >= 3.5 FIPS, these tests begin running automatically.
Standalone X25519 is not FIPS-approved (NIST policy, unchanged across OpenSSL 3.5.x FIPS provider revisions). That leaves FIPS fleets with only the legacy RSA-OAEP path even though the bundled OpenSSL 3.5.8 FIPS provider exposes both Ed25519 identity keys and ML-KEM-768. Add a third KEX variant with no X25519 dependency: - MLKEM768-HKDF-SHA256 -- minion generates ML-KEM-768 keypair, sends pub; master encapsulates against it, returns ciphertext + the master ephemeral is the ciphertext itself. HKDF-SHA256 derives the AES-256 session key from the single shared secret. AEAD-wrap aes + session under that key, master-ephemeral + wrap hashes signed under the long-term identity. Same transcript-sig / AEAD-aad construction as the other KEX variants. - New KEX_ALGORITHMS_REQUIRING_X25519 tuple separates variants that depend on standalone X25519 from the pure-ML-KEM path. Config validator only refuses when the configured algorithm actually requires X25519 and the probe fails; MLKEM768-HKDF-SHA256 gets its own ML-KEM availability probe. - Runtime probe mlkem768_available() mirrors x25519_available(): tries to actually generate a keypair rather than rely on the import-time HAS_MLKEM flag, so FIPS providers that expose only a subset report accurately. - New kex_master_reply branch for pure-ML-KEM: master_ephemeral is just the ciphertext (1088B), no X25519 pub prepended. Minion-consume mirror decaps against the stored ML-KEM private; no ECDH step. Unlocks ``key_type=ed25519`` + KEX for FIPS fleets (Ed25519 is FIPS-approved in 3.5.8; was previously only pairable with the X25519-based KEX algorithms). Tests: new test_kex_mlkem768_only_roundtrip. 89 pass / 12 skip.
NSA's December 2026 PQC-transition press release points at CNSA 2.0 for all new NSS acquisitions after 2027-01-01. CNSA 2.0 requires Category-5 PQ primitives: ML-KEM-1024 for key establishment, ML-DSA-87 for signatures, SHA-384+ for hashing, AES-256 for symmetric. This commit brings salt's auth protocol into compliance with that profile. ML-DSA (FIPS 204) signatures and identity keys: - MLDSA44-NONE / MLDSA65-NONE / MLDSA87-NONE signing_algorithm values covering NIST Categories 2 / 3 / 5. MLDSA87-NONE is the CNSA 2.0 requirement. - KEY_TYPE_MLDSA44 / 65 / 87 identity key types; all serialize as PKCS8 PEM like Ed25519. Single-shot sign() / verify() -- hash and randomization are baked into the FIPS 204 construction. - PrivateKey / PublicKey dispatch extended to recognize ML-DSA instances; cross-family algorithm IDs refused as with Ed25519. - gen_keys(key_type=mldsa87, ...) via _generate_private_key dispatcher; PKCS8 PEM shared with Ed25519's non-traditional path. - Config validator enforces key_type <-> signing_algorithm pairing across all non-RSA identity types, not just Ed25519. MLKEM1024-HKDF-SHA384 KEX: - Mirror of MLKEM768-HKDF-SHA256 but at Category-5 security + SHA-384 derivation. Larger ciphertext (1568B) and public key (1568B). - New _kex_hash() selector: SHA-384 for the CNSA 2.0 variant, SHA-256 for every other KEX algorithm. HKDF output + info-string context digests + transcript-sig wrap hashes all follow the hash selector, so the CNSA 2.0 derivation path has zero SHA-256 anywhere. - KEX_ALGORITHMS_REQUIRING_MLKEM subset for config validation. Runtime availability probes: - mlkem1024_available(), mldsa_available(level) mirror the existing mlkem768_available() pattern (try to actually generate a keypair, return bool). Config load rejects ML-DSA key_types and MLKEM1024 when the underlying OpenSSL can't materialize them. New operator-facing constants: - CNSA2_ENCRYPTION_ALGORITHMS, CNSA2_SIGNING_ALGORITHMS, CNSA2_KEY_TYPES tuples name the compliant primitive set. Tests: mldsa roundtrip at all three levels, cross-family rejection, MLKEM1024 roundtrip, CNSA 2.0 full-stack handshake (ML-DSA-87 identity + MLKEM1024-HKDF-SHA384 KEX + AES-GCM wrap), catalog coherence check. 116 pass + 1 skip locally. Refs: - NSA PQC transition press release (Dec 2026) - NIST FIPS 203 (ML-KEM), FIPS 204 (ML-DSA), FIPS 186-5 (EdDSA)
CI Photon FIPS unit run (saltstack#71035, run 47617672322) failed on the single-sweep test_config_load_rejects_kex_when_x25519_unavailable because it iterates all KEX_ALGORITHMS and asserts "X25519" appears in the raised SaltConfigurationError. The validator correctly surfaces "ML-KEM-768 requires ML-KEM-768" (not "X25519") when the configured algorithm is pure-MLKEM and ML-KEM isn't available -- the single-regex assertion can't cover both cases. Split into two tests, each gated on the relevant primitive's runtime availability: - test_config_load_rejects_x25519_kex_when_x25519_unavailable iterates only KEX_ALGORITHMS_REQUIRING_X25519 and expects "X25519" in the error. Same skip condition as before (x25519_available=False). - test_config_load_rejects_mlkem_kex_when_mlkem_unavailable iterates the pure-MLKEM variants, expects "ML-KEM" in the error. Skips when both ML-KEM levels are available (no rejection path to test). Observed side effect from the CI logs: the Photon 5 FIPS CI env does not expose ML-KEM-768 either (relenv-bundled FIPS provider predates the 3.5.4 FIPS 203 cert). The new split test will pass regardless; if/when the container refreshes to 3.5.4+ FIPS, the rejection test auto-skips because mlkem768_available() flips to True.
This branch was previously deployed
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
Delivers the crypto-agility roadmap raised in Discord 11/26 end-to-end: non-RSA identity keys, forward-secret ephemeral key exchange, and post-quantum hybrid KEX. All opt-in; 3008.x defaults unchanged.
What ships
Algorithm catalog (salt/crypt.py)
OAEP-SHA256/384/512,PKCS1v15-SHA256/384/512,PSS-SHA256/384/512for the existing RSA paths.ED25519-NONEas a non-RSA signing algorithm.X25519-HKDF-SHA256— authenticated ephemeral KEX. Full forward secrecy on every auth.X25519-MLKEM768-HKDF-SHA256— post-quantum hybrid. Addresses harvest-now-decrypt-later. Requirescryptography>=46.Polymorphic key classes
PrivateKey/PublicKeydispatch across RSA + Ed25519; cross-family algorithm IDs rejected.gen_keys(keysize, key_type=...)dispatcher. Newkey_typeconfig opt (defaultrsa).Full handshake wiring
AsyncAuth):minion_sign_in_payloademits ephemeral + signs it (proof-of-possession of long-term key);_decrypt_aes_kexverifies the master's transcript sig, derives via HKDF-SHA256, AEAD-unwraps aes + session. Legacy RSA-OAEP token path untouched.AuthFuncs):_kex_master_reply_fieldshelper verifies minion ephemeral sig, callskex_master_reply. Both async (_auth_impl) and sync (_auth_impl_sync) paths branch onenc_algo in KEX_ALGORITHMS.Config validation
Config-load rejects
key_type=ed25519+ non-KEXencryption_algorithm(the auth-reply X9.31 digest sig path can't sign under Ed25519).Security properties of the KEX path
infoand AEADaadboth includeminion_id || nonce || sha256(master_long_term_pub) || sha256(minion_long_term_pub) || sha256(mlkem_ct). Prevents UKS and cross-session replay.Compatibility
OAEP-SHA1/PKCS1v15-SHA1/rsa.HAS_MLKEMso oldercryptographybuilds still import.BEGIN RSA PRIVATE KEY); downstream code that pattern-matches PEM headers should be audited (tracked as follow-up).Tracks: #71034 (PQ roadmap issue).
Test plan
tests/pytests/unit/crypt/test_key_types.py— 18 unit tests covering gen_keys/sign/verify for Ed25519, cross-family rejection, RSA-PSS round-trip, OAEP-SHA256 round-trip, KEX round-trip (X25519 + hybrid), KEX tamper detection, minion-side proof-of-possession, ed25519-requires-KEX config validation.tests/pytests/unit/crypt/test_kex_integration.py— 4 tests driving the full flow throughAsyncAuth.minion_sign_in_payload+AsyncAuth.decrypt_aesagainst a simulated master, parametrized on both KEX algorithms, tamper + missing-field guards.tests/pytests/unit/test_crypt.py(35 pass, 6 skip) unchanged.