diff --git a/Cargo.lock b/Cargo.lock index 7731afab..a988f515 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,29 +2,28 @@ # It is not intended for manual editing. [[package]] name = "aes" -version = "0.5.1" +version = "0.6.0-pre" dependencies = [ "aes-soft", "aesni", - "block-cipher", + "cipher", ] [[package]] name = "aes-soft" -version = "0.5.0" +version = "0.6.0-pre" dependencies = [ - "block-cipher", "byteorder", + "cipher", "opaque-debug", ] [[package]] name = "aesni" -version = "0.9.0" +version = "0.10.0-pre" dependencies = [ - "block-cipher", + "cipher", "opaque-debug", - "stream-cipher", ] [[package]] @@ -33,23 +32,13 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc52553543ecb104069b0ff9e0fcc5c739ad16202935528a112d974e8f1a4ee8" -[[package]] -name = "block-cipher" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f337a3e6da609650eb74e02bc9fac7b735049f7623ab12f2e4c719316fcc7e80" -dependencies = [ - "blobby", - "generic-array", -] - [[package]] name = "block-modes" -version = "0.6.1" +version = "0.7.0-pre" dependencies = [ "aes", - "block-cipher", "block-padding", + "cipher", "hex-literal", ] @@ -61,10 +50,10 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "blowfish" -version = "0.6.0" +version = "0.7.0-pre" dependencies = [ - "block-cipher", "byteorder", + "cipher", "opaque-debug", ] @@ -76,20 +65,30 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "cast5" -version = "0.8.0" +version = "0.9.0-pre" dependencies = [ - "block-cipher", "byteorder", + "cipher", "hex-literal", "opaque-debug", ] +[[package]] +name = "cipher" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f7954ae5588102b35257639b1c36a2e7425cc6540fcdb4de19dcb91055d659" +dependencies = [ + "blobby", + "generic-array", +] + [[package]] name = "des" -version = "0.5.0" +version = "0.6.0-pre" dependencies = [ - "block-cipher", "byteorder", + "cipher", "opaque-debug", ] @@ -105,14 +104,14 @@ dependencies = [ [[package]] name = "gost-modes" -version = "0.3.0" +version = "0.4.0-pre" dependencies = [ "block-modes", + "cipher", "generic-array", "hex-literal", "kuznyechik", "magma", - "stream-cipher", ] [[package]] @@ -136,26 +135,26 @@ dependencies = [ [[package]] name = "idea" -version = "0.2.0" +version = "0.3.0-pre" dependencies = [ - "block-cipher", + "cipher", "opaque-debug", ] [[package]] name = "kuznyechik" -version = "0.5.0" +version = "0.6.0-pre" dependencies = [ - "block-cipher", + "cipher", "hex-literal", "opaque-debug", ] [[package]] name = "magma" -version = "0.5.0" +version = "0.6.0-pre" dependencies = [ - "block-cipher", + "cipher", "hex-literal", "opaque-debug", ] @@ -174,55 +173,44 @@ checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" [[package]] name = "rc2" -version = "0.5.0" +version = "0.6.0-pre" dependencies = [ - "block-cipher", + "cipher", "opaque-debug", ] [[package]] name = "serpent" -version = "0.2.0" +version = "0.3.0-pre" dependencies = [ - "block-cipher", "byteorder", + "cipher", "opaque-debug", ] [[package]] name = "sm4" -version = "0.2.0" +version = "0.3.0-pre" dependencies = [ - "block-cipher", "byteorder", + "cipher", "hex-literal", "opaque-debug", ] -[[package]] -name = "stream-cipher" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c80e15f898d8d8f25db24c253ea615cc14acf418ff307822995814e7d42cfa89" -dependencies = [ - "blobby", - "block-cipher", - "generic-array", -] - [[package]] name = "threefish" -version = "0.2.0" +version = "0.3.0-pre" dependencies = [ - "block-cipher", + "cipher", ] [[package]] name = "twofish" -version = "0.4.0" +version = "0.3.0-pre" dependencies = [ - "block-cipher", "byteorder", + "cipher", "hex-literal", "opaque-debug", ] diff --git a/aes/Cargo.toml b/aes/Cargo.toml index 83016230..fe24abd1 100644 --- a/aes/Cargo.toml +++ b/aes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aes" -version = "0.5.1" +version = "0.6.0-pre" description = "Facade for AES (Rijndael) block ciphers implementations" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -12,13 +12,13 @@ keywords = ["crypto", "aes", "rijndael", "block-cipher"] categories = ["cryptography", "no-std"] [dependencies] -block-cipher = "0.8" +cipher = "0.2" [target.'cfg(not(all(target_feature="aes", target_feature = "sse2", any(target_arch = "x86_64", target_arch = "x86"))))'.dependencies] -aes-soft = { version = "0.5", path = "aes-soft" } +aes-soft = { version = "=0.6.0-pre", path = "aes-soft" } [target.'cfg(all(target_feature="aes", target_feature = "sse2", any(target_arch = "x86_64", target_arch = "x86")))'.dependencies] -aesni = { version = "0.9", default-features = false, path = "aesni" } +aesni = { version = "0.10.0-pre", default-features = false, path = "aesni" } [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } +cipher = { version = "0.2", features = ["dev"] } diff --git a/aes/aes-soft/Cargo.toml b/aes/aes-soft/Cargo.toml index b97aef94..f2229c18 100644 --- a/aes/aes-soft/Cargo.toml +++ b/aes/aes-soft/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aes-soft" -version = "0.5.0" +version = "0.6.0-pre" description = "AES (Rijndael) block ciphers bit-sliced implementation" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -11,9 +11,9 @@ keywords = ["crypto", "aes", "rijndael", "block-cipher"] categories = ["cryptography", "no-std"] [dependencies] -block-cipher = "0.8" +cipher = "0.2" opaque-debug = "0.3" byteorder = { version = "1", default-features = false } [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } +cipher = { version = "0.2", features = ["dev"] } diff --git a/aes/aes-soft/benches/aes128.rs b/aes/aes-soft/benches/aes128.rs index 65365698..c04b48bb 100644 --- a/aes/aes-soft/benches/aes128.rs +++ b/aes/aes-soft/benches/aes128.rs @@ -1,7 +1,7 @@ #![feature(test)] extern crate test; -use aes_soft::block_cipher::{BlockCipher, NewBlockCipher}; +use aes_soft::cipher::{BlockCipher, NewBlockCipher}; use aes_soft::Aes128; #[bench] diff --git a/aes/aes-soft/benches/aes192.rs b/aes/aes-soft/benches/aes192.rs index 081258d8..53098705 100644 --- a/aes/aes-soft/benches/aes192.rs +++ b/aes/aes-soft/benches/aes192.rs @@ -1,7 +1,7 @@ #![feature(test)] extern crate test; -use aes_soft::block_cipher::{BlockCipher, NewBlockCipher}; +use aes_soft::cipher::{BlockCipher, NewBlockCipher}; use aes_soft::Aes192; #[bench] diff --git a/aes/aes-soft/benches/aes256.rs b/aes/aes-soft/benches/aes256.rs index 75f939f5..4235c34e 100644 --- a/aes/aes-soft/benches/aes256.rs +++ b/aes/aes-soft/benches/aes256.rs @@ -1,7 +1,7 @@ #![feature(test)] extern crate test; -use aes_soft::block_cipher::{BlockCipher, NewBlockCipher}; +use aes_soft::cipher::{BlockCipher, NewBlockCipher}; use aes_soft::Aes256; #[bench] diff --git a/aes/aes-soft/src/expand.rs b/aes/aes-soft/src/expand.rs index 7f43733b..261f6e27 100644 --- a/aes/aes-soft/src/expand.rs +++ b/aes/aes-soft/src/expand.rs @@ -4,7 +4,7 @@ clippy::unreadable_literal )] -use block_cipher::generic_array::{ArrayLength, GenericArray}; +use cipher::generic_array::{ArrayLength, GenericArray}; use crate::bitslice::{bit_slice_4x1_with_u16, un_bit_slice_4x1_with_u16, AesOps}; use crate::consts::RCON; diff --git a/aes/aes-soft/src/impls.rs b/aes/aes-soft/src/impls.rs index 161a6ccb..89085f01 100644 --- a/aes/aes-soft/src/impls.rs +++ b/aes/aes-soft/src/impls.rs @@ -1,16 +1,20 @@ -pub use block_cipher::{BlockCipher, NewBlockCipher}; +pub use cipher::{BlockCipher, NewBlockCipher}; -use block_cipher::consts::{U11, U13, U15, U16, U24, U32, U8}; -use block_cipher::generic_array::GenericArray; +use cipher::{ + consts::{U11, U13, U15, U16, U24, U32, U8}, + generic_array::GenericArray, +}; -use crate::bitslice::{ - bit_slice_1x128_with_u32x4, bit_slice_1x16_with_u16, bit_slice_4x4_with_u16, - bit_slice_fill_4x4_with_u32x4, decrypt_core, encrypt_core, un_bit_slice_1x128_with_u32x4, - un_bit_slice_1x16_with_u16, Bs8State, +use crate::{ + bitslice::{ + bit_slice_1x128_with_u32x4, bit_slice_1x16_with_u16, bit_slice_4x4_with_u16, + bit_slice_fill_4x4_with_u32x4, decrypt_core, encrypt_core, un_bit_slice_1x128_with_u32x4, + un_bit_slice_1x16_with_u16, Bs8State, + }, + consts::U32X4_0, + expand::expand_key, + simd::u32x4, }; -use crate::consts::U32X4_0; -use crate::expand::expand_key; -use crate::simd::u32x4; pub type Block128 = GenericArray; pub type Block128x8 = GenericArray, U8>; diff --git a/aes/aes-soft/src/lib.rs b/aes/aes-soft/src/lib.rs index 7eafd255..8ea0aacc 100644 --- a/aes/aes-soft/src/lib.rs +++ b/aes/aes-soft/src/lib.rs @@ -7,8 +7,8 @@ //! //! # Usage example //! ``` -//! use aes_soft::block_cipher::generic_array::GenericArray; -//! use aes_soft::block_cipher::{BlockCipher, NewBlockCipher}; +//! use aes_soft::cipher::generic_array::GenericArray; +//! use aes_soft::cipher::{BlockCipher, NewBlockCipher}; //! use aes_soft::Aes128; //! //! let key = GenericArray::from_slice(&[0u8; 16]); @@ -41,7 +41,7 @@ #![deny(unsafe_code)] #![warn(missing_docs, rust_2018_idioms)] -pub use block_cipher; +pub use cipher; mod bitslice; mod consts; diff --git a/aes/aes-soft/tests/lib.rs b/aes/aes-soft/tests/lib.rs index acc1f3ba..3735a2a6 100644 --- a/aes/aes-soft/tests/lib.rs +++ b/aes/aes-soft/tests/lib.rs @@ -1,6 +1,6 @@ //! Test vectors are from NESSIE: //! https://www.cosic.esat.kuleuven.be/nessie/testvectors/ -block_cipher::new_test!(aes128_test, "aes128", aes_soft::Aes128); -block_cipher::new_test!(aes192_test, "aes192", aes_soft::Aes192); -block_cipher::new_test!(aes256_test, "aes256", aes_soft::Aes256); +cipher::new_test!(aes128_test, "aes128", aes_soft::Aes128); +cipher::new_test!(aes192_test, "aes192", aes_soft::Aes192); +cipher::new_test!(aes256_test, "aes256", aes_soft::Aes256); diff --git a/aes/aesni/Cargo.toml b/aes/aesni/Cargo.toml index a89b3aad..7b980023 100644 --- a/aes/aesni/Cargo.toml +++ b/aes/aesni/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aesni" -version = "0.9.0" +version = "0.10.0-pre" description = "AES (Rijndael) block ciphers implementation using AES-NI" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -11,17 +11,15 @@ keywords = ["crypto", "aes", "rijndael", "block-cipher"] categories = ["cryptography", "no-std"] [dependencies] -block-cipher = "0.8" +cipher = "0.2" opaque-debug = "0.3" -stream-cipher = { version = "0.7", optional = true, features = ["block-cipher"] } [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } -stream-cipher = { version = "0.7", features = ["dev"] } +cipher = { version = "0.2", features = ["dev"] } [features] default = ["ctr"] -ctr = ["stream-cipher"] +ctr = [] nocheck = [] [package.metadata.docs.rs] diff --git a/aes/aesni/benches/aes128.rs b/aes/aesni/benches/aes128.rs index d37ba923..3c921c6e 100644 --- a/aes/aesni/benches/aes128.rs +++ b/aes/aesni/benches/aes128.rs @@ -2,7 +2,7 @@ extern crate test; -use aesni::block_cipher::{BlockCipher, NewBlockCipher}; +use aesni::cipher::{BlockCipher, NewBlockCipher}; use aesni::Aes128; #[bench] diff --git a/aes/aesni/benches/aes128_ctr.rs b/aes/aesni/benches/aes128_ctr.rs index 0dc3aa44..ab8d9d18 100644 --- a/aes/aesni/benches/aes128_ctr.rs +++ b/aes/aesni/benches/aes128_ctr.rs @@ -2,4 +2,4 @@ #![feature(test)] #[cfg(feature = "ctr")] -stream_cipher::bench_sync!(aesni::Aes128Ctr); +cipher::bench_sync!(aesni::Aes128Ctr); diff --git a/aes/aesni/benches/aes192.rs b/aes/aesni/benches/aes192.rs index dcac1d92..e6ce55d1 100644 --- a/aes/aesni/benches/aes192.rs +++ b/aes/aesni/benches/aes192.rs @@ -2,7 +2,7 @@ extern crate test; -use aesni::block_cipher::{BlockCipher, NewBlockCipher}; +use aesni::cipher::{BlockCipher, NewBlockCipher}; use aesni::Aes192; #[bench] diff --git a/aes/aesni/benches/aes192_ctr.rs b/aes/aesni/benches/aes192_ctr.rs index 517e13de..002af8cb 100644 --- a/aes/aesni/benches/aes192_ctr.rs +++ b/aes/aesni/benches/aes192_ctr.rs @@ -2,4 +2,4 @@ #![feature(test)] #[cfg(feature = "ctr")] -stream_cipher::bench_sync!(aesni::Aes192Ctr); +cipher::bench_sync!(aesni::Aes192Ctr); diff --git a/aes/aesni/benches/aes256.rs b/aes/aesni/benches/aes256.rs index 570c9a93..222c7392 100644 --- a/aes/aesni/benches/aes256.rs +++ b/aes/aesni/benches/aes256.rs @@ -2,7 +2,7 @@ extern crate test; -use aesni::block_cipher::{BlockCipher, NewBlockCipher}; +use aesni::cipher::{BlockCipher, NewBlockCipher}; use aesni::Aes256; #[bench] diff --git a/aes/aesni/benches/aes256_ctr.rs b/aes/aesni/benches/aes256_ctr.rs index da7d3a96..0981bce9 100644 --- a/aes/aesni/benches/aes256_ctr.rs +++ b/aes/aesni/benches/aes256_ctr.rs @@ -2,4 +2,4 @@ #![feature(test)] #[cfg(feature = "ctr")] -stream_cipher::bench_sync!(aesni::Aes256Ctr); +cipher::bench_sync!(aesni::Aes256Ctr); diff --git a/aes/aesni/src/aes128.rs b/aes/aesni/src/aes128.rs index c227f58c..4339b564 100644 --- a/aes/aesni/src/aes128.rs +++ b/aes/aesni/src/aes128.rs @@ -1,7 +1,9 @@ use crate::arch::*; -use block_cipher::consts::{U16, U8}; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::{ + consts::{U16, U8}, + generic_array::GenericArray, + BlockCipher, NewBlockCipher, +}; use crate::utils::{Block128, Block128x8}; diff --git a/aes/aesni/src/aes192.rs b/aes/aesni/src/aes192.rs index eb4cb0f8..75826b6d 100644 --- a/aes/aesni/src/aes192.rs +++ b/aes/aesni/src/aes192.rs @@ -1,7 +1,9 @@ use crate::arch::*; -use block_cipher::consts::{U16, U24, U8}; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::{ + consts::{U16, U24, U8}, + generic_array::GenericArray, + BlockCipher, NewBlockCipher, +}; use crate::utils::{Block128, Block128x8}; diff --git a/aes/aesni/src/aes256.rs b/aes/aesni/src/aes256.rs index 193b7ca7..9448b20b 100644 --- a/aes/aesni/src/aes256.rs +++ b/aes/aesni/src/aes256.rs @@ -1,7 +1,9 @@ use crate::arch::*; -use block_cipher::consts::{U16, U32, U8}; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::{ + consts::{U16, U32, U8}, + generic_array::GenericArray, + BlockCipher, NewBlockCipher, +}; use crate::utils::{Block128, Block128x8}; diff --git a/aes/aesni/src/ctr.rs b/aes/aesni/src/ctr.rs index 9dc1bc4d..47726f08 100644 --- a/aes/aesni/src/ctr.rs +++ b/aes/aesni/src/ctr.rs @@ -4,10 +4,10 @@ use crate::arch::*; use core::mem; use super::{Aes128, Aes192, Aes256}; -use block_cipher::{consts::U16, generic_array::GenericArray, BlockCipher}; -use stream_cipher::{ +use cipher::stream::{ FromBlockCipher, LoopError, OverflowError, SeekNum, SyncStreamCipher, SyncStreamCipherSeek, }; +use cipher::{consts::U16, generic_array::GenericArray, BlockCipher}; const BLOCK_SIZE: usize = 16; const PAR_BLOCKS: usize = 8; diff --git a/aes/aesni/src/lib.rs b/aes/aesni/src/lib.rs index 95e97c00..03358efa 100644 --- a/aes/aesni/src/lib.rs +++ b/aes/aesni/src/lib.rs @@ -34,8 +34,8 @@ //! //! # Usage example //! ``` -//! use aesni::block_cipher::generic_array::GenericArray; -//! use aesni::block_cipher::{BlockCipher, NewBlockCipher}; +//! use aesni::cipher::generic_array::GenericArray; +//! use aesni::cipher::{BlockCipher, NewBlockCipher}; //! use aesni::Aes128; //! //! let key = GenericArray::from_slice(&[0u8; 16]); @@ -78,10 +78,10 @@ )] #![warn(missing_docs, rust_2018_idioms)] -pub use block_cipher; +pub use cipher; #[cfg(feature = "ctr")] -pub use stream_cipher; +pub use cipher::stream; #[cfg(not(feature = "nocheck"))] mod target_checks; diff --git a/aes/aesni/src/utils.rs b/aes/aesni/src/utils.rs index 2793ed83..4ef30bbd 100644 --- a/aes/aesni/src/utils.rs +++ b/aes/aesni/src/utils.rs @@ -3,8 +3,10 @@ use crate::arch::__m128i; #[cfg(test)] use core::mem; -use block_cipher::consts::{U16, U8}; -use block_cipher::generic_array::GenericArray; +use cipher::{ + consts::{U16, U8}, + generic_array::GenericArray, +}; pub type Block128 = GenericArray; pub type Block128x8 = GenericArray, U8>; diff --git a/aes/aesni/tests/ctr.rs b/aes/aesni/tests/ctr.rs index 13a73e3d..ac4afd11 100644 --- a/aes/aesni/tests/ctr.rs +++ b/aes/aesni/tests/ctr.rs @@ -1,10 +1,9 @@ #![cfg(feature = "ctr")] use aesni::{Aes128Ctr, Aes256Ctr}; -use stream_cipher::{new_seek_test, new_sync_test}; // Random tests generated by OpenSSL -new_sync_test!(aes128_ctr_core, Aes128Ctr, "aes128-ctr"); -new_sync_test!(aes256_ctr_core, Aes256Ctr, "aes256-ctr"); -new_seek_test!(aes128_ctr_seek, Aes128Ctr); -new_seek_test!(aes256_ctr_seek, Aes256Ctr); +cipher::new_sync_test!(aes128_ctr_core, Aes128Ctr, "aes128-ctr"); +cipher::new_sync_test!(aes256_ctr_core, Aes256Ctr, "aes256-ctr"); +cipher::new_seek_test!(aes128_ctr_seek, Aes128Ctr); +cipher::new_seek_test!(aes256_ctr_seek, Aes256Ctr); diff --git a/aes/aesni/tests/lib.rs b/aes/aesni/tests/lib.rs index f95e09c3..a694e5cd 100644 --- a/aes/aesni/tests/lib.rs +++ b/aes/aesni/tests/lib.rs @@ -1,6 +1,6 @@ //! Test vectors are from NESSIE: //! https://www.cosic.esat.kuleuven.be/nessie/testvectors/ -block_cipher::new_test!(aes128_test, "aes128", aesni::Aes128); -block_cipher::new_test!(aes192_test, "aes192", aesni::Aes192); -block_cipher::new_test!(aes256_test, "aes256", aesni::Aes256); +cipher::new_test!(aes128_test, "aes128", aesni::Aes128); +cipher::new_test!(aes192_test, "aes192", aesni::Aes192); +cipher::new_test!(aes256_test, "aes256", aesni::Aes256); diff --git a/aes/src/lib.rs b/aes/src/lib.rs index 9d9c7838..e0a55d18 100644 --- a/aes/src/lib.rs +++ b/aes/src/lib.rs @@ -13,8 +13,8 @@ //! //! # Usage example //! ``` -//! use aes::block_cipher::generic_array::GenericArray; -//! use aes::block_cipher::{BlockCipher, NewBlockCipher}; +//! use aes::cipher::generic_array::GenericArray; +//! use aes::cipher::{BlockCipher, NewBlockCipher}; //! use aes::Aes128; //! //! let key = GenericArray::from_slice(&[0u8; 16]); @@ -49,7 +49,7 @@ #![deny(unsafe_code)] #![warn(missing_docs, rust_2018_idioms)] -pub use block_cipher::{self, BlockCipher, NewBlockCipher}; +pub use cipher::{self, BlockCipher, NewBlockCipher}; #[cfg(not(all( target_feature = "aes", diff --git a/aes/tests/lib.rs b/aes/tests/lib.rs index 194791fe..77e7f99f 100644 --- a/aes/tests/lib.rs +++ b/aes/tests/lib.rs @@ -1,6 +1,6 @@ //! Test vectors are from NESSIE: //! https://www.cosic.esat.kuleuven.be/nessie/testvectors/ -block_cipher::new_test!(aes128_test, "aes128", aes::Aes128); -block_cipher::new_test!(aes192_test, "aes192", aes::Aes192); -block_cipher::new_test!(aes256_test, "aes256", aes::Aes256); +cipher::new_test!(aes128_test, "aes128", aes::Aes128); +cipher::new_test!(aes192_test, "aes192", aes::Aes192); +cipher::new_test!(aes256_test, "aes256", aes::Aes256); diff --git a/block-modes/Cargo.toml b/block-modes/Cargo.toml index a17c6a8f..4ab2f8e9 100644 --- a/block-modes/Cargo.toml +++ b/block-modes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "block-modes" -version = "0.6.1" +version = "0.7.0-pre" description = "Block cipher modes of operation" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -12,10 +12,10 @@ keywords = ["crypto", "block-cipher", "ciphers"] [dependencies] block-padding = "0.2" -block-cipher = "0.8" +cipher = "0.2" [dev-dependencies] -aes = { version = "0.5", path = "../aes" } +aes = { version = "=0.6.0-pre", path = "../aes" } hex-literal = "0.2" [features] diff --git a/block-modes/src/cbc.rs b/block-modes/src/cbc.rs index 36c6dff4..5dbaa0be 100644 --- a/block-modes/src/cbc.rs +++ b/block-modes/src/cbc.rs @@ -1,9 +1,9 @@ use crate::traits::BlockMode; use crate::utils::{get_par_blocks, xor, Block, ParBlocks}; -use block_cipher::generic_array::typenum::Unsigned; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; use block_padding::Padding; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::typenum::Unsigned; +use cipher::generic_array::GenericArray; use core::marker::PhantomData; /// [Cipher Block Chaining][1] (CBC) block cipher mode instance. diff --git a/block-modes/src/cfb.rs b/block-modes/src/cfb.rs index a3cdb7a2..76c7e7b3 100644 --- a/block-modes/src/cfb.rs +++ b/block-modes/src/cfb.rs @@ -1,9 +1,9 @@ use crate::traits::BlockMode; use crate::utils::{xor, Block, ParBlocks}; -use block_cipher::generic_array::typenum::Unsigned; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; use block_padding::Padding; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::typenum::Unsigned; +use cipher::generic_array::GenericArray; use core::marker::PhantomData; use core::ptr; diff --git a/block-modes/src/cfb8.rs b/block-modes/src/cfb8.rs index 8b6c4bbc..021f3db2 100644 --- a/block-modes/src/cfb8.rs +++ b/block-modes/src/cfb8.rs @@ -1,8 +1,8 @@ use crate::traits::BlockMode; use crate::utils::Block; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; use block_padding::Padding; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::GenericArray; use core::marker::PhantomData; /// [Cipher feedback][1] (CFB) block mode instance with a full block feedback. diff --git a/block-modes/src/ecb.rs b/block-modes/src/ecb.rs index 85c2239a..b7993234 100644 --- a/block-modes/src/ecb.rs +++ b/block-modes/src/ecb.rs @@ -1,10 +1,10 @@ use crate::errors::InvalidKeyIvLength; use crate::traits::BlockMode; use crate::utils::{get_par_blocks, Block}; -use block_cipher::generic_array::typenum::{Unsigned, U0}; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; use block_padding::Padding; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::typenum::{Unsigned, U0}; +use cipher::generic_array::GenericArray; use core::marker::PhantomData; /// [Electronic Codebook][1] (ECB) block cipher mode instance. diff --git a/block-modes/src/lib.rs b/block-modes/src/lib.rs index d798ce9e..6ef74085 100644 --- a/block-modes/src/lib.rs +++ b/block-modes/src/lib.rs @@ -94,9 +94,16 @@ mod ecb; mod ofb; mod pcbc; -pub use block_cipher; pub use block_padding; +pub use cipher; -pub use crate::errors::{BlockModeError, InvalidKeyIvLength}; -pub use crate::traits::BlockMode; -pub use crate::{cbc::Cbc, cfb::Cfb, cfb8::Cfb8, ecb::Ecb, ofb::Ofb, pcbc::Pcbc}; +pub use crate::{ + cbc::Cbc, + cfb::Cfb, + cfb8::Cfb8, + ecb::Ecb, + errors::{BlockModeError, InvalidKeyIvLength}, + ofb::Ofb, + pcbc::Pcbc, + traits::BlockMode, +}; diff --git a/block-modes/src/ofb.rs b/block-modes/src/ofb.rs index 59817ea7..bff7872c 100644 --- a/block-modes/src/ofb.rs +++ b/block-modes/src/ofb.rs @@ -1,8 +1,8 @@ use crate::traits::BlockMode; use crate::utils::{xor, Block}; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; use block_padding::Padding; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::GenericArray; use core::marker::PhantomData; /// [Output feedback][1] (OFB) block mode instance with a full block feedback. diff --git a/block-modes/src/pcbc.rs b/block-modes/src/pcbc.rs index 75dd14e4..3516fa9b 100644 --- a/block-modes/src/pcbc.rs +++ b/block-modes/src/pcbc.rs @@ -1,8 +1,8 @@ use crate::traits::BlockMode; use crate::utils::{xor, Block}; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; use block_padding::Padding; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::GenericArray; use core::marker::PhantomData; /// [Propagating Cipher Block Chaining][1] (PCBC) mode instance. diff --git a/block-modes/src/traits.rs b/block-modes/src/traits.rs index a593a40e..228f00e1 100644 --- a/block-modes/src/traits.rs +++ b/block-modes/src/traits.rs @@ -3,10 +3,10 @@ pub use alloc::vec::Vec; use crate::errors::{BlockModeError, InvalidKeyIvLength}; use crate::utils::{to_blocks, Block, Key}; -use block_cipher::generic_array::typenum::Unsigned; -use block_cipher::generic_array::{ArrayLength, GenericArray}; -use block_cipher::{BlockCipher, NewBlockCipher}; use block_padding::Padding; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::typenum::Unsigned; +use cipher::generic_array::{ArrayLength, GenericArray}; /// Trait for a block cipher mode of operation that is used to apply a block cipher /// operation to input data to transform it into a variable-length output message. diff --git a/block-modes/src/utils.rs b/block-modes/src/utils.rs index 6e35535b..812316a0 100644 --- a/block-modes/src/utils.rs +++ b/block-modes/src/utils.rs @@ -1,6 +1,6 @@ -use block_cipher::generic_array::typenum::Unsigned; -use block_cipher::generic_array::{ArrayLength, GenericArray}; -use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::typenum::Unsigned; +use cipher::generic_array::{ArrayLength, GenericArray}; use core::slice; #[inline(always)] diff --git a/blowfish/Cargo.toml b/blowfish/Cargo.toml index b7a2d319..3d829fdd 100644 --- a/blowfish/Cargo.toml +++ b/blowfish/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blowfish" -version = "0.6.0" +version = "0.7.0-pre" description = "Blowfish block cipher" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -12,12 +12,12 @@ keywords = ["crypto", "blowfish", "block-cipher"] categories = ["cryptography", "no-std"] [dependencies] -block-cipher = "0.8" +cipher = "0.2" byteorder = { version = "1", default-features = false } opaque-debug = "0.3" [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } +cipher = { version = "0.2", features = ["dev"] } [features] bcrypt = [] diff --git a/blowfish/benches/lib.rs b/blowfish/benches/lib.rs index 0f18e7af..b4912f7b 100644 --- a/blowfish/benches/lib.rs +++ b/blowfish/benches/lib.rs @@ -1,3 +1,3 @@ #![feature(test)] -block_cipher::bench!(blowfish::Blowfish, 16); +cipher::bench!(blowfish::Blowfish, 16); diff --git a/blowfish/src/lib.rs b/blowfish/src/lib.rs index ec8f4617..1b7d58d6 100644 --- a/blowfish/src/lib.rs +++ b/blowfish/src/lib.rs @@ -8,14 +8,14 @@ #![forbid(unsafe_code)] #![warn(missing_docs, rust_2018_idioms)] -pub use block_cipher; +pub use cipher; -use block_cipher::consts::{U1, U56, U8}; -use block_cipher::generic_array::GenericArray; -use block_cipher::InvalidKeyLength; -use block_cipher::{BlockCipher, NewBlockCipher}; use byteorder::ByteOrder; use byteorder::{BE, LE}; +use cipher::block::consts::{U1, U56, U8}; +use cipher::block::InvalidKeyLength; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::GenericArray; use core::marker::PhantomData; mod consts; diff --git a/blowfish/tests/lib.rs b/blowfish/tests/lib.rs index 245c20f1..a86ee912 100644 --- a/blowfish/tests/lib.rs +++ b/blowfish/tests/lib.rs @@ -1 +1 @@ -block_cipher::new_test!(blowfish_test, "blowfish", blowfish::Blowfish); +cipher::new_test!(blowfish_test, "blowfish", blowfish::Blowfish); diff --git a/cast5/Cargo.toml b/cast5/Cargo.toml index 059bdb8c..22bf27ee 100644 --- a/cast5/Cargo.toml +++ b/cast5/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cast5" -version = "0.8.0" +version = "0.9.0-pre" description = "CAST5 block cipher" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -12,12 +12,12 @@ keywords = ["crypto", "cast5", "block-cipher"] categories = ["cryptography", "no-std"] [dependencies] -block-cipher = "0.8" +cipher = "0.2" opaque-debug = "0.3" byteorder = { version = "1", default-features = false } [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } +cipher = { version = "0.2", features = ["dev"] } hex-literal = "0.2" [features] diff --git a/cast5/benches/lib.rs b/cast5/benches/lib.rs index 7683f9e4..a939f8ba 100644 --- a/cast5/benches/lib.rs +++ b/cast5/benches/lib.rs @@ -1,3 +1,3 @@ #![feature(test)] -block_cipher::bench!(cast5::Cast5, 16); +cipher::bench!(cast5::Cast5, 16); diff --git a/cast5/src/cast5.rs b/cast5/src/cast5.rs index eab811a2..525b9871 100644 --- a/cast5/src/cast5.rs +++ b/cast5/src/cast5.rs @@ -1,11 +1,15 @@ -use block_cipher::consts::{U1, U16, U8}; -use block_cipher::generic_array::GenericArray; +use cipher::{ + consts::{U1, U16, U8}, + generic_array::GenericArray, +}; -use block_cipher::{BlockCipher, InvalidKeyLength, NewBlockCipher}; use byteorder::{BigEndian, ByteOrder}; +use cipher::block::{BlockCipher, InvalidKeyLength, NewBlockCipher}; -use crate::consts::{S1, S2, S3, S4}; -use crate::schedule::key_schedule; +use crate::{ + consts::{S1, S2, S3, S4}, + schedule::key_schedule, +}; type Block = GenericArray; diff --git a/cast5/src/lib.rs b/cast5/src/lib.rs index 02cb72e8..beb78880 100644 --- a/cast5/src/lib.rs +++ b/cast5/src/lib.rs @@ -5,8 +5,8 @@ //! //! # Usage example //! ``` -//! use cast5::block_cipher::generic_array::GenericArray; -//! use cast5::block_cipher::{BlockCipher, NewBlockCipher}; +//! use cast5::cipher::generic_array::GenericArray; +//! use cast5::cipher::{BlockCipher, NewBlockCipher}; //! use cast5::Cast5; //! //! let key = GenericArray::from_slice(&[0u8; 16]); @@ -30,7 +30,7 @@ #![forbid(unsafe_code)] #![warn(missing_docs, rust_2018_idioms)] -pub use block_cipher::{self, BlockCipher}; +pub use cipher::{self, BlockCipher}; mod cast5; mod consts; diff --git a/cast5/tests/lib.rs b/cast5/tests/lib.rs index 3a709da5..993bf6f6 100644 --- a/cast5/tests/lib.rs +++ b/cast5/tests/lib.rs @@ -1,6 +1,6 @@ -use block_cipher::generic_array::GenericArray; -use block_cipher::{new_test, BlockCipher, NewBlockCipher}; use cast5::Cast5; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::GenericArray; use hex_literal::hex; /// Test vectors from RFC 2144 Appendix B.1 @@ -80,4 +80,4 @@ fn full_maintance_test() { // Test vectors from NESSIE: // https://www.cosic.esat.kuleuven.be/nessie/testvectors/bc/cast-128/Cast-128-128-64.verified.test-vectors -new_test!(cast5_nessie, "cast5", cast5::Cast5); +cipher::new_test!(cast5_nessie, "cast5", cast5::Cast5); diff --git a/des/Cargo.toml b/des/Cargo.toml index a8a1d5b6..ea2dd973 100644 --- a/des/Cargo.toml +++ b/des/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "des" -version = "0.5.0" +version = "0.6.0-pre" description = "DES and Triple DES (3DES, TDES) block ciphers implementation" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -12,9 +12,9 @@ keywords = ["crypto", "des", "tdes", "block-cipher"] categories = ["cryptography", "no-std"] [dependencies] -block-cipher = "0.8" +cipher = "0.2" byteorder = { version = "1", default-features = false } opaque-debug = "0.3" [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } +cipher = { version = "0.2", features = ["dev"] } diff --git a/des/benches/des.rs b/des/benches/des.rs index 3572ade1..5f3e21b3 100644 --- a/des/benches/des.rs +++ b/des/benches/des.rs @@ -1,3 +1,3 @@ #![feature(test)] -block_cipher::bench!(des::Des, 8); +cipher::bench!(des::Des, 8); diff --git a/des/benches/tdes.rs b/des/benches/tdes.rs index 07d3003a..6d7c3e91 100644 --- a/des/benches/tdes.rs +++ b/des/benches/tdes.rs @@ -1,3 +1,3 @@ #![feature(test)] -block_cipher::bench!(des::TdesEde3, 24); +cipher::bench!(des::TdesEde3, 24); diff --git a/des/src/des.rs b/des/src/des.rs index c38d54b4..c001b0f6 100644 --- a/des/src/des.rs +++ b/des/src/des.rs @@ -2,10 +2,12 @@ #![allow(clippy::unreadable_literal)] -use block_cipher::consts::{U1, U8}; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; use byteorder::{ByteOrder, BE}; +use cipher::{ + consts::{U1, U8}, + generic_array::GenericArray, + BlockCipher, NewBlockCipher, +}; use crate::consts::{SBOXES, SHIFTS}; diff --git a/des/src/lib.rs b/des/src/lib.rs index 43d7e50c..73f4bfd0 100644 --- a/des/src/lib.rs +++ b/des/src/lib.rs @@ -10,7 +10,7 @@ #![forbid(unsafe_code)] #![warn(missing_docs, rust_2018_idioms)] -pub use block_cipher; +pub use cipher; mod consts; mod des; diff --git a/des/src/tdes.rs b/des/src/tdes.rs index ce0d5bc7..a7070da8 100644 --- a/des/src/tdes.rs +++ b/des/src/tdes.rs @@ -1,10 +1,12 @@ //! Triple DES (3DES) block cipher. use crate::des::{gen_keys, Des}; -use block_cipher::consts::{U1, U16, U24, U8}; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; use byteorder::{ByteOrder, BE}; +use cipher::{ + consts::{U1, U16, U24, U8}, + generic_array::GenericArray, + BlockCipher, NewBlockCipher, +}; /// Triple DES (3DES) block cipher. #[derive(Copy, Clone)] diff --git a/des/tests/lib.rs b/des/tests/lib.rs index c22b6177..90db4847 100644 --- a/des/tests/lib.rs +++ b/des/tests/lib.rs @@ -1,6 +1,6 @@ //! Test vectors are from NESSIE: //! https://www.cosic.esat.kuleuven.be/nessie/testvectors/ -block_cipher::new_test!(des_test, "des", des::Des); -block_cipher::new_test!(tdes_ede3_test, "tdes", des::TdesEde3); -block_cipher::new_test!(tdes_ede2_test, "tdes2", des::TdesEde2); +cipher::new_test!(des_test, "des", des::Des); +cipher::new_test!(tdes_ede3_test, "tdes", des::TdesEde3); +cipher::new_test!(tdes_ede2_test, "tdes2", des::TdesEde2); diff --git a/gost-modes/Cargo.toml b/gost-modes/Cargo.toml index 11ff4469..358eb7aa 100644 --- a/gost-modes/Cargo.toml +++ b/gost-modes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gost-modes" -version = "0.3.0" +version = "0.4.0-pre" description = "Block cipher modes of operation" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -11,17 +11,17 @@ repository = "https://github.com/RustCrypto/block-ciphers" keywords = ["crypto", "block-cipher", "ciphers"] [dependencies] -block-modes = { version = "0.6", path = "../block-modes", default-features = false } -stream-cipher = { version = "0.7", features = ["block-cipher"], default-features = false } +block-modes = { version = "=0.7.0-pre", path = "../block-modes", default-features = false } +cipher = { version = "0.2", default-features = false } generic-array = "0.14" [dev-dependencies] -kuznyechik = { version = "0.5", path = "../kuznyechik" } -magma = { version = "0.5", path = "../magma" } -stream-cipher = { version = "0.7", features = ["block-cipher", "dev"] } +kuznyechik = { version = "0.6.0-pre", path = "../kuznyechik" } +magma = { version = "0.6.0-pre", path = "../magma" } +cipher = { version = "0.2", features = ["dev"] } hex-literal = "0.2" [features] default = ["std"] alloc = ["block-modes/alloc"] -std = ["alloc", "block-modes/std", "stream-cipher/std"] +std = ["alloc", "block-modes/std", "cipher/std"] diff --git a/gost-modes/src/cbc.rs b/gost-modes/src/cbc.rs index 725bc1bc..02b330b2 100644 --- a/gost-modes/src/cbc.rs +++ b/gost-modes/src/cbc.rs @@ -1,7 +1,7 @@ use crate::{utils::xor, GostPadding}; -use block_modes::block_cipher::{Block, BlockCipher, NewBlockCipher}; use block_modes::block_padding::Padding; use block_modes::BlockMode; +use cipher::block::{Block, BlockCipher, NewBlockCipher}; use core::marker::PhantomData; use core::ops::Mul; use generic_array::typenum::type_operators::{IsGreater, IsLessOrEqual}; diff --git a/gost-modes/src/cfb.rs b/gost-modes/src/cfb.rs index 470c0462..8da26cb7 100644 --- a/gost-modes/src/cfb.rs +++ b/gost-modes/src/cfb.rs @@ -1,10 +1,12 @@ use crate::utils::{xor_set1, xor_set2}; -use block_modes::block_cipher::{Block, BlockCipher, NewBlockCipher}; +use cipher::{ + block::{Block, BlockCipher, NewBlockCipher}, + stream::{FromBlockCipher, StreamCipher}, +}; use core::ops::Sub; use generic_array::typenum::type_operators::{IsGreater, IsGreaterOrEqual, IsLessOrEqual}; use generic_array::typenum::{Diff, Unsigned, U0, U255}; use generic_array::{ArrayLength, GenericArray}; -use stream_cipher::{FromBlockCipher, StreamCipher}; type BlockSize = ::BlockSize; diff --git a/gost-modes/src/ctr128.rs b/gost-modes/src/ctr128.rs index c83c42fa..c8e3acb7 100644 --- a/gost-modes/src/ctr128.rs +++ b/gost-modes/src/ctr128.rs @@ -1,11 +1,13 @@ use crate::utils::xor; -use block_modes::block_cipher::{Block, BlockCipher, NewBlockCipher}; +use cipher::{ + block::{Block, BlockCipher, NewBlockCipher}, + stream::{ + FromBlockCipher, LoopError, OverflowError, SeekNum, SyncStreamCipher, SyncStreamCipherSeek, + }, +}; use generic_array::typenum::type_operators::{IsGreater, IsLessOrEqual}; use generic_array::typenum::{Unsigned, U0, U16, U8}; use generic_array::{ArrayLength, GenericArray}; -use stream_cipher::{ - FromBlockCipher, LoopError, OverflowError, SeekNum, SyncStreamCipher, SyncStreamCipherSeek, -}; /// Counter (CTR) mode of operation for 128-bit block ciphers as defined in /// GOST R 34.13-2015 diff --git a/gost-modes/src/ctr64.rs b/gost-modes/src/ctr64.rs index 403ed8a5..e173f6f9 100644 --- a/gost-modes/src/ctr64.rs +++ b/gost-modes/src/ctr64.rs @@ -1,11 +1,13 @@ use crate::utils::xor; -use block_modes::block_cipher::{Block, BlockCipher, NewBlockCipher}; +use cipher::{ + block::{Block, BlockCipher, NewBlockCipher}, + stream::{ + FromBlockCipher, LoopError, OverflowError, SeekNum, SyncStreamCipher, SyncStreamCipherSeek, + }, +}; use generic_array::typenum::type_operators::{IsGreater, IsLessOrEqual}; use generic_array::typenum::{Unsigned, U0, U4, U8}; use generic_array::{ArrayLength, GenericArray}; -use stream_cipher::{ - FromBlockCipher, LoopError, OverflowError, SeekNum, SyncStreamCipher, SyncStreamCipherSeek, -}; /// Counter (CTR) mode of operation for 64-bit block ciphers as defined in /// GOST R 34.13-2015 diff --git a/gost-modes/src/lib.rs b/gost-modes/src/lib.rs index b66181a9..40f2999c 100644 --- a/gost-modes/src/lib.rs +++ b/gost-modes/src/lib.rs @@ -54,13 +54,12 @@ #![warn(missing_docs, rust_2018_idioms)] pub use block_modes; -pub use block_modes::block_cipher::consts; pub use block_modes::block_padding; +pub use cipher::{self, consts}; pub use generic_array; -pub use stream_cipher; pub use block_modes::{BlockMode, Ecb}; -pub use stream_cipher::{NewStreamCipher, StreamCipher, SyncStreamCipher, SyncStreamCipherSeek}; +pub use cipher::stream::{NewStreamCipher, StreamCipher, SyncStreamCipher, SyncStreamCipherSeek}; mod cbc; mod cfb; diff --git a/gost-modes/src/ofb.rs b/gost-modes/src/ofb.rs index 5423f60f..2f1d80b5 100644 --- a/gost-modes/src/ofb.rs +++ b/gost-modes/src/ofb.rs @@ -1,11 +1,13 @@ use crate::utils::xor; -use block_modes::block_cipher::{Block, BlockCipher, NewBlockCipher}; +use cipher::{ + block::{Block, BlockCipher, NewBlockCipher}, + stream::{FromBlockCipher, LoopError, SyncStreamCipher}, +}; use core::marker::PhantomData; use core::ops::Mul; use generic_array::typenum::type_operators::{IsGreater, IsLessOrEqual}; use generic_array::typenum::{Prod, Unsigned, U0, U1, U255}; use generic_array::{ArrayLength, GenericArray}; -use stream_cipher::{FromBlockCipher, LoopError, SyncStreamCipher}; /// Output feedback (OFB) mode of operation as defined in GOST R 34.13-2015 /// diff --git a/gost-modes/tests/lib.rs b/gost-modes/tests/lib.rs index bf61ab15..c6f3a6bb 100644 --- a/gost-modes/tests/lib.rs +++ b/gost-modes/tests/lib.rs @@ -1,14 +1,16 @@ //! Test vectors from GOST R 34.13-2015: //! https://tc26.ru/standard/gost/GOST_R_3413-2015.pdf -use gost_modes::block_padding::ZeroPadding; -use gost_modes::consts::{U14, U16, U2, U3, U32, U5}; -use gost_modes::generic_array::GenericArray; -use gost_modes::{BlockMode, NewStreamCipher, StreamCipher}; -use gost_modes::{Ecb, GostCbc, GostCfb, GostCtr128, GostCtr64, GostOfb}; + +use gost_modes::{ + block_padding::ZeroPadding, + consts::{U14, U16, U2, U3, U32, U5}, + generic_array::GenericArray, + BlockMode, Ecb, GostCbc, GostCfb, GostCtr128, GostCtr64, GostOfb, NewStreamCipher, + StreamCipher, +}; use hex_literal::hex; use kuznyechik::Kuznyechik; -use magma::{block_cipher::NewBlockCipher, Magma}; -use stream_cipher::new_seek_test; +use magma::{cipher::NewBlockCipher, Magma}; fn test_stream_cipher(cipher: impl StreamCipher + Clone, pt: &[u8], ct: &[u8]) { let mut buf = pt.to_vec(); @@ -177,5 +179,5 @@ fn magma_modes() { assert_eq!(buf, &pt[..]); } -new_seek_test!(kuznyechik_ctr_seek, GostCtr128::); -new_seek_test!(magma_ctr_seek, GostCtr64::); +cipher::new_seek_test!(kuznyechik_ctr_seek, GostCtr128::); +cipher::new_seek_test!(magma_ctr_seek, GostCtr64::); diff --git a/idea/Cargo.toml b/idea/Cargo.toml index d470aac0..89bd934b 100644 --- a/idea/Cargo.toml +++ b/idea/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "idea" -version = "0.2.0" +version = "0.3.0-pre" description = "IDEA block cipher" authors = ["RustCrypto Developers"] license = "Apache-2.0 AND MIT" @@ -12,11 +12,8 @@ keywords = ["crypto", "idea", "block-cipher"] categories = ["cryptography", "no-std"] [dependencies] -block-cipher = "0.8" +cipher = "0.2" opaque-debug = "0.3" [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } - -[badges] -maintenance = { status = "experimental" } +cipher = { version = "0.2", features = ["dev"] } diff --git a/idea/benches/lib.rs b/idea/benches/lib.rs index 5c855c31..be511822 100644 --- a/idea/benches/lib.rs +++ b/idea/benches/lib.rs @@ -1,3 +1,3 @@ #![feature(test)] -block_cipher::bench!(idea::Idea, 16); +cipher::bench!(idea::Idea, 16); diff --git a/idea/src/lib.rs b/idea/src/lib.rs index 633390e7..6e271913 100644 --- a/idea/src/lib.rs +++ b/idea/src/lib.rs @@ -11,11 +11,12 @@ #![warn(missing_docs, rust_2018_idioms)] #![allow(clippy::many_single_char_names)] -pub use block_cipher; +pub use cipher::{self, BlockCipher, NewBlockCipher}; -use block_cipher::consts::{U1, U16, U8}; -use block_cipher::generic_array::GenericArray; -pub use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::{ + consts::{U1, U16, U8}, + generic_array::GenericArray, +}; mod consts; use crate::consts::{FUYI, LENGTH_SUB_KEYS, MAXIM, ONE, ROUNDS}; diff --git a/idea/tests/lib.rs b/idea/tests/lib.rs index 00715a81..7834bf3b 100644 --- a/idea/tests/lib.rs +++ b/idea/tests/lib.rs @@ -1,4 +1,4 @@ //! Test vectors from: //! https://www.cosic.esat.kuleuven.be/nessie/testvectors/bc/idea/Idea-128-64.verified.test-vectors -block_cipher::new_test!(idea_test, "idea", idea::Idea); +cipher::new_test!(idea_test, "idea", idea::Idea); diff --git a/kuznyechik/Cargo.toml b/kuznyechik/Cargo.toml index b5d7b7b0..d9fb0aee 100644 --- a/kuznyechik/Cargo.toml +++ b/kuznyechik/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kuznyechik" -version = "0.5.0" +version = "0.6.0-pre" description = "Kuznyechik (GOST R 34.12-2015) block cipher" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -12,11 +12,11 @@ keywords = ["crypto", "kuznyechik", "gost", "block-cipher"] categories = ["cryptography", "no-std"] [dependencies] -block-cipher = "0.8" +cipher = "0.2" opaque-debug = "0.3" [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } +cipher = { version = "0.2", features = ["dev"] } hex-literal = "0.2" [features] diff --git a/kuznyechik/benches/lib.rs b/kuznyechik/benches/lib.rs index d60d3ee7..9715946d 100644 --- a/kuznyechik/benches/lib.rs +++ b/kuznyechik/benches/lib.rs @@ -1,3 +1,3 @@ #![feature(test)] -block_cipher::bench!(kuznyechik::Kuznyechik, 32); +cipher::bench!(kuznyechik::Kuznyechik, 32); diff --git a/kuznyechik/src/lib.rs b/kuznyechik/src/lib.rs index a29cb3f3..4033e9d7 100644 --- a/kuznyechik/src/lib.rs +++ b/kuznyechik/src/lib.rs @@ -10,11 +10,13 @@ #![warn(missing_docs, rust_2018_idioms)] #![allow(clippy::needless_range_loop, clippy::transmute_ptr_to_ptr)] -pub use block_cipher; +pub use cipher; -use block_cipher::consts::{U1, U16, U32}; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::{ + consts::{U1, U16, U32}, + generic_array::GenericArray, + BlockCipher, NewBlockCipher, +}; mod consts; #[macro_use] diff --git a/kuznyechik/tests/lib.rs b/kuznyechik/tests/lib.rs index 6b7f0d9b..8824785d 100644 --- a/kuznyechik/tests/lib.rs +++ b/kuznyechik/tests/lib.rs @@ -1,7 +1,7 @@ #![cfg_attr(rustfmt, rustfmt_skip)] -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::GenericArray; +use cipher::block::{BlockCipher, NewBlockCipher}; use hex_literal::hex; /// Example vectors from GOST 34.12-2018 diff --git a/magma/Cargo.toml b/magma/Cargo.toml index c70867fd..1e2aa5e0 100644 --- a/magma/Cargo.toml +++ b/magma/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "magma" -version = "0.5.0" +version = "0.6.0-pre" description = "Magma (GOST 28147-89 and GOST R 34.12-2015) block cipher" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -12,9 +12,9 @@ keywords = ["crypto", "magma", "gost", "block-cipher"] categories = ["cryptography", "no-std"] [dependencies] -block-cipher = "0.8" +cipher = "0.2" opaque-debug = "0.3" [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } +cipher = { version = "0.2", features = ["dev"] } hex-literal = "0.2" diff --git a/magma/benches/lib.rs b/magma/benches/lib.rs index 07e389d1..df0be3db 100644 --- a/magma/benches/lib.rs +++ b/magma/benches/lib.rs @@ -1,3 +1,3 @@ #![feature(test)] -block_cipher::bench!(magma::Magma, 32); +cipher::bench!(magma::Magma, 32); diff --git a/magma/src/lib.rs b/magma/src/lib.rs index 9432051b..19f9b6b5 100644 --- a/magma/src/lib.rs +++ b/magma/src/lib.rs @@ -4,7 +4,7 @@ //! # Examples //! ``` //! use magma::{Magma, BlockCipher, NewBlockCipher}; -//! use magma::block_cipher::generic_array::GenericArray; +//! use magma::cipher::generic_array::GenericArray; //! use hex_literal::hex; //! //! // Example vector from GOST 34.12-2018 @@ -34,10 +34,12 @@ #![deny(unsafe_code)] #![warn(rust_2018_idioms)] -pub use block_cipher; -use block_cipher::consts::{U1, U32, U8}; -use block_cipher::generic_array::GenericArray; -pub use block_cipher::{BlockCipher, NewBlockCipher}; +pub use cipher::{self, BlockCipher, NewBlockCipher}; + +use cipher::{ + consts::{U1, U32, U8}, + generic_array::GenericArray, +}; use core::{convert::TryInto, marker::PhantomData}; mod sboxes; diff --git a/rc2/Cargo.toml b/rc2/Cargo.toml index 1774ae16..994638b1 100644 --- a/rc2/Cargo.toml +++ b/rc2/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rc2" -version = "0.5.0" +version = "0.6.0-pre" description = "RC2 block cipher" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -12,8 +12,8 @@ keywords = ["crypto", "rc2", "block-cipher"] categories = ["cryptography", "no-std"] [dependencies] -block-cipher = "0.8" +cipher = "0.2" opaque-debug = "0.3" [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } +cipher = { version = "0.2", features = ["dev"] } diff --git a/rc2/benches/lib.rs b/rc2/benches/lib.rs index 747f287f..47900eb4 100644 --- a/rc2/benches/lib.rs +++ b/rc2/benches/lib.rs @@ -1,3 +1,3 @@ #![feature(test)] -block_cipher::bench!(rc2::Rc2, 16); +cipher::bench!(rc2::Rc2, 16); diff --git a/rc2/src/lib.rs b/rc2/src/lib.rs index b2d1fdb9..76a7c107 100644 --- a/rc2/src/lib.rs +++ b/rc2/src/lib.rs @@ -10,12 +10,13 @@ #![forbid(unsafe_code)] #![warn(rust_2018_idioms)] -pub use block_cipher; +pub use cipher; -use block_cipher::consts::{U1, U32, U8}; -use block_cipher::generic_array::GenericArray; -use block_cipher::InvalidKeyLength; -use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::{ + block::{BlockCipher, InvalidKeyLength, NewBlockCipher}, + consts::{U1, U32, U8}, + generic_array::GenericArray, +}; mod consts; use crate::consts::PI_TABLE; diff --git a/rc2/tests/lib.rs b/rc2/tests/lib.rs index dcbc51f6..f80eb7e3 100644 --- a/rc2/tests/lib.rs +++ b/rc2/tests/lib.rs @@ -1,5 +1,5 @@ -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::GenericArray; struct Test { key: &'static [u8], diff --git a/serpent/Cargo.toml b/serpent/Cargo.toml index 021dea8d..a1b8e1f1 100644 --- a/serpent/Cargo.toml +++ b/serpent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serpent" -version = "0.2.0" +version = "0.3.0-pre" description = "Serpent block cipher" authors = ["RustCrypto Developers"] license = "Apache-2.0 OR MIT" @@ -13,11 +13,8 @@ categories = ["cryptography", "no-std"] [dependencies] byteorder = { version = "1", default-features = false } -block-cipher = "0.8" +cipher = "0.2" opaque-debug = "0.3" [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } - -[badges] -maintenance = { status = "experimental" } +cipher = { version = "0.2", features = ["dev"] } diff --git a/serpent/benches/lib.rs b/serpent/benches/lib.rs index 9961ce98..cab7bc7b 100644 --- a/serpent/benches/lib.rs +++ b/serpent/benches/lib.rs @@ -1,3 +1,3 @@ #![feature(test)] -block_cipher::bench!(serpent::Serpent, 16); +cipher::bench!(serpent::Serpent, 16); diff --git a/serpent/src/lib.rs b/serpent/src/lib.rs index 5c9af0a5..4f2b3529 100644 --- a/serpent/src/lib.rs +++ b/serpent/src/lib.rs @@ -13,13 +13,14 @@ #![warn(missing_docs, rust_2018_idioms)] #![allow(clippy::needless_range_loop)] -pub use block_cipher; +pub use cipher; -use block_cipher::consts::{U1, U16}; -use block_cipher::generic_array::GenericArray; -use block_cipher::InvalidKeyLength; -use block_cipher::{BlockCipher, NewBlockCipher}; use byteorder::{ByteOrder, LE}; +use cipher::{ + block::{BlockCipher, InvalidKeyLength, NewBlockCipher}, + consts::{U1, U16}, + generic_array::GenericArray, +}; mod consts; use consts::{PHI, ROUNDS, S, S_INVERSE}; diff --git a/serpent/tests/lib.rs b/serpent/tests/lib.rs index 4e2c929a..d610a200 100644 --- a/serpent/tests/lib.rs +++ b/serpent/tests/lib.rs @@ -1,6 +1,6 @@ //! Test vectors from Nessie: //! http://www.cs.technion.ac.il/~biham/Reports/Serpent/Serpent-128-128.verified.test-vectors -block_cipher::new_test!(serpent128_test, "serpent128", serpent::Serpent); -block_cipher::new_test!(serpent192_test, "serpent192", serpent::Serpent); -block_cipher::new_test!(serpent256_test, "serpent256", serpent::Serpent); +cipher::new_test!(serpent128_test, "serpent128", serpent::Serpent); +cipher::new_test!(serpent192_test, "serpent192", serpent::Serpent); +cipher::new_test!(serpent256_test, "serpent256", serpent::Serpent); diff --git a/sm4/Cargo.toml b/sm4/Cargo.toml index 89d239e4..8a906b33 100644 --- a/sm4/Cargo.toml +++ b/sm4/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sm4" -version = "0.2.0" +version = "0.3.0-pre" authors = ["andelf "] license = "Apache-2.0 OR MIT" description = "SM4 block cipher algorithm" @@ -12,10 +12,10 @@ keywords = ["crypto", "sm4", "block-cipher"] categories = ["cryptography"] [dependencies] -block-cipher = "0.8" +cipher = "0.2" byteorder = { version = "1", default-features = false } opaque-debug = "0.3" [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } +cipher = { version = "0.2", features = ["dev"] } hex-literal = "0.2" diff --git a/sm4/benches/lib.rs b/sm4/benches/lib.rs index de480e02..ca1ae2ec 100644 --- a/sm4/benches/lib.rs +++ b/sm4/benches/lib.rs @@ -1,3 +1,3 @@ #![feature(test)] -block_cipher::bench!(sm4::Sm4, 16); +cipher::bench!(sm4::Sm4, 16); diff --git a/sm4/src/lib.rs b/sm4/src/lib.rs index c32fd860..f2bc5af0 100644 --- a/sm4/src/lib.rs +++ b/sm4/src/lib.rs @@ -11,12 +11,14 @@ #![warn(rust_2018_idioms)] #![allow(clippy::unreadable_literal)] -pub use block_cipher; +pub use cipher; -use block_cipher::consts::{U1, U16}; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; use byteorder::{ByteOrder, BE}; +use cipher::{ + consts::{U1, U16}, + generic_array::GenericArray, + BlockCipher, NewBlockCipher, +}; pub const SBOX: [u8; 256] = [ 0xd6, 0x90, 0xe9, 0xfe, 0xcc, 0xe1, 0x3d, 0xb7, 0x16, 0xb6, 0x14, 0xc2, 0x28, 0xfb, 0x2c, 0x05, diff --git a/sm4/tests/lib.rs b/sm4/tests/lib.rs index fed036f0..b0008463 100644 --- a/sm4/tests/lib.rs +++ b/sm4/tests/lib.rs @@ -1,6 +1,6 @@ //! Test vectors are from GM/T 0002-2012 -use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::block::{BlockCipher, NewBlockCipher}; use hex_literal::hex; use sm4::Sm4; diff --git a/threefish/Cargo.toml b/threefish/Cargo.toml index af130b2a..42d0c04e 100644 --- a/threefish/Cargo.toml +++ b/threefish/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "threefish" -version = "0.2.0" +version = "0.3.0-pre" authors = ["The Rust-Crypto Project Developers"] license = "MIT OR Apache-2.0" description = "Threefish block cipher" @@ -11,7 +11,7 @@ repository = "https://github.com/RustCrypto/block-ciphers" keywords = ["crypto", "threefish", "gost", "block-cipher"] [dependencies] -block-cipher = "0.8" +cipher = "0.2" [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } +cipher = { version = "0.2", features = ["dev"] } diff --git a/threefish/benches/lib.rs b/threefish/benches/lib.rs index b0d9a977..0ea9e719 100644 --- a/threefish/benches/lib.rs +++ b/threefish/benches/lib.rs @@ -2,8 +2,8 @@ extern crate test; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::GenericArray; use test::Bencher; #[bench] diff --git a/threefish/src/lib.rs b/threefish/src/lib.rs index 80f17372..241c225e 100644 --- a/threefish/src/lib.rs +++ b/threefish/src/lib.rs @@ -11,9 +11,11 @@ mod consts; use crate::consts::{C240, P_1024, P_256, P_512, R_1024, R_256, R_512}; -use block_cipher::consts::{U1, U128, U32, U64}; -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::{ + consts::{U1, U128, U32, U64}, + generic_array::GenericArray, + BlockCipher, NewBlockCipher, +}; use core::{convert::TryInto, ops::BitXor}; fn mix(r: u32, x: (u64, u64)) -> (u64, u64) { diff --git a/twofish/Cargo.toml b/twofish/Cargo.toml index 4c3039db..6bb6b10e 100644 --- a/twofish/Cargo.toml +++ b/twofish/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "twofish" -version = "0.4.0" +version = "0.3.0-pre" description = "Twofish block cipher" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -13,9 +13,9 @@ categories = ["cryptography", "no-std"] [dependencies] byteorder = { version = "1", default-features = false } -block-cipher = "0.8" +cipher = "0.2" opaque-debug = "0.3" [dev-dependencies] -block-cipher = { version = "0.8", features = ["dev"] } +cipher = { version = "0.2", features = ["dev"] } hex-literal = "0.2" diff --git a/twofish/benches/lib.rs b/twofish/benches/lib.rs index f54bb526..f648a5f1 100644 --- a/twofish/benches/lib.rs +++ b/twofish/benches/lib.rs @@ -1,3 +1,3 @@ #![feature(test)] -block_cipher::bench!(twofish::Twofish, 16); +cipher::bench!(twofish::Twofish, 16); diff --git a/twofish/src/lib.rs b/twofish/src/lib.rs index 9198da90..e6324e1c 100644 --- a/twofish/src/lib.rs +++ b/twofish/src/lib.rs @@ -9,13 +9,14 @@ #![warn(missing_docs, rust_2018_idioms)] #![allow(clippy::needless_range_loop, clippy::unreadable_literal)] -pub use block_cipher; +pub use cipher; -use block_cipher::consts::{U1, U16, U32}; -use block_cipher::generic_array::GenericArray; -use block_cipher::InvalidKeyLength; -use block_cipher::{BlockCipher, NewBlockCipher}; use byteorder::{ByteOrder, LE}; +use cipher::{ + block::{BlockCipher, InvalidKeyLength, NewBlockCipher}, + consts::{U1, U16, U32}, + generic_array::GenericArray, +}; mod consts; use crate::consts::{MDS_POLY, QBOX, QORD, RS, RS_POLY}; diff --git a/twofish/tests/lib.rs b/twofish/tests/lib.rs index e3bc132a..8e1fc1cc 100644 --- a/twofish/tests/lib.rs +++ b/twofish/tests/lib.rs @@ -1,5 +1,5 @@ -use block_cipher::generic_array::GenericArray; -use block_cipher::{BlockCipher, NewBlockCipher}; +use cipher::block::{BlockCipher, NewBlockCipher}; +use cipher::generic_array::GenericArray; use hex_literal::hex; use twofish::Twofish;