diff --git a/Cargo.lock b/Cargo.lock index 4b0575f..af1d458 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -154,7 +154,7 @@ version = "0.5.0-pre.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b1425e6ce000f05a73096556cabcfb6a10a3ffe3bb4d75416ca8f00819c0b6a" dependencies = [ - "crypto-common", + "crypto-common 0.2.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)", "inout", ] @@ -288,6 +288,14 @@ dependencies = [ "hybrid-array", ] +[[package]] +name = "crypto-common" +version = "0.2.0-rc.2" +source = "git+https://github.com/RustCrypto/traits.git#915474f1ed5be0a19fd102d5f75ef8e04c765416" +dependencies = [ + "hybrid-array", +] + [[package]] name = "crypto-primes" version = "0.7.0-dev" @@ -332,12 +340,11 @@ dependencies = [ [[package]] name = "digest" version = "0.11.0-pre.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c478574b20020306f98d61c8ca3322d762e1ff08117422ac6106438605ea516" +source = "git+https://github.com/RustCrypto/traits.git#915474f1ed5be0a19fd102d5f75ef8e04c765416" dependencies = [ "block-buffer", "const-oid", - "crypto-common", + "crypto-common 0.2.0-rc.2 (git+https://github.com/RustCrypto/traits.git)", "subtle", ] @@ -548,8 +555,7 @@ checksum = "bcaaec4551594c969335c98c903c1397853d4198408ea609190f420500f6be71" [[package]] name = "hmac" version = "0.13.0-pre.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62c11fc82c6b89c906b4d26b7b5a305d0b3aebd4b458dd1bd0a7ed98c548a28e" +source = "git+https://github.com/RustCrypto/MACs.git#64d671d5c375838173d18e30bc14dffc80c13e51" dependencies = [ "digest", ] @@ -1104,8 +1110,7 @@ dependencies = [ [[package]] name = "sha1" version = "0.11.0-pre.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55f44e40722caefdd99383c25d3ae52a1094a1951215ae76f68837ece4e7f566" +source = "git+https://github.com/RustCrypto/hashes.git#7d44caf065dbeb3f10a372a26a8b9f1c927f8433" dependencies = [ "cfg-if", "cpufeatures", @@ -1115,8 +1120,7 @@ dependencies = [ [[package]] name = "sha2" version = "0.11.0-pre.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b4241d1a56954dce82cecda5c8e9c794eef6f53abe5e5216bac0a0ea71ffa7" +source = "git+https://github.com/RustCrypto/hashes.git#7d44caf065dbeb3f10a372a26a8b9f1c927f8433" dependencies = [ "cfg-if", "cpufeatures", @@ -1126,8 +1130,7 @@ dependencies = [ [[package]] name = "sha3" version = "0.11.0-pre.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bc997d7a5fa67cc1e352b2001124d28edb948b4e7a16567f9b3c1e51952524" +source = "git+https://github.com/RustCrypto/hashes.git#7d44caf065dbeb3f10a372a26a8b9f1c927f8433" dependencies = [ "digest", "keccak", diff --git a/Cargo.toml b/Cargo.toml index d591348..57da9a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,14 @@ slh-dsa = { path = "./slh-dsa" } # https://github.com/RustCrypto/traits/pull/1774 # https://github.com/RustCrypto/traits/pull/1822 # https://github.com/RustCrypto/traits/pull/1845 +digest = { git = "https://github.com/RustCrypto/traits.git" } elliptic-curve = { git = "https://github.com/RustCrypto/traits.git" } signature = { git = "https://github.com/RustCrypto/traits.git" } crypto-primes = { git = "https://github.com/entropyxyz/crypto-primes.git" } + +hmac = { git = "https://github.com/RustCrypto/MACs.git" } + +sha1 = { git = "https://github.com/RustCrypto/hashes.git" } +sha2 = { git = "https://github.com/RustCrypto/hashes.git" } +sha3 = { git = "https://github.com/RustCrypto/hashes.git" } diff --git a/dsa/src/generate/secret_number.rs b/dsa/src/generate/secret_number.rs index a579ac0..e2665c7 100644 --- a/dsa/src/generate/secret_number.rs +++ b/dsa/src/generate/secret_number.rs @@ -6,7 +6,7 @@ use crate::{Components, signing_key::SigningKey}; use alloc::vec; use core::cmp::min; use crypto_bigint::{BoxedUint, NonZero, RandomBits, Resize}; -use digest::{Digest, FixedOutputReset, core_api::BlockSizeUser}; +use digest::{Digest, FixedOutputReset, block_api::BlockSizeUser}; use signature::rand_core::TryCryptoRng; use zeroize::Zeroizing; diff --git a/dsa/src/signing_key.rs b/dsa/src/signing_key.rs index 08daff7..067fa58 100644 --- a/dsa/src/signing_key.rs +++ b/dsa/src/signing_key.rs @@ -11,7 +11,7 @@ use crypto_bigint::{ BoxedUint, NonZero, Resize, modular::{BoxedMontyForm, BoxedMontyParams}, }; -use digest::{Digest, FixedOutputReset, core_api::BlockSizeUser}; +use digest::{Digest, FixedOutputReset, block_api::BlockSizeUser}; use pkcs8::{ AlgorithmIdentifierRef, EncodePrivateKey, PrivateKeyInfoRef, SecretDocument, der::{ diff --git a/dsa/tests/deterministic.rs b/dsa/tests/deterministic.rs index 59e6983..daaa376 100644 --- a/dsa/tests/deterministic.rs +++ b/dsa/tests/deterministic.rs @@ -1,6 +1,6 @@ #![cfg(feature = "hazmat")] use crypto_bigint::{BoxedUint, NonZero, Odd}; -use digest::{Digest, FixedOutputReset, core_api::BlockSizeUser}; +use digest::{Digest, FixedOutputReset, block_api::BlockSizeUser}; use dsa::{Components, Signature, SigningKey, VerifyingKey}; use sha1::Sha1; use sha2::{Sha224, Sha256, Sha384, Sha512}; diff --git a/ecdsa/src/hazmat.rs b/ecdsa/src/hazmat.rs index 11c776d..61f9eb4 100644 --- a/ecdsa/src/hazmat.rs +++ b/ecdsa/src/hazmat.rs @@ -32,7 +32,7 @@ use { elliptic_curve::FieldBytesSize, signature::{ PrehashSignature, - digest::{Digest, FixedOutput, FixedOutputReset, core_api::BlockSizeUser}, + digest::{Digest, FixedOutput, FixedOutputReset, block_api::BlockSizeUser}, }, }; diff --git a/rfc6979/Cargo.toml b/rfc6979/Cargo.toml index e11014e..311742a 100644 --- a/rfc6979/Cargo.toml +++ b/rfc6979/Cargo.toml @@ -16,7 +16,7 @@ edition = "2024" rust-version = "1.85" [dependencies] -hmac = { version = "=0.13.0-pre.5", default-features = false, features = ["reset"] } +hmac = { version = "=0.13.0-pre.5", default-features = false } subtle = { version = "2", default-features = false } [dev-dependencies] diff --git a/rfc6979/src/lib.rs b/rfc6979/src/lib.rs index f937743..fac9666 100644 --- a/rfc6979/src/lib.rs +++ b/rfc6979/src/lib.rs @@ -42,11 +42,11 @@ mod ct; pub use hmac::digest::array::typenum::consts; use hmac::{ - SimpleHmac, + SimpleHmacReset, digest::{ Digest, FixedOutput, FixedOutputReset, KeyInit, Mac, array::{Array, ArraySize}, - core_api::BlockSizeUser, + block_api::BlockSizeUser, }, }; @@ -124,7 +124,7 @@ where D: Digest + BlockSizeUser + FixedOutputReset, { /// HMAC key `K` (see RFC 6979 Section 3.2.c) - k: SimpleHmac, + k: SimpleHmacReset, /// Chaining value `V` (see RFC 6979 Section 3.2.c) v: Array, @@ -136,7 +136,7 @@ where { /// Initialize `HMAC_DRBG` pub fn new(entropy_input: &[u8], nonce: &[u8], personalization_string: &[u8]) -> Self { - let mut k = SimpleHmac::new(&Default::default()); + let mut k = SimpleHmacReset::new(&Default::default()); let mut v = Array::default(); for b in &mut v { @@ -149,7 +149,7 @@ where k.update(entropy_input); k.update(nonce); k.update(personalization_string); - k = SimpleHmac::new_from_slice(&k.finalize().into_bytes()).expect("HMAC error"); + k = SimpleHmacReset::new_from_slice(&k.finalize().into_bytes()).expect("HMAC error"); // Steps 3.2.e,g: v = HMAC_k(v) k.update(&v); @@ -178,8 +178,8 @@ where self.k.update(&self.v); self.k.update(&[0x00]); - self.k = - SimpleHmac::new_from_slice(&self.k.finalize_reset().into_bytes()).expect("HMAC error"); + self.k = SimpleHmacReset::new_from_slice(&self.k.finalize_reset().into_bytes()) + .expect("HMAC error"); self.k.update(&self.v); self.v = self.k.finalize_reset().into_bytes(); }