Made ring optional

This commit is contained in:
Hannes 2021-05-13 16:41:09 +02:00
commit f6ab3e10af
6 changed files with 28 additions and 7 deletions

View file

@ -1,5 +1,11 @@
use hmac::{Hmac, Mac, NewMac};
#[cfg(feature = "ring")]
use ring_compat::digest::Sha512;
#[cfg(feature = "default")]
use sha2::Sha512;
use core::convert::TryInto;
#[cfg(test)]

View file

@ -1,6 +1,12 @@
use x25519_dalek::SharedSecret;
use hkdf::Hkdf;
#[cfg(feature = "ring")]
use ring_compat::digest::Sha512;
#[cfg(feature = "default")]
use sha2::Sha512;
use core::convert::TryInto;
#[cfg(test)]

View file

@ -1,6 +1,5 @@
#![no_std]
#![allow(stable_features)]
#![feature(alloc)]
extern crate alloc;
@ -8,5 +7,9 @@ mod aead;
mod dh;
mod kdf_root;
mod kdf_chain;
mod header;
/// Providing essential functions
pub mod ratchet;
/// Message Header
pub mod header;

View file

@ -9,6 +9,7 @@ use crate::aead::{encrypt, decrypt};
const MAX_SKIP: usize = 100;
/// Object Representing Ratchet
pub struct Ratchet {
dhs: DhKeyPair,
dhr: Option<PublicKey>,