diff --git a/Cargo.lock b/Cargo.lock index 1742c042e..ccae18764 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -127,7 +127,7 @@ dependencies = [ [[package]] name = "block-buffer" version = "0.11.0-pre" -source = "git+https://github.com/RustCrypto/utils.git#cc772039c62a0a2f4761b28df796d8b2dbda12e6" +source = "git+https://github.com/RustCrypto/utils.git?branch=bump-hybrid-array-to-v0.2.0-pre.6#e04a6dd16adb17766f4bddc8362f778942169e7a" dependencies = [ "crypto-common 0.2.0-pre", ] @@ -144,7 +144,7 @@ dependencies = [ [[package]] name = "block-padding" version = "0.4.0-pre" -source = "git+https://github.com/RustCrypto/utils.git#cc772039c62a0a2f4761b28df796d8b2dbda12e6" +source = "git+https://github.com/RustCrypto/utils.git?branch=bump-hybrid-array-to-v0.2.0-pre.6#e04a6dd16adb17766f4bddc8362f778942169e7a" dependencies = [ "hybrid-array", ] @@ -680,8 +680,9 @@ dependencies = [ [[package]] name = "hybrid-array" -version = "0.2.0-pre.5" -source = "git+https://github.com/RustCrypto/utils.git#cc772039c62a0a2f4761b28df796d8b2dbda12e6" +version = "0.2.0-pre.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f148d5add3c53ebf18452f556b0437d3d5c4540f34eb7b80c5ad4b54632c4e2" dependencies = [ "typenum", ] @@ -699,7 +700,7 @@ dependencies = [ [[package]] name = "inout" version = "0.2.0-pre" -source = "git+https://github.com/RustCrypto/utils.git#cc772039c62a0a2f4761b28df796d8b2dbda12e6" +source = "git+https://github.com/RustCrypto/utils.git?branch=bump-hybrid-array-to-v0.2.0-pre.6#e04a6dd16adb17766f4bddc8362f778942169e7a" dependencies = [ "block-padding 0.4.0-pre", "hybrid-array", diff --git a/Cargo.toml b/Cargo.toml index 56fd5a9aa..0167f6366 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,6 @@ members = [ ] [patch.crates-io] -block-buffer = { git = "https://github.com/RustCrypto/utils.git" } +block-buffer = { git = "https://github.com/RustCrypto/utils.git", branch = "bump-hybrid-array-to-v0.2.0-pre.6" } crypto-common = { path = "crypto-common" } -hybrid-array = { git = "https://github.com/RustCrypto/utils.git" } -inout = { git = "https://github.com/RustCrypto/utils.git" } +inout = { git = "https://github.com/RustCrypto/utils.git", branch = "bump-hybrid-array-to-v0.2.0-pre.6" } diff --git a/aead/src/lib.rs b/aead/src/lib.rs index 0a6f2aff1..8448e40f7 100644 --- a/aead/src/lib.rs +++ b/aead/src/lib.rs @@ -43,7 +43,7 @@ pub use heapless; pub use crypto_common::rand_core; use core::fmt; -use crypto_common::array::{typenum::Unsigned, ArraySize, ByteArray}; +use crypto_common::array::{typenum::Unsigned, Array, ArraySize}; #[cfg(feature = "alloc")] use alloc::vec::Vec; @@ -74,10 +74,10 @@ impl fmt::Display for Error { impl std::error::Error for Error {} /// Nonce: single-use value for ensuring ciphertexts are unique -pub type Nonce = ByteArray<::NonceSize>; +pub type Nonce = Array::NonceSize>; /// Tag: authentication code which ensures ciphertexts are authentic -pub type Tag = ByteArray<::TagSize>; +pub type Tag = Array::TagSize>; /// Authenticated Encryption with Associated Data (AEAD) algorithm core trait. /// diff --git a/aead/src/stream.rs b/aead/src/stream.rs index cbed91a6f..27ff31281 100644 --- a/aead/src/stream.rs +++ b/aead/src/stream.rs @@ -36,14 +36,14 @@ use crate::{AeadCore, AeadInPlace, Buffer, Error, Key, KeyInit, Result}; use core::ops::{AddAssign, Sub}; use crypto_common::array::{ typenum::{Unsigned, U4, U5}, - ArraySize, ByteArray, + Array, ArraySize, }; #[cfg(feature = "alloc")] use {crate::Payload, alloc::vec::Vec}; /// Nonce as used by a given AEAD construction and STREAM primitive. -pub type Nonce = ByteArray>; +pub type Nonce = Array>; /// Size of a nonce as used by a STREAM construction, sans the overhead of /// the STREAM protocol itself. @@ -433,7 +433,7 @@ where /// Compute the full AEAD nonce including the STREAM counter and last /// block flag. fn aead_nonce(&self, position: u32, last_block: bool) -> crate::Nonce { - let mut result = ByteArray::default(); + let mut result = Array::default(); // TODO(tarcieri): use `generic_array::sequence::Concat` (or const generics) let (prefix, tail) = result.split_at_mut(NonceSize::::to_usize()); @@ -527,7 +527,7 @@ where return Err(Error); } - let mut result = ByteArray::default(); + let mut result = Array::default(); // TODO(tarcieri): use `generic_array::sequence::Concat` (or const generics) let (prefix, tail) = result.split_at_mut(NonceSize::::to_usize()); diff --git a/crypto-common/Cargo.toml b/crypto-common/Cargo.toml index 27a3e4fe9..0e1e8fd31 100644 --- a/crypto-common/Cargo.toml +++ b/crypto-common/Cargo.toml @@ -13,7 +13,7 @@ keywords = ["crypto", "traits"] categories = ["cryptography", "no-std"] [dependencies] -hybrid-array = "=0.2.0-pre.5" +hybrid-array = "=0.2.0-pre.6" # optional dependencies rand_core = { version = "0.6.4", optional = true } diff --git a/crypto-common/src/lib.rs b/crypto-common/src/lib.rs index 6a9c9a4c6..bdaff2cdd 100644 --- a/crypto-common/src/lib.rs +++ b/crypto-common/src/lib.rs @@ -23,7 +23,7 @@ pub use hybrid_array::typenum; use core::fmt; use hybrid_array::{ typenum::{Diff, Sum, Unsigned}, - Array, ArraySize, ByteArray, + Array, ArraySize, }; #[cfg(feature = "rand_core")] @@ -36,19 +36,19 @@ pub use serializable_state::{ }; /// Block on which [`BlockSizeUser`] implementors operate. -pub type Block = ByteArray<::BlockSize>; +pub type Block = Array::BlockSize>; /// Parallel blocks on which [`ParBlocksSizeUser`] implementors operate. pub type ParBlocks = Array, ::ParBlocksSize>; /// Output array of [`OutputSizeUser`] implementors. -pub type Output = ByteArray<::OutputSize>; +pub type Output = Array::OutputSize>; /// Key used by [`KeySizeUser`] implementors. -pub type Key = ByteArray<::KeySize>; +pub type Key = Array::KeySize>; /// Initialization vector (nonce) used by [`IvSizeUser`] implementors. -pub type Iv = ByteArray<::IvSize>; +pub type Iv = Array::IvSize>; /// Alias for `AddBlockSize = Sum` pub type AddBlockSize = Sum::BlockSize>; diff --git a/crypto-common/src/serializable_state.rs b/crypto-common/src/serializable_state.rs index fa72d13c8..735f485e2 100644 --- a/crypto-common/src/serializable_state.rs +++ b/crypto-common/src/serializable_state.rs @@ -1,12 +1,12 @@ use crate::array::{ self, typenum::{Diff, Prod, Sum, Unsigned, U1, U16, U2, U4, U8}, - ArraySize, ByteArray, + Array, ArraySize, }; use core::{convert::TryInto, default::Default, fmt}; /// Serialized internal state. -pub type SerializedState = ByteArray<::SerializedStateSize>; +pub type SerializedState = Array::SerializedStateSize>; /// Alias for `AddSerializedStateSize = Sum` pub type AddSerializedStateSize = Sum::SerializedStateSize>; diff --git a/digest/src/core_api/ct_variable.rs b/digest/src/core_api/ct_variable.rs index 080081a14..b863fd747 100644 --- a/digest/src/core_api/ct_variable.rs +++ b/digest/src/core_api/ct_variable.rs @@ -13,7 +13,7 @@ use core::{ ops::{Add, Sub}, }; use crypto_common::{ - array::{Array, ArraySize, ByteArray}, + array::{Array, ArraySize}, typenum::{IsLess, IsLessOrEqual, Le, LeEq, NonZero, Sum, U1, U256}, Block, BlockSizeUser, DeserializeStateError, OutputSizeUser, SerializableState, SerializedState, SubSerializedStateSize, @@ -212,7 +212,7 @@ where fn serialize(&self) -> SerializedState { let serialized_inner = self.inner.serialize(); - let serialized_outsize = ByteArray::::clone_from_slice(&[OutSize::U8]); + let serialized_outsize = Array::::clone_from_slice(&[OutSize::U8]); serialized_inner.concat(serialized_outsize) } diff --git a/digest/src/core_api/rt_variable.rs b/digest/src/core_api/rt_variable.rs index 491b91fac..0fe3e15a5 100644 --- a/digest/src/core_api/rt_variable.rs +++ b/digest/src/core_api/rt_variable.rs @@ -11,7 +11,7 @@ use core::{ }; use crypto_common::SubSerializedStateSize; use crypto_common::{ - array::{ArraySize, ByteArray}, + array::{Array, ArraySize}, typenum::{Diff, IsLess, Le, NonZero, Sum, Unsigned, U1, U256}, AddBlockSize, DeserializeStateError, SerializableState, SerializedState, SubBlockSize, }; @@ -161,10 +161,10 @@ where fn serialize(&self) -> SerializedState { let serialized_core = self.core.serialize(); let serialized_pos = - ByteArray::::clone_from_slice(&[self.buffer.get_pos().try_into().unwrap()]); + Array::::clone_from_slice(&[self.buffer.get_pos().try_into().unwrap()]); let serialized_data = self.buffer.clone().pad_with_zeros(); let serialized_output_size = - ByteArray::::clone_from_slice(&[self.output_size.try_into().unwrap()]); + Array::::clone_from_slice(&[self.output_size.try_into().unwrap()]); serialized_core .concat(serialized_pos) diff --git a/digest/src/core_api/wrapper.rs b/digest/src/core_api/wrapper.rs index 5765285f0..38d348a34 100644 --- a/digest/src/core_api/wrapper.rs +++ b/digest/src/core_api/wrapper.rs @@ -12,7 +12,7 @@ use core::{ ops::{Add, Sub}, }; use crypto_common::{ - array::{ArraySize, ByteArray}, + array::{Array, ArraySize}, typenum::{Diff, IsLess, Le, NonZero, Sum, U1, U256}, BlockSizeUser, DeserializeStateError, InvalidLength, Key, KeyInit, KeySizeUser, Output, SerializableState, SerializedState, SubSerializedStateSize, @@ -219,7 +219,7 @@ where fn serialize(&self) -> SerializedState { let serialized_core = self.core.serialize(); let serialized_pos = - ByteArray::::clone_from_slice(&[self.buffer.get_pos().try_into().unwrap()]); + Array::::clone_from_slice(&[self.buffer.get_pos().try_into().unwrap()]); let serialized_data = self.buffer.clone().pad_with_zeros(); serialized_core