-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yngrtc
committed
Aug 21, 2023
1 parent
2148cd7
commit fe2fc3f
Showing
8 changed files
with
75 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
pub mod algs; | ||
|
||
use algs::*; | ||
|
||
// Suite is an HPKE cipher suite consisting of a KEM, KDF, and AEAD algorithm. | ||
#[derive(Default, Debug, Clone, Eq, PartialEq)] | ||
pub struct HpkeSuite { | ||
kem: Kem, | ||
kdf: Kdf, | ||
aead: Aead, | ||
} | ||
|
||
impl HpkeSuite { | ||
pub fn new(kem: Kem, kdf: Kdf, aead: Aead) -> Self { | ||
HpkeSuite { kem, kdf, aead } | ||
} | ||
} | ||
|
||
impl crate::crypto::provider::Hpke for HpkeSuite {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#[allow(non_camel_case_types)] | ||
#[derive(Default, Debug, Copy, Clone, Eq, PartialEq)] | ||
#[repr(u16)] | ||
pub enum Kem { | ||
#[default] | ||
// KEM_P256_HKDF_SHA256 is a KEM using P256 curve and HKDF with SHA-256. | ||
KEM_P256_HKDF_SHA256 = 0x10, | ||
// KEM_P384_HKDF_SHA384 is a KEM using P384 curve and HKDF with SHA-384. | ||
KEM_P384_HKDF_SHA384 = 0x11, | ||
// KEM_P521_HKDF_SHA512 is a KEM using P521 curve and HKDF with SHA-512. | ||
KEM_P521_HKDF_SHA512 = 0x12, | ||
// KEM_X25519_HKDF_SHA256 is a KEM using X25519 Diffie-Hellman function | ||
// and HKDF with SHA-256. | ||
KEM_X25519_HKDF_SHA256 = 0x20, | ||
// KEM_X448_HKDF_SHA512 is a KEM using X448 Diffie-Hellman function and | ||
// HKDF with SHA-512. | ||
KEM_X448_HKDF_SHA512 = 0x21, | ||
// KEM_X25519_KYBER768_DRAFT00 is a hybrid KEM built on DHKEM(X25519, HKDF-SHA256) | ||
// and Kyber768Draft00 | ||
KEM_X25519_KYBER768_DRAFT00 = 0x30, | ||
} | ||
|
||
#[allow(non_camel_case_types)] | ||
#[derive(Default, Debug, Copy, Clone, Eq, PartialEq)] | ||
#[repr(u16)] | ||
pub enum Kdf { | ||
#[default] | ||
// KDF_HKDF_SHA256 is a KDF using HKDF with SHA-256. | ||
KDF_HKDF_SHA256 = 0x01, | ||
// KDF_HKDF_SHA384 is a KDF using HKDF with SHA-384. | ||
KDF_HKDF_SHA384 = 0x02, | ||
// KDF_HKDF_SHA512 is a KDF using HKDF with SHA-512. | ||
KDF_HKDF_SHA512 = 0x03, | ||
} | ||
|
||
#[allow(non_camel_case_types)] | ||
#[derive(Default, Debug, Copy, Clone, Eq, PartialEq)] | ||
#[repr(u16)] | ||
pub enum Aead { | ||
#[default] | ||
// AEAD_AES128GCM is AES-128 block cipher in Galois Counter Mode (GCM). | ||
AEAD_AES128GCM = 0x01, | ||
// AEAD_AES256GCM is AES-256 block cipher in Galois Counter Mode (GCM). | ||
AEAD_AES256GCM = 0x02, | ||
// AEAD_ChaCha20Poly1305 is ChaCha20 stream cipher and Poly1305 MAC. | ||
AEAD_ChaCha20Poly1305 = 0x03, | ||
} |