Repository navigation
ECDSA P-384, keys held in a KMS or an HSM, and a FIPS leg - #31
Merged
Merged
Conversation
BeamMCP.Signer.ECDSAP384 signs ECDSA over P-384 with SHA-384 behind the same sign/2, from a local key or a remote one, and returns 96 bytes r || s checked under the public key before it leaves. MLDSA87, COSE and COSE.HashEnvelope take remote: in place of the seed: the host's function signs where the key is held, asked for the bytes (at most 4,096) or for FIPS 204's mu, computed here. Every signature is checked as a local one is; the hash envelope judges remote: before its first chunk. BeamMCP.Signer.KMS gives AWS KMS's Sign input, its response's signature and GetPublicKey's key, read strictly. No client, no new dependency. The hash envelope refused to sign on every FIPS host: it asked crypto:supports/1, which leaves ML-DSA-87 out in FIPS mode even where the provider serves it. It now asks by trying a verify, as the test helper does. CI runs the suite in FIPS mode under OpenSSL FIPS providers 3.5.9 and 3.1.2 on x86_64 and aarch64 and records what each signature does there; Ed25519 is refused by OTP in FIPS mode (erlang/otp#12305). One quality gate job is green only when every job is. Signed-off-by: Ayla Croft <aylacroft@proton.me>
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.
What
BeamMCP.Signer.ECDSAP384(new): ECDSA P-384 / SHA-384 (FIPS 186-5) behind the unchangedsign/2.remote:(asked{:digest, sha384}, answering DER).r || s. The DER is read strictly: minimal integers, nothing trailing, and r and s in 1..n-1.remote:andmu:onMLDSA87,COSEandCOSE.HashEnvelope:{:raw, bytes}(at most 4,096 bytes) or{:external_mu, mu}.:crypto.hash_xof/3.private_key:andremote:is refused.remote:andmu:before it reads the first chunk.BeamMCP.Signer.KMS(new): AWS KMS's wire shapes only.sign_input/2: RAW or EXTERNAL_MU withML_DSA_SHAKE_256; DIGEST withECDSA_SHA_384.signature/1reads a Sign response's signature.public_key/1accepts exactly the one DER SPKI for each key type, or a GetPublicKey response whoseKeySpecandKeyUsageagree.COSE.HashEnveloperefused to sign on every FIPS host. It askedcrypto:supports/1, which leavesmldsa87out in FIPS mode even where the provider serves it. It now asks by trying a verify of zeros, which answersfalsewhere ML-DSA-87 works and raises where it does not. The test helper does the same.fipsjob runs OTP 28.5.0.9--enable-fipsover OpenSSL 3.5.9, with provider 3.5.9 (CMVP #5586) and provider 3.1.2 (CMVP #4985), on x86_64 and aarch64. It uses beam_mcp's recipe and records per algorithm, in the job summary, what each provider gives.Ed25519.sign/2answers{:error, :crypto_refused}there.quality gatejob is green only when every other job is, so a ruleset can require that one name instead of each leg's.Measured
Suite: 138 tests, 0 failures on OTP 28.5.0.8 with OpenSSL 3.5.9. On a runtime without ML-DSA, the refusal tests run and the ML-DSA tests are skipped. Credo
--strictis clean, andmix docsgives no warnings.FIPS mode, locally (OTP 28.5.0.9
--enable-fips, x86_64): 138 tests, 0 failures under each provider. The record:AWS KMS, live (us-east-1,
--only aws_live): each request went out as exactlyKMS.sign_input/2's map through the AWS CLI. 3 tests, 0 failures:The offline tests replay those signatures as fixtures.
Mutation testing: 16 mutants, all caught by a failing test. They cover the μ prefix, tr's length, the 4,096 boundary,
mu: :always, both keys at once, a remote signature's size, the DER range, minimality and trailing bytes, the digest sent, the hash envelope's early check, the shared key helper, KMS key-usage, algorithm and SPKI strictness, and the FIPS probe.No public entry of
BeamMCP.Signerchanges: the callback is still onesign/2. The additions are new modules and options.