From d9b615fb0d5d8f6d52891d985f3ea1ceff6dec8a Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Fri, 16 Aug 2024 14:03:34 -0600 Subject: [PATCH] ml-kem: make `DecapsulationKey::encapsulation_key` a `pub fn` Closes #39 --- ml-kem/src/kem.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ml-kem/src/kem.rs b/ml-kem/src/kem.rs index 2ac2566..8485d64 100644 --- a/ml-kem/src/kem.rs +++ b/ml-kem/src/kem.rs @@ -100,16 +100,17 @@ impl

DecapsulationKey

where P: KemParams, { + /// Get the [`EncapsulationKey`] which corresponds to this [`DecapsulationKey`]. + pub fn encapsulation_key(&self) -> &EncapsulationKey

{ + &self.ek + } + pub(crate) fn generate(rng: &mut impl CryptoRngCore) -> Self { let d: B32 = rand(rng); let z: B32 = rand(rng); Self::generate_deterministic(&d, &z) } - pub(crate) fn encapsulation_key(&self) -> &EncapsulationKey

{ - &self.ek - } - #[must_use] #[allow(clippy::similar_names)] // allow dk_pke, ek_pke, following the spec pub(crate) fn generate_deterministic(d: &B32, z: &B32) -> Self {