Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions ml-dsa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ use hybrid_array::{
use module_lattice::Truncate;
use sha3::Shake256;

#[cfg(feature = "rand_core")]
use signature::rand_core::CryptoRng;

/// A 32-byte array, defined here for brevity because it is used several times
pub type B32 = Array<u8, U32>;

Expand Down Expand Up @@ -258,47 +255,6 @@ impl ParameterSet for MlDsa87 {
const TAU: usize = 60;
}

/// A parameter set that knows how to generate key pairs.
#[deprecated(
since = "0.1.0",
note = "use the `KeyInit` or `Generate` traits instead"
)]
pub trait KeyGen: MlDsaParams {
/// The type that is returned by key generation
type KeyPair: Keypair;

/// Generate a signing key pair from the specified RNG
#[cfg(feature = "rand_core")]
fn key_gen<R: CryptoRng + ?Sized>(rng: &mut R) -> Self::KeyPair;

/// Deterministically generate a signing key pair from the specified seed
///
/// This method reflects the ML-DSA.KeyGen_internal algorithm from FIPS 204.
fn from_seed(xi: &B32) -> Self::KeyPair;
}

#[allow(deprecated, reason = "deprecated impl block")]
impl<P> KeyGen for P
where
P: MlDsaParams,
{
type KeyPair = SigningKey<P>;

/// Generate a signing key pair from the specified RNG
#[cfg(feature = "rand_core")]
fn key_gen<R: CryptoRng + ?Sized>(rng: &mut R) -> SigningKey<P> {
let mut xi = B32::default();
rng.fill_bytes(&mut xi);
Self::from_seed(&xi)
}

/// Deterministically generate a signing key pair from the specified seed
// Algorithm 6 ML-DSA.KeyGen_internal
fn from_seed(seed: &Seed) -> SigningKey<P> {
SigningKey::from_seed(seed)
}
}

/// Type which opportunistically uses `Box` when the `alloc` feature is available but falls back to
/// a stack-allocated type when it's unavailable.
#[derive(Clone, Debug, PartialEq)]
Expand Down