diff --git a/Cargo.lock b/Cargo.lock index 78ab4fe..d906585 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aes" -version = "0.9.0-pre.1" +version = "0.9.0-pre.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "183b3b4639f8f7237857117abb74f3dc8648b77e67ff78d9cb6959fd7e76f387" +checksum = "e7856582c758ade85d71daf27ec6bcea6c1c73913692b07b8dffea2dc03531c9" dependencies = [ "cfg-if", "cipher", @@ -15,8 +15,9 @@ dependencies = [ [[package]] name = "belt-block" -version = "0.2.0-pre.1" -source = "git+https://github.com/RustCrypto/block-ciphers.git#ab802d8370c17e36c990c868607056e57461e740" +version = "0.2.0-pre.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6df0a14d60362d7b6041d3fe85dfd787ced16c4928f93d72152142c67d01d0bc" dependencies = [ "cipher", ] @@ -39,16 +40,16 @@ checksum = "847495c209977a90e8aad588b959d0ca9f5dc228096d29a6bd3defd53f35eaec" [[package]] name = "block-buffer" -version = "0.11.0-rc.0" +version = "0.11.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17092d478f4fadfb35a7e082f62e49f0907fdf048801d9d706277e34f9df8a78" +checksum = "8969801e57d15e15bc4d7cdc5600dc15ca06a9a62b622bd4871c2d21d8aeb42d" dependencies = [ "crypto-common", ] [[package]] name = "cbc-mac" -version = "0.2.0-pre.1" +version = "0.2.0-pre.2" dependencies = [ "aes", "cipher", @@ -65,11 +66,10 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cipher" -version = "0.5.0-pre.6" +version = "0.5.0-pre.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71c893d5a1e8257048dbb29954d2e1f85f091a150304f1defe4ca2806da5d3f" +checksum = "5b1425e6ce000f05a73096556cabcfb6a10a3ffe3bb4d75416ca8f00819c0b6a" dependencies = [ - "blobby", "crypto-common", "inout", "zeroize", @@ -77,7 +77,7 @@ dependencies = [ [[package]] name = "cmac" -version = "0.8.0-pre.1" +version = "0.8.0-pre.2" dependencies = [ "aes", "cipher", @@ -91,18 +91,18 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] [[package]] name = "crypto-common" -version = "0.2.0-rc.0" +version = "0.2.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c070b79a496dccd931229780ad5bbedd535ceff6c3565605a8e440e18e1aa2b" +checksum = "b0b8ce8218c97789f16356e7896b3714f26c2ee1079b79c0b7ae7064bb9089fa" dependencies = [ "getrandom", "hybrid-array", @@ -120,9 +120,9 @@ dependencies = [ [[package]] name = "des" -version = "0.9.0-pre.1" +version = "0.9.0-pre.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291fd90b2979cd5898c7065de0ceef1b7b9c477fe9b3389e995fa8c2cef7cc56" +checksum = "76239c731adb4b5204cfeec47bd06ec1071d9477a0d32bbb83dc7d8c599efe63" dependencies = [ "cipher", ] @@ -141,9 +141,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -188,24 +188,25 @@ dependencies = [ [[package]] name = "kuznyechik" -version = "0.9.0-pre.1" +version = "0.9.0-pre.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7984e78a88c94f87c94a1a17f8fb3bff3f466c2b8bddf341ae9616d7519c888" +checksum = "bd136ca56393426d0aeca01643adef06b1f30d667fdebf31f7cf11724cbd9051" dependencies = [ + "cfg-if", "cipher", ] [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "magma" -version = "0.10.0-pre.1" +version = "0.10.0-pre.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef645dc7cf374c71e44deb3f045f59873da9bbfaab4e062fcfd3529ee9e52318" +checksum = "b9fd466f879a2c01f141f168c4e045a26dca5a60aef79efa8bb96e9c701bb8ea" dependencies = [ "cipher", ] @@ -222,7 +223,7 @@ dependencies = [ [[package]] name = "pmac" -version = "0.8.0-pre.1" +version = "0.8.0-pre.2" dependencies = [ "aes", "cipher", @@ -272,9 +273,9 @@ dependencies = [ [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "typenum" @@ -290,6 +291,6 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/Cargo.toml b/Cargo.toml index d5bddab..eec9b9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,17 +1,6 @@ [workspace] resolver = "2" -members = [ - "belt-mac", - "cbc-mac", - "cmac", - "hmac", - "pmac", -] +members = ["belt-mac", "cbc-mac", "cmac", "hmac", "pmac"] [profile.dev] opt-level = 2 - -[patch.crates-io] -# please re-enable the minimal-versions when you remove those patches. -# https://github.com/RustCrypto/block-ciphers/pull/413 -belt-block = { git = "https://github.com/RustCrypto/block-ciphers.git" } diff --git a/belt-mac/Cargo.toml b/belt-mac/Cargo.toml index 2fd6a83..294dd67 100644 --- a/belt-mac/Cargo.toml +++ b/belt-mac/Cargo.toml @@ -13,12 +13,11 @@ keywords = ["crypto", "mac", "belt-mac"] categories = ["cryptography", "no-std"] [dependencies] -belt-block = "0.2.0-pre.1" -cipher = "=0.5.0-pre.6" +belt-block = "0.2.0-pre.2" +cipher = "=0.5.0-pre.7" digest = { version = "=0.11.0-pre.9", features = ["mac"] } [dev-dependencies] -cipher = { version = "=0.5.0-pre.6", features = ["dev"] } digest = { version = "=0.11.0-pre.9", features = ["dev"] } hex-literal = "0.4" diff --git a/belt-mac/benches/mod.rs b/belt-mac/benches/mod.rs index b7c195c..5061481 100644 --- a/belt-mac/benches/mod.rs +++ b/belt-mac/benches/mod.rs @@ -2,7 +2,7 @@ extern crate test; use belt_block::BeltBlock; -use belt_mac::{BeltMac, Mac}; +use belt_mac::{BeltMac, KeyInit}; use test::Bencher; digest::bench_update!( diff --git a/belt-mac/src/lib.rs b/belt-mac/src/lib.rs index 7d38019..18687fe 100644 --- a/belt-mac/src/lib.rs +++ b/belt-mac/src/lib.rs @@ -8,10 +8,10 @@ #![cfg_attr(docsrs, feature(doc_cfg))] #![warn(missing_docs, rust_2018_idioms)] -pub use digest::{self, Mac}; +pub use digest::{self, KeyInit, Mac}; use belt_block::BeltBlock; -use cipher::{BlockBackend, BlockCipher, BlockCipherEncrypt, BlockClosure}; +use cipher::{BlockCipherEncBackend, BlockCipherEncClosure, BlockCipherEncrypt}; use core::fmt; use digest::{ array::{ @@ -37,7 +37,7 @@ pub type BeltMac = CoreWrapper>; /// Generic core BeltMac instance, which operates over blocks. pub struct BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { cipher: C, state: Block, @@ -46,30 +46,30 @@ where impl BlockSizeUser for BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { type BlockSize = C::BlockSize; } impl OutputSizeUser for BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { type OutputSize = C::BlockSize; } impl InnerUser for BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { type Inner = C; } -impl MacMarker for BeltMacCore where C: BlockCipher + BlockCipherEncrypt + Clone {} +impl MacMarker for BeltMacCore where C: BlockCipherEncrypt + Clone {} impl InnerInit for BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { #[inline] fn inner_init(cipher: C) -> Self { @@ -82,44 +82,44 @@ where impl BufferKindUser for BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { type BufferKind = Lazy; } impl UpdateCore for BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { #[inline] fn update_blocks(&mut self, blocks: &[Block]) { - struct Ctx<'a, N: BlockSizes> { + struct Closure<'a, N: BlockSizes> { state: &'a mut Block, blocks: &'a [Block], } - impl<'a, N: BlockSizes> BlockSizeUser for Ctx<'a, N> { + impl<'a, N: BlockSizes> BlockSizeUser for Closure<'a, N> { type BlockSize = N; } - impl<'a, N: BlockSizes> BlockClosure for Ctx<'a, N> { + impl<'a, N: BlockSizes> BlockCipherEncClosure for Closure<'a, N> { #[inline(always)] - fn call>(self, backend: &mut B) { + fn call>(self, backend: &B) { for block in self.blocks { xor(self.state, block); - backend.proc_block((self.state).into()); + backend.encrypt_block((self.state).into()); } } } let Self { cipher, state, .. } = self; - cipher.encrypt_with_backend(Ctx { state, blocks }) + cipher.encrypt_with_backend(Closure { state, blocks }) } } impl Reset for BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { #[inline(always)] fn reset(&mut self) { @@ -129,7 +129,7 @@ where impl FixedOutputCore for BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, C::BlockSize: IsLess, Le: NonZero, { @@ -168,7 +168,7 @@ where impl AlgorithmName for BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone + AlgorithmName, + C: BlockCipherEncrypt + Clone + AlgorithmName, { fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str("BeltMac<")?; @@ -179,7 +179,7 @@ where impl fmt::Debug for BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone + AlgorithmName, + C: BlockCipherEncrypt + Clone + AlgorithmName, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str("BeltMacCore<")?; @@ -192,7 +192,7 @@ where #[cfg_attr(docsrs, doc(cfg(feature = "zeroize")))] impl Drop for BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { fn drop(&mut self) { self.state.zeroize(); @@ -201,10 +201,7 @@ where #[cfg(feature = "zeroize")] #[cfg_attr(docsrs, doc(cfg(feature = "zeroize")))] -impl ZeroizeOnDrop for BeltMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone + ZeroizeOnDrop -{ -} +impl ZeroizeOnDrop for BeltMacCore where C: BlockCipherEncrypt + Clone + ZeroizeOnDrop {} #[inline(always)] fn xor(buf: &mut Array, data: &Array) { diff --git a/cbc-mac/Cargo.toml b/cbc-mac/Cargo.toml index b916153..69249cd 100644 --- a/cbc-mac/Cargo.toml +++ b/cbc-mac/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cbc-mac" -version = "0.2.0-pre.1" +version = "0.2.0-pre.2" description = "Implementation of Cipher Block Chaining Message Authentication Code (CBC-MAC)" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -12,15 +12,16 @@ repository = "https://github.com/RustCrypto/MACs" keywords = ["crypto", "mac", "daa"] [dependencies] -cipher = "=0.5.0-pre.6" +cipher = "=0.5.0-pre.7" digest = { version = "=0.11.0-pre.9", features = ["mac"] } [dev-dependencies] -aes = "0.9.0-pre.1" -des = "0.9.0-pre.1" digest = { version = "=0.11.0-pre.9", features = ["dev"] } hex-literal = "0.4" +aes = "0.9.0-pre.2" +des = "0.9.0-pre.2" + [features] std = ["digest/std"] zeroize = ["cipher/zeroize"] diff --git a/cbc-mac/benches/mod.rs b/cbc-mac/benches/mod.rs index 3478920..acc55ca 100644 --- a/cbc-mac/benches/mod.rs +++ b/cbc-mac/benches/mod.rs @@ -2,7 +2,7 @@ extern crate test; use aes::Aes128; -use cbc_mac::{CbcMac, Mac}; +use cbc_mac::{CbcMac, KeyInit}; use des::Des; use test::Bencher; diff --git a/cbc-mac/src/lib.rs b/cbc-mac/src/lib.rs index 971e440..f9cd2b5 100644 --- a/cbc-mac/src/lib.rs +++ b/cbc-mac/src/lib.rs @@ -33,9 +33,9 @@ #![cfg_attr(docsrs, feature(doc_cfg))] #![warn(missing_docs, rust_2018_idioms)] -pub use digest::{self, Mac}; +pub use digest::{self, KeyInit, Mac}; -use cipher::{BlockBackend, BlockCipher, BlockCipherEncrypt, BlockClosure}; +use cipher::{BlockCipherEncBackend, BlockCipherEncClosure, BlockCipherEncrypt}; use core::fmt; use digest::{ array::{ @@ -61,7 +61,7 @@ pub type CbcMac = CoreWrapper>; #[derive(Clone)] pub struct CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { cipher: C, state: Block, @@ -69,30 +69,30 @@ where impl BlockSizeUser for CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { type BlockSize = C::BlockSize; } impl OutputSizeUser for CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { type OutputSize = C::BlockSize; } impl InnerUser for CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { type Inner = C; } -impl MacMarker for CbcMacCore where C: BlockCipher + BlockCipherEncrypt + Clone {} +impl MacMarker for CbcMacCore where C: BlockCipherEncrypt + Clone {} impl InnerInit for CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { #[inline] fn inner_init(cipher: C) -> Self { @@ -103,44 +103,44 @@ where impl BufferKindUser for CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { type BufferKind = Eager; } impl UpdateCore for CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { #[inline] fn update_blocks(&mut self, blocks: &[Block]) { - struct Ctx<'a, N: BlockSizes> { + struct Closure<'a, N: BlockSizes> { state: &'a mut Block, blocks: &'a [Block], } - impl<'a, N: BlockSizes> BlockSizeUser for Ctx<'a, N> { + impl<'a, N: BlockSizes> BlockSizeUser for Closure<'a, N> { type BlockSize = N; } - impl<'a, N: BlockSizes> BlockClosure for Ctx<'a, N> { + impl<'a, N: BlockSizes> BlockCipherEncClosure for Closure<'a, N> { #[inline(always)] - fn call>(self, backend: &mut B) { + fn call>(self, backend: &B) { for block in self.blocks { xor(self.state, block); - backend.proc_block((self.state).into()); + backend.encrypt_block((self.state).into()); } } } let Self { cipher, state } = self; - cipher.encrypt_with_backend(Ctx { state, blocks }) + cipher.encrypt_with_backend(Closure { state, blocks }) } } impl Reset for CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { #[inline(always)] fn reset(&mut self) { @@ -150,7 +150,7 @@ where impl FixedOutputCore for CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, C::BlockSize: IsLess, Le: NonZero, { @@ -168,7 +168,7 @@ where impl AlgorithmName for CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone + AlgorithmName, + C: BlockCipherEncrypt + Clone + AlgorithmName, { fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str("CbcMac<")?; @@ -179,7 +179,7 @@ where impl fmt::Debug for CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone + AlgorithmName, + C: BlockCipherEncrypt + Clone + AlgorithmName, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str("CbcMacCore<")?; @@ -192,7 +192,7 @@ where #[cfg_attr(docsrs, doc(cfg(feature = "zeroize")))] impl Drop for CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, { fn drop(&mut self) { self.state.zeroize(); @@ -201,10 +201,7 @@ where #[cfg(feature = "zeroize")] #[cfg_attr(docsrs, doc(cfg(feature = "zeroize")))] -impl ZeroizeOnDrop for CbcMacCore where - C: BlockCipher + BlockCipherEncrypt + Clone + ZeroizeOnDrop -{ -} +impl ZeroizeOnDrop for CbcMacCore where C: BlockCipherEncrypt + Clone + ZeroizeOnDrop {} #[inline(always)] fn xor(buf: &mut Array, data: &Array) { diff --git a/cmac/Cargo.toml b/cmac/Cargo.toml index 2c630af..7072bf8 100644 --- a/cmac/Cargo.toml +++ b/cmac/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cmac" -version = "0.8.0-pre.1" +version = "0.8.0-pre.2" description = "Generic implementation of Cipher-based Message Authentication Code" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -14,17 +14,18 @@ categories = ["cryptography", "no-std"] exclude = ["tests/cavp_large.rs", "tests/data/cavp_aes128_large.blb"] [dependencies] -cipher = "=0.5.0-pre.6" +cipher = "=0.5.0-pre.7" digest = { version = "=0.11.0-pre.9", features = ["mac"] } dbl = "0.4.0-rc.0" [dev-dependencies] -aes = "0.9.0-pre.1" -des = "0.9.0-pre.1" digest = { version = "=0.11.0-pre.9", features = ["dev"] } hex-literal = "0.4" -kuznyechik = "0.9.0-pre.1" -magma = "0.10.0-pre.1" + +aes = "0.9.0-pre.2" +des = "0.9.0-pre.2" +kuznyechik = "0.9.0-pre.2" +magma = "0.10.0-pre.2" [features] std = ["digest/std"] diff --git a/cmac/benches/mod.rs b/cmac/benches/mod.rs index 4f3f7eb..76b71e7 100644 --- a/cmac/benches/mod.rs +++ b/cmac/benches/mod.rs @@ -2,7 +2,7 @@ extern crate test; use aes::{Aes128, Aes256}; -use cmac::{Cmac, Mac}; +use cmac::{Cmac, KeyInit}; use kuznyechik::Kuznyechik; use test::Bencher; diff --git a/cmac/src/lib.rs b/cmac/src/lib.rs index c26316e..5b8e021 100644 --- a/cmac/src/lib.rs +++ b/cmac/src/lib.rs @@ -48,9 +48,9 @@ #![cfg_attr(docsrs, feature(doc_cfg))] #![warn(missing_docs, rust_2018_idioms)] -pub use digest::{self, Mac}; +pub use digest::{self, KeyInit, Mac}; -use cipher::{BlockBackend, BlockCipher, BlockCipherEncrypt, BlockClosure}; +use cipher::{BlockCipherEncBackend, BlockCipherEncClosure, BlockCipherEncrypt}; use core::fmt; use dbl::Dbl; use digest::{ @@ -77,7 +77,7 @@ pub type Cmac = CoreWrapper>; #[derive(Clone)] pub struct CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { cipher: C, @@ -86,7 +86,7 @@ where impl BlockSizeUser for CmacCore where - C: BlockCipher + BlockCipherEncrypt + BlockSizeUser + Clone, + C: BlockCipherEncrypt + BlockSizeUser + Clone, Block: Dbl, { type BlockSize = C::BlockSize; @@ -94,7 +94,7 @@ where impl OutputSizeUser for CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { type OutputSize = C::BlockSize; @@ -102,7 +102,7 @@ where impl InnerUser for CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { type Inner = C; @@ -110,14 +110,14 @@ where impl MacMarker for CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { } impl InnerInit for CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { #[inline] @@ -129,7 +129,7 @@ where impl BufferKindUser for CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { type BufferKind = Lazy; @@ -137,38 +137,38 @@ where impl UpdateCore for CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { #[inline] fn update_blocks(&mut self, blocks: &[Block]) { - struct Ctx<'a, N: BlockSizes> { + struct Closure<'a, N: BlockSizes> { state: &'a mut Block, blocks: &'a [Block], } - impl<'a, N: BlockSizes> BlockSizeUser for Ctx<'a, N> { + impl<'a, N: BlockSizes> BlockSizeUser for Closure<'a, N> { type BlockSize = N; } - impl<'a, N: BlockSizes> BlockClosure for Ctx<'a, N> { + impl<'a, N: BlockSizes> BlockCipherEncClosure for Closure<'a, N> { #[inline(always)] - fn call>(self, backend: &mut B) { + fn call>(self, backend: &B) { for block in self.blocks { xor(self.state, block); - backend.proc_block((self.state).into()); + backend.encrypt_block((self.state).into()); } } } let Self { cipher, state } = self; - cipher.encrypt_with_backend(Ctx { state, blocks }) + cipher.encrypt_with_backend(Closure { state, blocks }) } } impl Reset for CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { #[inline(always)] @@ -179,7 +179,7 @@ where impl FixedOutputCore for CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, C::BlockSize: IsLess, Le: NonZero, @@ -209,7 +209,7 @@ where impl AlgorithmName for CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone + AlgorithmName, + C: BlockCipherEncrypt + Clone + AlgorithmName, Block: Dbl, { fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -221,7 +221,7 @@ where impl fmt::Debug for CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone + AlgorithmName, + C: BlockCipherEncrypt + Clone + AlgorithmName, Block: Dbl, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -235,7 +235,7 @@ where #[cfg_attr(docsrs, doc(cfg(feature = "zeroize")))] impl Drop for CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { fn drop(&mut self) { @@ -247,7 +247,7 @@ where #[cfg_attr(docsrs, doc(cfg(feature = "zeroize")))] impl ZeroizeOnDrop for CmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone + ZeroizeOnDrop, + C: BlockCipherEncrypt + Clone + ZeroizeOnDrop, Block: Dbl, { } diff --git a/hmac/src/lib.rs b/hmac/src/lib.rs index 710bcd6..885c42b 100644 --- a/hmac/src/lib.rs +++ b/hmac/src/lib.rs @@ -93,8 +93,7 @@ #[cfg(feature = "std")] extern crate std; -pub use digest; -pub use digest::{KeyInit, Mac}; +pub use digest::{self, KeyInit, Mac}; use digest::{ core_api::{Block, BlockSizeUser}, diff --git a/pmac/Cargo.toml b/pmac/Cargo.toml index 0475320..c889c60 100644 --- a/pmac/Cargo.toml +++ b/pmac/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pmac" -version = "0.8.0-pre.1" +version = "0.8.0-pre.2" description = "Generic implementation of Parallelizable Message Authentication Code" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -13,12 +13,12 @@ keywords = ["crypto", "mac", "pmac"] categories = ["cryptography", "no-std"] [dependencies] -cipher = "=0.5.0-pre.6" +cipher = "=0.5.0-pre.7" digest = { version = "=0.11.0-pre.9", features = ["mac"] } dbl = "0.4.0-rc.0" [dev-dependencies] -aes = "0.9.0-pre.1" +aes = "0.9.0-pre.2" digest = { version = "=0.11.0-pre.9", features = ["dev"] } [features] diff --git a/pmac/benches/mod.rs b/pmac/benches/mod.rs index 726e57b..996a281 100644 --- a/pmac/benches/mod.rs +++ b/pmac/benches/mod.rs @@ -2,7 +2,7 @@ extern crate test; use aes::{Aes128, Aes256}; -use pmac::{Mac, Pmac}; +use pmac::{KeyInit, Pmac}; use test::Bencher; digest::bench_update!( diff --git a/pmac/src/lib.rs b/pmac/src/lib.rs index 4abd1e9..b3e7b8b 100644 --- a/pmac/src/lib.rs +++ b/pmac/src/lib.rs @@ -51,9 +51,9 @@ #[cfg(feature = "std")] extern crate std; -pub use digest::{self, Mac}; +pub use digest::{self, KeyInit, Mac}; -use cipher::{BlockBackend, BlockCipher, BlockCipherEncrypt, BlockClosure, ParBlocks}; +use cipher::{BlockCipherEncBackend, BlockCipherEncClosure, BlockCipherEncrypt, ParBlocks}; use core::fmt; use dbl::Dbl; use digest::{ @@ -88,7 +88,7 @@ pub type Pmac = CoreWrapper>; #[derive(Clone)] pub struct PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { state: PmacState, @@ -156,7 +156,7 @@ where impl BlockSizeUser for PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { type BlockSize = C::BlockSize; @@ -164,7 +164,7 @@ where impl OutputSizeUser for PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { type OutputSize = C::BlockSize; @@ -172,7 +172,7 @@ where impl InnerUser for PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { type Inner = C; @@ -180,14 +180,14 @@ where impl MacMarker for PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { } impl Reset for PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { #[inline(always)] @@ -200,7 +200,7 @@ where impl BufferKindUser for PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { type BufferKind = Lazy; @@ -208,7 +208,7 @@ where impl AlgorithmName for PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone + AlgorithmName, + C: BlockCipherEncrypt + Clone + AlgorithmName, Block: Dbl, { fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -220,7 +220,7 @@ where impl fmt::Debug for PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone + AlgorithmName, + C: BlockCipherEncrypt + Clone + AlgorithmName, Block: Dbl, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -232,7 +232,7 @@ where impl InnerInit for PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { #[inline] @@ -259,12 +259,12 @@ where impl UpdateCore for PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, { #[inline] fn update_blocks(&mut self, blocks: &[Block]) { - struct Ctx<'a, N, const LC_SIZE: usize> + struct Closure<'a, N, const LC_SIZE: usize> where N: BlockSizes, Array: Dbl, @@ -273,7 +273,7 @@ where blocks: &'a [Block], } - impl<'a, N, const LC_SIZE: usize> BlockSizeUser for Ctx<'a, N, LC_SIZE> + impl<'a, N, const LC_SIZE: usize> BlockSizeUser for Closure<'a, N, LC_SIZE> where N: BlockSizes, Array: Dbl, @@ -281,13 +281,13 @@ where type BlockSize = N; } - impl<'a, N, const LC_SIZE: usize> BlockClosure for Ctx<'a, N, LC_SIZE> + impl<'a, N, const LC_SIZE: usize> BlockCipherEncClosure for Closure<'a, N, LC_SIZE> where N: BlockSizes, Array: Dbl, { #[inline(always)] - fn call>(self, backend: &mut B) { + fn call>(self, backend: &B) { let Self { mut blocks, state } = self; if B::ParBlocksSize::USIZE > 1 { // TODO: replace with `slice::as_chunks` on stabilization @@ -300,7 +300,7 @@ where xor(block, state.next_offset()); } - backend.proc_par_blocks((&mut tmp).into()); + backend.encrypt_par_blocks((&mut tmp).into()); for t in tmp.iter() { xor(&mut state.tag, t); @@ -312,20 +312,20 @@ where for block in blocks { let mut block = block.clone(); xor(&mut block, state.next_offset()); - backend.proc_block((&mut block).into()); + backend.encrypt_block((&mut block).into()); xor(&mut state.tag, &block); } } } let Self { cipher, state } = self; - cipher.encrypt_with_backend(Ctx { blocks, state }) + cipher.encrypt_with_backend(Closure { blocks, state }) } } impl FixedOutputCore for PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone, + C: BlockCipherEncrypt + Clone, Block: Dbl, C::BlockSize: IsLess, Le: NonZero, @@ -352,7 +352,7 @@ where #[cfg(feature = "zeroize")] impl ZeroizeOnDrop for PmacCore where - C: BlockCipher + BlockCipherEncrypt + Clone + ZeroizeOnDrop, + C: BlockCipherEncrypt + Clone + ZeroizeOnDrop, Block: Dbl, C::BlockSize: IsLess, Le: NonZero,