mirror of
https://github.com/zerotier/zssp.git
synced 2026-05-22 16:28:40 -07:00
cargo fmt
This commit is contained in:
@@ -47,7 +47,6 @@ pub trait Aes256Dec: Sized + Send + Sync {
|
||||
fn decrypt_in_place(&self, block: &mut [u8; AES_256_BLOCK_SIZE]);
|
||||
}
|
||||
|
||||
|
||||
/// A trait for implementing AES-GCM-256 in a way that allows for extremely high throughput.
|
||||
/// One instance of this trait is created whenever a new pair of noise keys are created,
|
||||
/// and it handles all data encryption and decryption that passes through that session.
|
||||
@@ -62,12 +61,16 @@ pub trait HighThroughputAesGcmPool: Send + Sync {
|
||||
/// AES-GCM Authenticated Encryption.
|
||||
/// It should be set to whatever object, struct, handle or pointer your chosen library
|
||||
/// uses for its stream encryption API.
|
||||
type EncContext<'a> where Self: 'a;
|
||||
type EncContext<'a>
|
||||
where
|
||||
Self: 'a;
|
||||
/// This type represents the state needed to stream a single ciphertext for
|
||||
/// AES-GCM Authenticated Decryption.
|
||||
/// It should be set to whatever object, struct, handle or pointer your chosen library
|
||||
/// uses for its stream decryption API.
|
||||
type DecContext<'a> where Self: 'a;
|
||||
type DecContext<'a>
|
||||
where
|
||||
Self: 'a;
|
||||
|
||||
/// Create a new instance of this trait.
|
||||
/// `encrypt_key` must be used as the encryption key.
|
||||
@@ -90,7 +93,7 @@ pub trait HighThroughputAesGcmPool: Send + Sync {
|
||||
///
|
||||
/// Be sure to update the internal state of `enc` so the authentication tag can be correctly
|
||||
/// computed.
|
||||
fn encrypt<'a>(&'a self, enc: &mut Self::EncContext<'a> , input: &[u8], output: &mut [u8]);
|
||||
fn encrypt<'a>(&'a self, enc: &mut Self::EncContext<'a>, input: &[u8], output: &mut [u8]);
|
||||
|
||||
/// Stream-decrypt `data` using the specified encryption context `dec`.
|
||||
/// The resulting plaintext should be written back into `data`.
|
||||
|
||||
@@ -69,7 +69,6 @@ impl OpenSSLCtx {
|
||||
) > 0
|
||||
}
|
||||
|
||||
|
||||
/// Finish encryption or decryption.
|
||||
/// If performing decryption this will return whether the set tag is correct.
|
||||
pub unsafe fn finalize<const ENCRYPT: bool>(&self) -> bool {
|
||||
|
||||
@@ -490,7 +490,7 @@ pub(crate) fn received_x1_trans<C: CryptoLayer, App: ApplicationLayer<C>>(
|
||||
Err(e) => return Err(ReceiveError::StorageError(e)),
|
||||
}
|
||||
}
|
||||
if ratchet_state.is_none() && app.hello_requires_recognized_ratchet() {
|
||||
if ratchet_state.is_none() && app.hello_requires_recognized_ratchet() {
|
||||
return Err(fault!(FailedAuth, true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,7 +395,6 @@ fn main() {
|
||||
core(60 * 60, packet_success_rate)
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn test_50() {
|
||||
core(10, u32::MAX / 2)
|
||||
|
||||
Reference in New Issue
Block a user