Skip to content
8 changes: 8 additions & 0 deletions aes-gcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,17 @@ pub const P_MAX: u64 = 1 << 36;
pub const C_MAX: u64 = (1 << 36) + 16;

/// AES-GCM nonces.
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Nonce<NonceSize> = GenericArray<u8, NonceSize>;

/// AES-GCM tags.
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Tag<TagSize = U16> = GenericArray<u8, TagSize>;

/// Trait implemented for valid tag sizes, i.e.
Expand Down
8 changes: 8 additions & 0 deletions aes-siv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,17 @@ use digest::{FixedOutputReset, Mac};
use pmac::Pmac;

/// AES-SIV nonces
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Nonce<NonceSize = U16> = GenericArray<u8, NonceSize>;

/// AES-SIV tags (i.e. the Synthetic Initialization Vector value)
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Tag = GenericArray<u8, U16>;

/// The `SivAead` type wraps the more powerful `Siv` interface in a more
Expand Down
12 changes: 12 additions & 0 deletions ascon-aead/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,22 @@ impl<P: Parameters> AeadInPlace for Ascon<P> {
/// Ascon-128
pub struct Ascon128(Ascon<Parameters128>);
/// Key for Ascon-128
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Ascon128Key = Key<Ascon128>;
/// Nonce for Ascon-128
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Ascon128Nonce = Nonce<Ascon128>;
/// Tag for Ascon-128
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Ascon128Tag = Tag<Ascon128>;

impl KeySizeUser for Ascon128 {
Expand Down
8 changes: 8 additions & 0 deletions ccm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,17 @@ use subtle::ConstantTimeEq;
mod private;

/// CCM nonces
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Nonce<NonceSize> = GenericArray<u8, NonceSize>;

/// CCM tags
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Tag<TagSize> = GenericArray<u8, TagSize>;

/// Trait implemented for valid tag sizes, i.e.
Expand Down
16 changes: 12 additions & 4 deletions chacha20poly1305/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,25 +161,33 @@ use chacha20::{ChaCha12, ChaCha8, XChaCha12, XChaCha8};

/// Key type (256-bits/32-bytes).
///
/// Implemented as an alias for [`GenericArray`].
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
///
/// All [`ChaChaPoly1305`] variants (including `XChaCha20Poly1305`) use this
/// key type.
pub type Key = GenericArray<u8, U32>;

/// Nonce type (96-bits/12-bytes).
///
/// Implemented as an alias for [`GenericArray`].
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Nonce = GenericArray<u8, U12>;

/// XNonce type (192-bits/24-bytes).
///
/// Implemented as an alias for [`GenericArray`].
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type XNonce = GenericArray<u8, U24>;

/// Poly1305 tag.
///
/// Implemented as an alias for [`GenericArray`].
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Tag = GenericArray<u8, U16>;

/// ChaCha20Poly1305 Authenticated Encryption with Additional Data (AEAD).
Expand Down
8 changes: 8 additions & 0 deletions deoxys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,17 @@ pub type DeoxysII128 = Deoxys<modes::DeoxysII<deoxys_bc::DeoxysBc256>, deoxys_bc
pub type DeoxysII256 = Deoxys<modes::DeoxysII<deoxys_bc::DeoxysBc384>, deoxys_bc::DeoxysBc384>;

/// Deoxys nonces
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Nonce<NonceSize> = GenericArray<u8, NonceSize>;

/// Deoxys tags
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Tag = GenericArray<u8, U16>;

/// Deoxys encryption modes.
Expand Down
8 changes: 8 additions & 0 deletions eax/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,17 @@ pub const P_MAX: u64 = 1 << 36;
pub const C_MAX: u64 = (1 << 36) + 16;

/// EAX nonces
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Nonce<NonceSize> = GenericArray<u8, NonceSize>;

/// EAX tags
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Tag<TagSize> = GenericArray<u8, TagSize>;

pub mod online;
Expand Down
13 changes: 13 additions & 0 deletions mgm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,24 @@ use sealed::Sealed;
cpufeatures::new!(mul_intrinsics, "sse2", "ssse3", "pclmulqdq");

/// MGM nonces
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Nonce<NonceSize> = GenericArray<u8, NonceSize>;

/// MGM tags
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
pub type Tag<TagSize> = GenericArray<u8, TagSize>;

/// MGM blocks
///
/// Implemented as an alias for
/// [`GenericArray`](https://docs.rs/generic-array/0.14.5/generic_array/struct.GenericArray.html).
/// Note that this crate re-exports aead which re-exports GenericArray.
type Block<C> = GenericArray<u8, <C as BlockCipher>::BlockSize>;
// cipher, nonce, aad, buffer
type EncArgs<'a, C> = (&'a C, &'a Block<C>, &'a [u8], &'a mut [u8]);
Expand Down