WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions kem/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ categories = ["cryptography", "no-std"]
description = "Traits for key encapsulation mechanisms"

[dependencies]
crypto-common = { version = "0.2.0-rc.4", features = ["rand_core"], path = "../crypto-common" }
rand_core = "0.9"
zeroize = { version = "1.7", default-features = false }

Expand Down
4 changes: 3 additions & 1 deletion kem/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#![forbid(unsafe_code)]
#![warn(missing_docs, unused_qualifications, missing_debug_implementations)]

pub use crypto_common::{KeyInit, KeySizeUser};

use core::fmt::Debug;
use rand_core::TryCryptoRng;

Expand All @@ -26,7 +28,7 @@ pub trait Encapsulate<EK, SS> {
///
/// Often, this will just be a secret key. But, as with [`Encapsulate`], it can be a bundle
/// of secret keys, or it can include a sender's private key for authenticated encapsulation.
pub trait Decapsulate<EK, SS> {
pub trait Decapsulate<EK, SS>: KeyInit {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that KeyInit should be a super trait of Decapsulate? Couldn't Decapsulate in theory be implemented on top of a HSM?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I guess I'll close this, but perhaps we can use KeyInit by convention in the KEM crates.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worth to re-export KeyInit from kem to promote its use.

/// Decapsulation error
type Error: Debug;

Expand Down