Made ring optional
This commit is contained in:
parent
b65f9c8afd
commit
f6ab3e10af
6 changed files with 28 additions and 7 deletions
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue