added crypto impl

This commit is contained in:
Monica Moniot
2023-08-22 11:35:01 -04:00
parent ee57af9821
commit 4e453d3b28
2 changed files with 27 additions and 1 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ cfg-if = "1.0"
libc = "0.2"
once_cell = "1.18.0"
ctor = "^0"
zssp = { git = "ssh://git@github.com/zerotier/zssp.git", branch = "main", features = ["openssl-sys"], default-features = false }
zssp = { git = "ssh://git@github.com/zerotier/zssp.git", branch = "main", features = ["openssl-sys", "pqc_kyber"], default-features = false }
rand_xoshiro = { version = "0.6.0"}
[dev-dependencies]
+26
View File
@@ -21,6 +21,7 @@ pub mod x25519;
// TODO: Bring back the faster Apple API implementations.
pub mod aes_openssl;
pub use aes_openssl as aes;
pub mod aes_gmac_siv_openssl;
@@ -29,6 +30,31 @@ pub use aes_gmac_siv_openssl as aes_gmac_siv;
/// Dependency re-export
pub use zssp;
#[macro_export]
macro_rules! impl_zssp_crypto {
($t:ty, $session_data:ty, $packet_buffer:ty) => {
impl zssp::application::CryptoLayer for $t {
type Rng = crate::random::SecureRandom;
type PrpEnc = zssp::crypto_impl::OpenSSLAes256Enc;
type PrpDec = zssp::crypto_impl::OpenSSLAes256Dec;
type Aead = zssp::crypto_impl::OpenSSLAesGcm;
type AeadPool = zssp::crypto_impl::OpenSSLAesGcmPool;
type Hash = crate::hash::SHA512;
type Hmac = crate::hash::HMACSHA512;
type PublicKey = crate::p384::P384PublicKey;
type KeyPair = crate::p384::P384KeyPair;
type Kem = zssp::crypto_impl::CrateKyber1024PrivateKey;
type SessionData = $session_data;
type IncomingPacketBuffer = $packet_buffer;
}
}
}
use ctor::ctor;
#[ctor]
fn openssl_init() {