From 7f0002cf52308ba9a80167d1ed9c1fc308785975 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Thu, 28 May 2020 16:19:19 -0700 Subject: [PATCH] aes-ctr: 2018 edition and `digest` crate upgrade Upgrades to Rust 2018 edition and the (now 2018 edition) `stream-cipher` v0.4.0-pre crate. --- .github/workflows/aes-ctr.yml | 2 +- Cargo.lock | 20 +++++--------------- Cargo.toml | 3 +++ aes-ctr/Cargo.toml | 11 ++++++----- aes-ctr/benches/aes128_ctr.rs | 2 +- aes-ctr/benches/aes192_ctr.rs | 2 +- aes-ctr/benches/aes256_ctr.rs | 2 +- aes-ctr/src/lib.rs | 27 +++++++-------------------- aes-ctr/src/{dummy.rs => soft.rs} | 0 aes-ctr/tests/mod.rs | 2 +- 10 files changed, 26 insertions(+), 45 deletions(-) rename aes-ctr/src/{dummy.rs => soft.rs} (100%) diff --git a/.github/workflows/aes-ctr.yml b/.github/workflows/aes-ctr.yml index 3923f12e..95277de6 100644 --- a/.github/workflows/aes-ctr.yml +++ b/.github/workflows/aes-ctr.yml @@ -50,7 +50,7 @@ jobs: working-directory: aes-ctr - run: cargo test --release working-directory: aes-ctr - - run: cargo test --release + - run: cargo test --release --lib env: RUSTFLAGS: "-C target-feature=+aes,+sse2,+ssse3" working-directory: aes-ctr diff --git a/Cargo.lock b/Cargo.lock index 8ffda6aa..c6bb466f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,10 +25,10 @@ dependencies = [ name = "aes-ctr" version = "0.3.0" dependencies = [ - "aes-soft 0.3.3", - "aesni 0.6.0", - "ctr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "stream-cipher 0.3.2", + "aes-soft 0.4.0-pre", + "aesni 0.7.0-pre", + "ctr", + "stream-cipher 0.4.0-pre", ] [[package]] @@ -60,7 +60,6 @@ checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" dependencies = [ "block-cipher-trait", "opaque-debug", - "stream-cipher 0.3.2", ] [[package]] @@ -70,6 +69,7 @@ source = "git+https://github.com/RustCrypto/block-ciphers#044bc4ce9c0634871790cf dependencies = [ "block-cipher", "opaque-debug", + "stream-cipher 0.4.0-pre", ] [[package]] @@ -326,16 +326,6 @@ dependencies = [ "stream-cipher 0.4.0-pre", ] -[[package]] -name = "ctr" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "022cd691704491df67d25d006fe8eca083098253c4d43516c2206479c58c6736" -dependencies = [ - "block-cipher-trait", - "stream-cipher 0.3.2", -] - [[package]] name = "either" version = "1.5.3" diff --git a/Cargo.toml b/Cargo.toml index b5750697..56ad581e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,7 @@ members = [ ] [patch.crates-io] +aesni = { git = "https://github.com/RustCrypto/block-ciphers" } +aes-soft = { git = "https://github.com/RustCrypto/block-ciphers" } block-cipher = { git = "https://github.com/RustCrypto/traits" } +stream-cipher = { git = "https://github.com/RustCrypto/traits" } diff --git a/aes-ctr/Cargo.toml b/aes-ctr/Cargo.toml index 7bf5432a..9d550e87 100644 --- a/aes-ctr/Cargo.toml +++ b/aes-ctr/Cargo.toml @@ -9,19 +9,20 @@ repository = "https://github.com/RustCrypto/stream-ciphers" keywords = ["crypto", "stream-cipher", "trait"] categories = ["cryptography", "no-std"] readme = "README.md" +edition = "2018" [dependencies] -stream-cipher = "0.3" +stream-cipher = "= 0.4.0-pre" [target.'cfg(not(all(target_feature = "aes", target_feature = "sse2", target_feature = "ssse3", any(target_arch = "x86_64", target_arch = "x86"))))'.dependencies] -ctr = "0.3" -aes-soft = "0.3" +ctr = { version = "0.3", path = "../ctr" } +aes-soft = "= 0.4.0-pre" [target.'cfg(all(target_feature = "aes", target_feature = "sse2", target_feature = "ssse3", any(target_arch = "x86_64", target_arch = "x86")))'.dependencies] -aesni = "0.6" +aesni = "= 0.7.0-pre" [dev-dependencies] -stream-cipher = { version = "0.3", features = ["dev"] } +stream-cipher = { version = "= 0.4.0-pre", features = ["dev"] } [badges] travis-ci = { repository = "RustCrypto/stream-ciphers" } diff --git a/aes-ctr/benches/aes128_ctr.rs b/aes-ctr/benches/aes128_ctr.rs index 62432d12..ddd9c718 100644 --- a/aes-ctr/benches/aes128_ctr.rs +++ b/aes-ctr/benches/aes128_ctr.rs @@ -1,6 +1,6 @@ #![feature(test)] #[macro_use] extern crate stream_cipher; -extern crate aes_ctr; +use aes_ctr; bench_sync!(aes_ctr::Aes128Ctr); diff --git a/aes-ctr/benches/aes192_ctr.rs b/aes-ctr/benches/aes192_ctr.rs index fcc0d5fe..b58b9d23 100644 --- a/aes-ctr/benches/aes192_ctr.rs +++ b/aes-ctr/benches/aes192_ctr.rs @@ -1,6 +1,6 @@ #![feature(test)] #[macro_use] extern crate stream_cipher; -extern crate aes_ctr; +use aes_ctr; bench_sync!(aes_ctr::Aes192Ctr); diff --git a/aes-ctr/benches/aes256_ctr.rs b/aes-ctr/benches/aes256_ctr.rs index 62432d12..ddd9c718 100644 --- a/aes-ctr/benches/aes256_ctr.rs +++ b/aes-ctr/benches/aes256_ctr.rs @@ -1,6 +1,6 @@ #![feature(test)] #[macro_use] extern crate stream_cipher; -extern crate aes_ctr; +use aes_ctr; bench_sync!(aes_ctr::Aes128Ctr); diff --git a/aes-ctr/src/lib.rs b/aes-ctr/src/lib.rs index ba15ebdb..d1ecfdf6 100644 --- a/aes-ctr/src/lib.rs +++ b/aes-ctr/src/lib.rs @@ -38,21 +38,16 @@ //! ``` #![no_std] #![deny(missing_docs)] + +pub use stream_cipher; + #[cfg(not(all( target_feature = "aes", target_feature = "sse2", target_feature = "ssse3", any(target_arch = "x86_64", target_arch = "x86"), )))] -extern crate aes_soft; -#[cfg(not(all( - target_feature = "aes", - target_feature = "sse2", - target_feature = "ssse3", - any(target_arch = "x86_64", target_arch = "x86"), -)))] -extern crate ctr; -pub extern crate stream_cipher; +mod soft; #[cfg(not(all( target_feature = "aes", @@ -60,15 +55,7 @@ pub extern crate stream_cipher; target_feature = "ssse3", any(target_arch = "x86_64", target_arch = "x86"), )))] -mod dummy; - -#[cfg(all( - target_feature = "aes", - target_feature = "sse2", - target_feature = "ssse3", - any(target_arch = "x86_64", target_arch = "x86"), -))] -extern crate aesni; +use soft as aes; #[cfg(all( target_feature = "aes", @@ -76,6 +63,6 @@ extern crate aesni; target_feature = "ssse3", any(target_arch = "x86_64", target_arch = "x86"), ))] -use aesni as dummy; +use aesni as aes; -pub use dummy::{Aes128Ctr, Aes192Ctr, Aes256Ctr}; +pub use crate::aes::{Aes128Ctr, Aes192Ctr, Aes256Ctr}; diff --git a/aes-ctr/src/dummy.rs b/aes-ctr/src/soft.rs similarity index 100% rename from aes-ctr/src/dummy.rs rename to aes-ctr/src/soft.rs diff --git a/aes-ctr/tests/mod.rs b/aes-ctr/tests/mod.rs index b3d47362..f2af0238 100644 --- a/aes-ctr/tests/mod.rs +++ b/aes-ctr/tests/mod.rs @@ -1,5 +1,5 @@ #![no_std] -extern crate aes_ctr; + #[macro_use] extern crate stream_cipher;