From 5f028f0013fca947fd8e46b1813cbc0c1fbd97b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Thu, 26 Aug 2021 16:29:25 +0300 Subject: [PATCH 1/3] Rename crypto target feature to aes --- aes/src/armv8/decrypt.rs | 4 ++-- aes/src/armv8/encrypt.rs | 4 ++-- aes/src/armv8/hazmat.rs | 12 ++++++------ aes/src/lib.rs | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/aes/src/armv8/decrypt.rs b/aes/src/armv8/decrypt.rs index a78bdf70..d05c1c9d 100644 --- a/aes/src/armv8/decrypt.rs +++ b/aes/src/armv8/decrypt.rs @@ -5,7 +5,7 @@ use crate::{Block, ParBlocks}; use core::arch::aarch64::*; /// Perform AES decryption using the given expanded keys. -#[target_feature(enable = "crypto")] +#[target_feature(enable = "aes")] #[target_feature(enable = "neon")] pub(super) unsafe fn decrypt(expanded_keys: &[uint8x16_t; N], block: &mut Block) { let rounds = N - 1; @@ -31,7 +31,7 @@ pub(super) unsafe fn decrypt(expanded_keys: &[uint8x16_t; N], bl } /// Perform parallel AES decryption 8-blocks-at-a-time using the given expanded keys. -#[target_feature(enable = "crypto")] +#[target_feature(enable = "aes")] #[target_feature(enable = "neon")] pub(super) unsafe fn decrypt8( expanded_keys: &[uint8x16_t; N], diff --git a/aes/src/armv8/encrypt.rs b/aes/src/armv8/encrypt.rs index a9452989..162c63ec 100644 --- a/aes/src/armv8/encrypt.rs +++ b/aes/src/armv8/encrypt.rs @@ -5,7 +5,7 @@ use crate::{Block, ParBlocks}; use core::arch::aarch64::*; /// Perform AES encryption using the given expanded keys. -#[target_feature(enable = "crypto")] +#[target_feature(enable = "aes")] #[target_feature(enable = "neon")] pub(super) unsafe fn encrypt(expanded_keys: &[uint8x16_t; N], block: &mut Block) { let rounds = N - 1; @@ -31,7 +31,7 @@ pub(super) unsafe fn encrypt(expanded_keys: &[uint8x16_t; N], bl } /// Perform parallel AES encryption 8-blocks-at-a-time using the given expanded keys. -#[target_feature(enable = "crypto")] +#[target_feature(enable = "aes")] #[target_feature(enable = "neon")] pub(super) unsafe fn encrypt8( expanded_keys: &[uint8x16_t; N], diff --git a/aes/src/armv8/hazmat.rs b/aes/src/armv8/hazmat.rs index c08893d7..ce8b160a 100644 --- a/aes/src/armv8/hazmat.rs +++ b/aes/src/armv8/hazmat.rs @@ -10,7 +10,7 @@ use core::arch::aarch64::*; /// AES cipher (encrypt) round function. #[allow(clippy::cast_ptr_alignment)] -#[target_feature(enable = "crypto")] +#[target_feature(enable = "aes")] pub(crate) unsafe fn cipher_round(block: &mut Block, round_key: &Block) { let b = vld1q_u8(block.as_ptr()); let k = vld1q_u8(round_key.as_ptr()); @@ -29,7 +29,7 @@ pub(crate) unsafe fn cipher_round(block: &mut Block, round_key: &Block) { /// AES cipher (encrypt) round function: parallel version. #[allow(clippy::cast_ptr_alignment)] -#[target_feature(enable = "crypto")] +#[target_feature(enable = "aes")] pub(crate) unsafe fn cipher_round_par(blocks: &mut ParBlocks, round_keys: &ParBlocks) { for i in 0..8 { let mut state = vld1q_u8(blocks[i].as_ptr()); @@ -49,7 +49,7 @@ pub(crate) unsafe fn cipher_round_par(blocks: &mut ParBlocks, round_keys: &ParBl /// AES equivalent inverse cipher (decrypt) round function. #[allow(clippy::cast_ptr_alignment)] -#[target_feature(enable = "crypto")] +#[target_feature(enable = "aes")] pub(crate) unsafe fn equiv_inv_cipher_round(block: &mut Block, round_key: &Block) { let b = vld1q_u8(block.as_ptr()); let k = vld1q_u8(round_key.as_ptr()); @@ -68,7 +68,7 @@ pub(crate) unsafe fn equiv_inv_cipher_round(block: &mut Block, round_key: &Block /// AES equivalent inverse cipher (decrypt) round function: parallel version. #[allow(clippy::cast_ptr_alignment)] -#[target_feature(enable = "crypto")] +#[target_feature(enable = "aes")] pub(crate) unsafe fn equiv_inv_cipher_round_par(blocks: &mut ParBlocks, round_keys: &ParBlocks) { for i in 0..8 { let mut state = vld1q_u8(blocks[i].as_ptr()); @@ -88,7 +88,7 @@ pub(crate) unsafe fn equiv_inv_cipher_round_par(blocks: &mut ParBlocks, round_ke /// AES mix columns function. #[allow(clippy::cast_ptr_alignment)] -#[target_feature(enable = "crypto")] +#[target_feature(enable = "aes")] pub(crate) unsafe fn mix_columns(block: &mut Block) { let b = vld1q_u8(block.as_ptr()); let out = vaesmcq_u8(b); @@ -97,7 +97,7 @@ pub(crate) unsafe fn mix_columns(block: &mut Block) { /// AES inverse mix columns function. #[allow(clippy::cast_ptr_alignment)] -#[target_feature(enable = "crypto")] +#[target_feature(enable = "aes")] pub(crate) unsafe fn inv_mix_columns(block: &mut Block) { let b = vld1q_u8(block.as_ptr()); let out = vaesimcq_u8(b); diff --git a/aes/src/lib.rs b/aes/src/lib.rs index 18122be0..f33183c1 100644 --- a/aes/src/lib.rs +++ b/aes/src/lib.rs @@ -26,7 +26,7 @@ //! `armv8` crate feature. //! //! On Linux and macOS, when the `armv8` feature is enabled support for AES -//! intrinsics is autodetected at runtime. On other platforms the `crypto` +//! intrinsics is autodetected at runtime. On other platforms the `aes` //! target feature must be enabled via RUSTFLAGS. //! //! ## `x86`/`x86_64` intrinsics (AES-NI) From decc722d702236294604e1de77075c68b3e9d16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Thu, 26 Aug 2021 16:38:56 +0300 Subject: [PATCH 2/3] update changelog --- aes/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aes/CHANGELOG.md b/aes/CHANGELOG.md index 80536929..166fc35c 100644 --- a/aes/CHANGELOG.md +++ b/aes/CHANGELOG.md @@ -7,9 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed +- Use `aes` target features instead of crypto on ARMv8. ([#279]) - Bump `ctr` dependency to v0.8 ([#275]) [#275]: https://github.com/RustCrypto/block-ciphers/pull/275 +[#279]: https://github.com/RustCrypto/block-ciphers/pull/279 ## 0.7.4 (2021-06-01) ### Added From 97a59d9b017d3eebaeaf15ffe7a2be4bc9de3b15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Thu, 26 Aug 2021 16:41:17 +0300 Subject: [PATCH 3/3] tweak changelog --- aes/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aes/CHANGELOG.md b/aes/CHANGELOG.md index 166fc35c..fa8ae692 100644 --- a/aes/CHANGELOG.md +++ b/aes/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed -- Use `aes` target features instead of crypto on ARMv8. ([#279]) +- Use the `aes` target feature instead of `crypto` on ARMv8. ([#279]) - Bump `ctr` dependency to v0.8 ([#275]) [#275]: https://github.com/RustCrypto/block-ciphers/pull/275