Skip to content

Commit

Permalink
Merge branch 'dev' into jonas/psq
Browse files Browse the repository at this point in the history
  • Loading branch information
jschneider-bensch authored Jun 13, 2024
2 parents d60924c + 52af832 commit 249f3f6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 34 deletions.
2 changes: 0 additions & 2 deletions libcrux-ecdh/src/hacl/p256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ pub enum Error {
InvalidPoint,
NoCompressedPoint,
NoUnCompressedPoint,
SigningError,
InvalidSignature,
}

/// Parse an uncompressed P256 point and return the 64 byte array with the
Expand Down
Binary file added libcrux-ml-kem/implementation_notes.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions src/hacl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(crate) mod sha3;
pub enum Error {
ChaCha20Poly1305(chacha20_poly1305::Error),
Curve25519(libcrux_ecdh::curve25519::Error),
P256(libcrux_ecdh::p256::Error),
P256ECDH(libcrux_ecdh::p256::Error),
P256ECDSA(p256::ecdsa::Error),
Ed25519(ed25519::Error),
Hkdf(libcrux_hkdf::Error),
Expand All @@ -46,7 +46,7 @@ impl From<libcrux_ecdh::curve25519::Error> for Error {

impl From<libcrux_ecdh::p256::Error> for Error {
fn from(val: libcrux_ecdh::p256::Error) -> Self {
Error::P256(val)
Error::P256ECDH(val)
}
}

Expand Down
31 changes: 1 addition & 30 deletions src/kem.rs
Original file line number Diff line number Diff line change
@@ -1,35 +1,6 @@
//! # Key Encapsulation Mechanism
//!
//! A KEM interface.
//!
//! For ECDH structs, check the [`ecdh`] module.
//!
//! Available algorithms:
//! * [`Algorithm::X25519`]\: x25519 ECDH KEM. Also see [`ecdh#x25519`].
//! * [`Algorithm::Secp256r1`]\: NIST P256 ECDH KEM. Also see [`ecdh#P256`].
//! * [`Algorithm::MlKem512`]\: ML-KEM 512 from [FIPS 203].
//! * [`Algorithm::MlKem768`]\: ML-KEM 768 from [FIPS 203].
//! * [`Algorithm::MlKem1024`]\: ML-KEM 1024 from [FIPS 203].
//! * [`Algorithm::X25519MlKem768Draft00`]\: Hybrid x25519 - ML-KEM 768 [draft kem for hpke](https://www.ietf.org/archive/id/draft-westerbaan-cfrg-hpke-xyber768d00-00.html).
//! * [`Algorithm::XWingKemDraft02`]\: Hybrid x25519 - ML-KEM 768 [draft xwing kem for hpke](https://www.ietf.org/archive/id/draft-connolly-cfrg-xwing-kem-02.html).
//!
//! ```
//! use libcrux::{kem::*, drbg::Drbg, digest::Algorithm::Sha256};
//!
//! let mut rng = Drbg::new(Sha256).unwrap();
//! let (sk_a, pk_a) = key_gen(Algorithm::MlKem768, &mut rng).unwrap();
//! let received_pk = pk_a.encode();
//!
//! let pk = PublicKey::decode(Algorithm::MlKem768, &received_pk).unwrap();
//! let (ss_b, ct_b) = pk.encapsulate(&mut rng).unwrap();
//! let received_ct = ct_b.encode();
//!
//! let ct_a = Ct::decode(Algorithm::MlKem768, &received_ct).unwrap();
//! let ss_a = ct_a.decapsulate(&sk_a).unwrap();
//! assert_eq!(ss_b.encode(), ss_a.encode());
//! ```
//!
//! [FIPS 203]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.203.ipd.pdf
//! This module exposes a KEM interface via the [`libcrux_kem`] crate.
pub use libcrux_ml_kem::{
mlkem1024::{MlKem1024Ciphertext, MlKem1024PrivateKey, MlKem1024PublicKey},
Expand Down

0 comments on commit 249f3f6

Please sign in to comment.