Repository navigation
Conversation
curve25519-dalek 5.0.0 computes wrong scalar multiplication results in its AVX-512 backend. It reaches cas-lib through ed25519-dalek, x25519-dalek and hpke. Update the lockfile with a targeted `cargo update -p curve25519-dalek`, and move the crate from dev-dependencies to dependencies with a 5.1.0 floor so downstream crates (cas-core-lib and the SDKs) can't resolve the vulnerable version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been 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.
Closes #162.
What
A new
eccmodule with ECDSA and ECDH over NIST P-256, P-384, P-521 and secp256k1, built on RustCryptop256/p384/p521/k2560.14 andecdsa0.17.ECDSA (
ecc::cas_ecdsa::CASEcdsa):CASEcdsaP256(ES256),CASEcdsaP384(ES384),CASEcdsaP521(ES512),CASEcdsaSecp256k1(ES256K)generate_key_pair,sign/verify(IEEE P1363r || s, as JOSE, COSE and WebCrypto use) andsign_der/verify_der(strict ASN.1 DER, as X.509, TLS and OpenSSL use).verify*returnsOk(false)for any bad or malformed signature. It returnsErr(InvalidPemKey)only when the public key can't be parsed or is for another curve.signalways produces low-S signatures.verify/verify_derfollow standard ECDSA and also accept high-S. The extraverify_low_s/verify_der_low_sreject high-S, as BIP-62 / BIP-146 require.ECDH (
ecc::cas_ecdh::CASEcdh):CASEcdhP256,CASEcdhP384,CASEcdhP521,CASEcdhSecp256k1generate_key_pairanddiffie_hellman(my_private_pem, peer_public_pem), which returns the raw x-coordinate Z (the same value WebCryptoderiveBitsand OpenSSLEVP_PKEY_derivereturn).Keys are PEM: private keys PKCS#8 (SEC1
EC PRIVATE KEYis also accepted), public keys SPKI. Shared code is inecc/keys.rs, andecc/types.rsdefinesEcKeyPair.Conventions followed
cas_<module>.rs, impl in<algorithm>.rs, declared inlib.rswith no re-exports.CasResulteverywhere and no panics. No newCasErrorvariants; the module reusesInvalidPemKey,KeyGenerationFailedandSigningFailed.SecretKey/SigningKey/SharedSecretzeroize on drop.EcKeyPairredactsprivate_keyinDebugand implementsZeroize, like the PQC structs.Tests
tests/wycheproof.rs):ecdsa_secp{256r1_sha256,384r1_sha384,521r1_sha512,256k1_sha256}_test.jsonand their_p1363variants, plusecdsa_secp256k1_sha256_bitcoin_test.jsonrun againstverify_der_low_s.ecdh_secp{256r1,384r1,521r1}_pem_test.jsonfiles andecdh_secp256k1_test.json.tests/data/ecc/, consumed bytests/ecc.rs): FIPS 186-4SigVer.rspandPKV.rsp, and SP 800-56AKAS_ECC_CDH_PrimitiveTest.txt, trimmed to the supported curves and hashes. The provenance and SHA-256 checksums are intests/data/ecc/README.md.Debug/ zeroize intests/zeroize.rs.cargo test --lockedpasses locally.Notes for reviewers
Vec<u8>, notZeroizing. The issue asked forZeroizing. This follows the CLAUDE.md convention that returned secrets stay plain buffers for the FFI layers to zero, and it matches X25519'sdiffie_hellman. The internalSharedSecretzeroizes on drop._pemfiles instead of the plainecdh_secp*_test.json. They hold the same cases in the form the API takes. secp256k1 has no_pemfile, so it uses the plain file, and the test wraps the keys in PEM. This is documented intests/data/wycheproof/README.md.p256,p384,p521,k256,ecdsa,elliptic-curve, all with default features off.cargo auditonmaintoo).curve25519-dalek5.0.0, pulled in byed25519-dalek,x25519-dalekandhpke, computes wrong scalar multiplication results in its AVX-512 backend. The lockfile moves to 5.1.0 with a targetedcargo update -p curve25519-dalek, and the crate moves from dev-dependencies to dependencies with a5.1.0floor so downstream crates can't resolve 5.0.0. It's in this PR, so the squash commit won't get a separate Security line in the changelog; consider noting it in the release PR.cargo audit --deny unsound --deny yankedpasses locally.🤖 Generated with Claude Code