Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename crypto target feature to aes #279

Merged
merged 3 commits into from Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions aes/src/armv8/decrypt.rs
Expand Up @@ -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<const N: usize>(expanded_keys: &[uint8x16_t; N], block: &mut Block) {
let rounds = N - 1;
Expand All @@ -31,7 +31,7 @@ pub(super) unsafe fn decrypt<const N: usize>(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<const N: usize>(
expanded_keys: &[uint8x16_t; N],
Expand Down
4 changes: 2 additions & 2 deletions aes/src/armv8/encrypt.rs
Expand Up @@ -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<const N: usize>(expanded_keys: &[uint8x16_t; N], block: &mut Block) {
let rounds = N - 1;
Expand All @@ -31,7 +31,7 @@ pub(super) unsafe fn encrypt<const N: usize>(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<const N: usize>(
expanded_keys: &[uint8x16_t; N],
Expand Down
12 changes: 6 additions & 6 deletions aes/src/armv8/hazmat.rs
Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion aes/src/lib.rs
Expand Up @@ -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)
Expand Down