Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eax: Introduce a streaming API #214

Merged
merged 7 commits into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
eax: Import Nonce
  • Loading branch information
Xanewok committed Sep 9, 2020
commit 1009dcaddc5814be21348d7412271cd3a0b66d57
6 changes: 3 additions & 3 deletions eax/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
#[cfg(feature = "std")]
extern crate std;

pub use aead::{self, AeadInPlace, Error, NewAead};
pub use aead::{self, AeadInPlace, Error, NewAead, Nonce};

use block_cipher::{
consts::{U0, U16},
Expand Down Expand Up @@ -147,7 +147,7 @@ where

fn encrypt_in_place_detached(
&self,
nonce: &GenericArray<u8, Self::NonceSize>,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8],
) -> Result<Tag, Error> {
Expand All @@ -167,7 +167,7 @@ where

fn decrypt_in_place_detached(
&self,
nonce: &GenericArray<u8, Self::NonceSize>,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8],
tag: &Tag,
Expand Down
7 changes: 1 addition & 6 deletions eax/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@

use crate::*;

use aead::Nonce;

use core::marker::PhantomData;
use core::mem;

Expand Down Expand Up @@ -194,10 +192,7 @@ where
{
/// Creates a stateful EAX instance that is capable of processing both
/// the associated data and the plaintext in an "on-line" fashion.
pub fn with_key_and_nonce(
key: &Key<Cipher>,
nonce: &GenericArray<u8, Cipher::BlockSize>,
) -> Self {
pub fn with_key_and_nonce(key: &Key<Cipher>, nonce: &Nonce<Cipher::BlockSize>) -> Self {
let prepend_cmac = |key, init_val, data| {
let mut cmac = Cmac::<Cipher>::new(key);
cmac.update(&[0; 15]);
Expand Down