Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
41 changes: 16 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,26 @@ members = [
[patch.crates-io]
aead-stream = { path = "aead-stream" }
aes-gcm = { path = "aes-gcm" }

# https://github.com/RustCrypto/block-modes/pull/84
belt-ctr = { git = "https://github.com/RustCrypto/block-modes" }
# https://github.com/RustCrypto/utils/pull/1208
block-buffer = { git = "https://github.com/RustCrypto/utils" }
# https://github.com/RustCrypto/stream-ciphers/pull/450
chacha20 = { git = "https://github.com/RustCrypto/stream-ciphers" }
# https://github.com/RustCrypto/traits/pull/1976
cipher = { git = "https://github.com/RustCrypto/traits" }
# https://github.com/RustCrypto/MACs/pull/206
cmac = { git = "https://github.com/RustCrypto/MACs" }
# https://github.com/RustCrypto/traits/pull/1976
crypto-common = { git = "https://github.com/RustCrypto/traits" }
# https://github.com/RustCrypto/block-modes/pull/84
ctr = { git = "https://github.com/RustCrypto/block-modes" }
# https://github.com/RustCrypto/utils/pull/1208
dbl = { git = "https://github.com/RustCrypto/utils" }
# https://github.com/RustCrypto/traits/pull/1976
digest = { git = "https://github.com/RustCrypto/traits" }
# https://github.com/RustCrypto/utils/pull/1208
inout = { git = "https://github.com/RustCrypto/utils" }
# https://github.com/RustCrypto/MACs/pull/206
pmac = { git = "https://github.com/RustCrypto/MACs" }
2 changes: 1 addition & 1 deletion aes-siv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ aes = "0.9.0-rc.0"
cipher = "0.5.0-rc.0"
cmac = "0.8.0-rc.0"
ctr = "0.10.0-rc.0"
dbl = "0.4.0-rc.1"
dbl = "0.5.0-pre"
digest = { version = "0.11.0-rc.0", features = ["mac"] }
zeroize = { version = "1", optional = true, default-features = false }

Expand Down
2 changes: 1 addition & 1 deletion ocb3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rust-version = "1.85"
aead = { version = "0.6.0-rc.1", default-features = false }
cipher = "0.5.0-rc.0"
ctr = "0.10.0-rc.0"
dbl = "0.4.0-rc.2"
dbl = "0.5.0-pre"
subtle = { version = "2", default-features = false }
aead-stream = { version = "0.6.0-rc.0", optional = true, default-features = false }
zeroize = { version = "1", optional = true, default-features = false }
Expand Down
11 changes: 6 additions & 5 deletions ocb3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub mod consts {

pub use aead::{
self, AeadCore, AeadInOut, Error, KeyInit, KeySizeUser,
array::{Array, AssocArraySize},
array::{Array, AsArrayRef, AssocArraySize},
};

use aead::{
Expand Down Expand Up @@ -249,7 +249,7 @@ where
let checksum_rhs = &mut [0u8; 16];
checksum_rhs[..remaining_bytes].copy_from_slice(tail.get_in());
checksum_rhs[remaining_bytes] = 0b1000_0000;
inplace_xor(&mut checksum_i, checksum_rhs.as_ref());
inplace_xor(&mut checksum_i, checksum_rhs.as_array_ref());
// C_* = P_* xor Pad[1..bitlen(P_*)]
let p_star = tail.get_out();
let pad = &mut pad[..p_star.len()];
Expand Down Expand Up @@ -333,7 +333,7 @@ where
let checksum_rhs = &mut [0u8; 16];
checksum_rhs[..remaining_bytes].copy_from_slice(tail.get_out());
checksum_rhs[remaining_bytes] = 0b1000_0000;
inplace_xor(&mut checksum_i, checksum_rhs.as_ref());
inplace_xor(&mut checksum_i, checksum_rhs.as_array_ref());
}

self.compute_tag(associated_data, &mut checksum_i, &offset_i)
Expand Down Expand Up @@ -588,6 +588,7 @@ pub(crate) fn split_into_two_blocks<'i, 'o>(
#[cfg(test)]
mod tests {
use super::*;
use aead::array::Array;
use dbl::Dbl;
use hex_literal::hex;

Expand All @@ -609,7 +610,7 @@ mod tests {
let expected_ll0 = Block::from(hex!("1A84ECDE1E3D6E09BD3E058A8723606D"));
let expected_ll1 = Block::from(hex!("3509D9BC3C7ADC137A7C0B150E46C0DA"));

let cipher = aes::Aes128::new(key.as_ref());
let cipher = aes::Aes128::new(&Array(key));
let (ll_star, ll_dollar, ll) = key_dependent_variables(&cipher);

assert_eq!(ll_star, expected_ll_star);
Expand All @@ -629,7 +630,7 @@ mod tests {

const TAGLEN: u32 = 16;

let cipher = aes::Aes128::new(key.as_ref());
let cipher = aes::Aes128::new(&Array(key));
let (bottom, stretch) =
nonce_dependent_variables::<aes::Aes128, U12>(&cipher, &Nonce::from(nonce), TAGLEN);
let offset_0 = initial_offset::<aes::Aes128, U12>(&cipher, &Nonce::from(nonce), TAGLEN);
Expand Down