-
-
Notifications
You must be signed in to change notification settings - Fork 756
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
Showing
12 changed files
with
789 additions
and
2 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
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,99 @@ | ||
use super::super::*; | ||
use libc::*; | ||
|
||
extern "C" { | ||
pub fn OSSL_HPKE_CTX_new( | ||
mode: c_int, | ||
suite: OSSL_HPKE_SUITE, | ||
role: c_int, | ||
libctx: *mut OSSL_LIB_CTX, | ||
propq: *const c_char, | ||
) -> *mut OSSL_HPKE_CTX; | ||
pub fn OSSL_HPKE_CTX_free(ctx: *mut OSSL_HPKE_CTX); | ||
pub fn OSSL_HPKE_encap( | ||
ctx: *mut OSSL_HPKE_CTX, | ||
enc: *mut u8, | ||
enclen: *mut usize, | ||
pub_: *const u8, | ||
publen: usize, | ||
info: *const u8, | ||
infolen: usize, | ||
) -> c_int; | ||
pub fn OSSL_HPKE_seal( | ||
ctx: *mut OSSL_HPKE_CTX, | ||
ct: *mut u8, | ||
ctlen: *mut usize, | ||
aad: *const u8, | ||
aadlen: usize, | ||
pt: *const u8, | ||
ptlen: usize, | ||
) -> c_int; | ||
pub fn OSSL_HPKE_keygen( | ||
suite: OSSL_HPKE_SUITE, | ||
pub_: *mut u8, | ||
publen: *mut usize, | ||
priv_: *mut *mut EVP_PKEY, | ||
ikm: *const u8, | ||
ikmlen: usize, | ||
libctx: *mut OSSL_LIB_CTX, | ||
propq: *const c_char, | ||
) -> c_int; | ||
pub fn OSSL_HPKE_decap( | ||
ctx: *mut OSSL_HPKE_CTX, | ||
enc: *const u8, | ||
enclen: usize, | ||
recippriv: *mut EVP_PKEY, | ||
info: *const u8, | ||
infolen: usize, | ||
) -> c_int; | ||
pub fn OSSL_HPKE_open( | ||
ctx: *mut OSSL_HPKE_CTX, | ||
pt: *mut u8, | ||
ptlen: *mut usize, | ||
aad: *const u8, | ||
aadlen: usize, | ||
ct: *const u8, | ||
ctlen: usize, | ||
) -> c_int; | ||
pub fn OSSL_HPKE_export( | ||
ctx: *mut OSSL_HPKE_CTX, | ||
secret: *mut u8, | ||
secretlen: usize, | ||
label: *const u8, | ||
labellen: usize, | ||
) -> c_int; | ||
pub fn OSSL_HPKE_CTX_set1_authpriv(ctx: *mut OSSL_HPKE_CTX, priv_: *mut EVP_PKEY) -> c_int; | ||
pub fn OSSL_HPKE_CTX_set1_authpub( | ||
ctx: *mut OSSL_HPKE_CTX, | ||
pub_: *const u8, | ||
publen: usize, | ||
) -> c_int; | ||
pub fn OSSL_HPKE_CTX_set1_psk( | ||
ctx: *mut OSSL_HPKE_CTX, | ||
pskid: *const c_char, | ||
psk: *const u8, | ||
psklen: usize, | ||
) -> c_int; | ||
pub fn OSSL_HPKE_CTX_set1_ikme( | ||
ctx: *mut OSSL_HPKE_CTX, | ||
ikme: *const u8, | ||
ikmelen: usize, | ||
) -> c_int; | ||
pub fn OSSL_HPKE_CTX_set_seq(ctx: *mut OSSL_HPKE_CTX, seq: u64) -> c_int; | ||
pub fn OSSL_HPKE_CTX_get_seq(ctx: *mut OSSL_HPKE_CTX, seq: *mut u64) -> c_int; | ||
pub fn OSSL_HPKE_suite_check(suite: OSSL_HPKE_SUITE) -> c_int; | ||
pub fn OSSL_HPKE_get_grease_value( | ||
suite_in: *const OSSL_HPKE_SUITE, | ||
suite: *mut OSSL_HPKE_SUITE, | ||
enc: *mut u8, | ||
enclen: *mut usize, | ||
ct: *mut u8, | ||
ctlen: usize, | ||
libctx: *mut OSSL_LIB_CTX, | ||
propq: *const c_char, | ||
) -> c_int; | ||
pub fn OSSL_HPKE_str2suite(str_: *const c_char, suite: *mut OSSL_HPKE_SUITE) -> c_int; | ||
pub fn OSSL_HPKE_get_ciphertext_size(suite: OSSL_HPKE_SUITE, clearlen: usize) -> usize; | ||
pub fn OSSL_HPKE_get_public_encap_size(suite: OSSL_HPKE_SUITE) -> usize; | ||
pub fn OSSL_HPKE_get_recommended_ikmelen(suite: OSSL_HPKE_SUITE) -> usize; | ||
} |
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,58 @@ | ||
#[cfg(ossl320)] | ||
use crate::OSSL_HPKE_SUITE; | ||
use libc::c_int; | ||
|
||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_MODE_BASE: c_int = 0x00; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_MODE_PSK: c_int = 0x01; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_MODE_AUTH: c_int = 0x02; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_MODE_PSKAUTH: c_int = 0x03; | ||
|
||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_ROLE_SENDER: c_int = 0x00; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_ROLE_RECEIVER: c_int = 0x01; | ||
|
||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_KEM_ID_P256: u16 = 0x10; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_KEM_ID_P384: u16 = 0x11; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_KEM_ID_P521: u16 = 0x12; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_KEM_ID_X25519: u16 = 0x20; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_KEM_ID_X448: u16 = 0x21; | ||
|
||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_KDF_ID_HKDF_SHA256: u16 = 0x01; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_KDF_ID_HKDF_SHA384: u16 = 0x02; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_KDF_ID_HKDF_SHA512: u16 = 0x03; | ||
|
||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_AEAD_ID_AES_GCM_128: u16 = 0x01; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_AEAD_ID_AES_GCM_256: u16 = 0x02; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_AEAD_ID_CHACHA_POLY1305: u16 = 0x03; | ||
#[cfg(ossl320)] | ||
pub const OSSL_HPKE_AEAD_ID_EXPORTONLY: u16 = 0xFFFF; | ||
|
||
#[cfg(all(ossl320, not(osslconf = "OPENSSL_NO_ECX")))] | ||
pub const OSSL_HPKE_SUITE_DEFAULT: OSSL_HPKE_SUITE = OSSL_HPKE_SUITE { | ||
kem_id: OSSL_HPKE_KEM_ID_X25519, | ||
kdf_id: OSSL_HPKE_KDF_ID_HKDF_SHA256, | ||
aead_id: OSSL_HPKE_AEAD_ID_AES_GCM_128, | ||
}; | ||
|
||
#[cfg(all(ossl320, osslconf = "OPENSSL_NO_ECX"))] | ||
pub const OSSL_HPKE_SUITE_DEFAULT: OSSL_HPKE_SUITE = OSSL_HPKE_SUITE { | ||
kem_id: OSSL_HPKE_KEM_ID_P256, | ||
kdf_id: OSSL_HPKE_KDF_ID_HKDF_SHA256, | ||
aead_id: OSSL_HPKE_AEAD_ID_AES_GCM_128, | ||
}; |
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
Oops, something went wrong.