Skip to content

Commit

Permalink
Add missing k256 kat_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DanGould committed Aug 11, 2024
1 parent 1c14d38 commit 73dc13d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/kat_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ impl TestableKem for DhP521HkdfSha512 {
}
}

impl TestableKem for Dh256HkdfSha256 {
type EphemeralKey = <Dh256HkdfSha256 as KemTrait>::PrivateKey;

fn encap_with_eph(
pk_recip: &Self::PublicKey,
sender_id_keypair: Option<(&Self::PrivateKey, &Self::PublicKey)>,
sk_eph: Self::EphemeralKey,
) -> Result<(SharedSecret<Self>, Self::EncappedKey), HpkeError> {
kem::dhk256_hkdfsha256::encap_with_eph(pk_recip, sender_id_keypair, sk_eph)
}
}

/// Asserts that the given serializable values are equal
macro_rules! assert_serializable_eq {
($a:expr, $b:expr, $args:tt) => {
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ pub(crate) use alloc::vec::Vec;
feature = "x25519",
feature = "p256",
feature = "p384",
feature = "p521"
feature = "p521",
feature = "k256"
))]
mod kat_tests;

Expand Down

0 comments on commit 73dc13d

Please sign in to comment.