Skip to content

Commit

Permalink
Re-enable the stream module
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Nov 18, 2024
1 parent c2dad9e commit 10de5f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions aead/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mod dyn_aead;

pub use dyn_aead::DynAead;

// pub mod stream;
pub mod stream;

pub use crypto_common::{
self,
Expand Down Expand Up @@ -327,7 +327,7 @@ pub trait Aead {
/// Decrypt the given ciphertext slice, and return the resulting plaintext
/// as a vector of bytes.
///
/// See notes on [`Aead::encrypt()`] about allowable message payloads and
/// See notes on [`Aead::encrypt_to_vec()`] about allowable message payloads and
/// Associated Additional Data (AAD).
///
/// If you have no AAD, you can call this as follows:
Expand Down Expand Up @@ -508,7 +508,7 @@ impl<'msg> From<&'msg [u8]> for Payload<'msg, '_> {
///
/// This trait defines the set of methods needed to support in-place operations
/// on a `Vec`-like data type.
pub trait Buffer: AsMut<[u8]> + Sized {
pub trait Buffer: AsMut<[u8]> {
/// Resizes buffer to the requested length.
///
/// If buffer is smaller than `len`, fills it with zeros. Otherwise, truncates it to `len`.
Expand Down
12 changes: 6 additions & 6 deletions aead/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#![allow(clippy::upper_case_acronyms)]

use crate::{AeadCore, AeadInPlace, Buffer, Error, Key, KeyInit, Result};
use crate::{Aead, Buffer, Error, Key, KeyInit, Result};
use core::ops::{AddAssign, Sub};
use crypto_common::array::{Array, ArraySize};

Expand All @@ -19,12 +19,12 @@ pub type Nonce<A, S> = Array<u8, NonceSize<A, S>>;
/// Size of a nonce as used by a STREAM construction, sans the overhead of
/// the STREAM protocol itself.
pub type NonceSize<A, S> =
<<A as AeadCore>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output;
<<A as Aead>::NonceSize as Sub<<S as StreamPrimitive<A>>::NonceOverhead>>::Output;

/// Create a new STREAM from the provided AEAD.
pub trait NewStream<A>: StreamPrimitive<A>
where
A: AeadInPlace,
A: Aead,
A::NonceSize: Sub<Self::NonceOverhead>,
NonceSize<A, Self>: ArraySize,
{
Expand All @@ -49,7 +49,7 @@ where
/// Deliberately immutable and stateless to permit parallel operation.
pub trait StreamPrimitive<A>
where
A: AeadInPlace,
A: Aead,
A::NonceSize: Sub<Self::NonceOverhead>,
NonceSize<A, Self>: ArraySize,
{
Expand Down Expand Up @@ -157,7 +157,7 @@ macro_rules! impl_stream_object {
#[derive(Debug)]
pub struct $name<A, S>
where
A: AeadInPlace,
A: Aead,
S: StreamPrimitive<A>,
A::NonceSize: Sub<<S as StreamPrimitive<A>>::NonceOverhead>,
NonceSize<A, S>: ArraySize,
Expand All @@ -171,7 +171,7 @@ macro_rules! impl_stream_object {

impl<A, S> $name<A, S>
where
A: AeadInPlace,
A: Aead,
S: StreamPrimitive<A>,
A::NonceSize: Sub<<S as StreamPrimitive<A>>::NonceOverhead>,
NonceSize<A, S>: ArraySize,
Expand Down

0 comments on commit 10de5f7

Please sign in to comment.