Skip to content

Commit

Permalink
aes: use core::arch::aarch64::vst1q_u8 intrinsic on armv8 (#280)
Browse files Browse the repository at this point in the history
It previously wasn't mapped, but it is now:

https://doc.rust-lang.org/core/arch/aarch64/fn.vst1q_u8.html
  • Loading branch information
tarcieri committed Aug 26, 2021
1 parent 0353e66 commit ccbc2f8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 19 deletions.
14 changes: 7 additions & 7 deletions aes/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions aes/src/armv8.rs
Expand Up @@ -172,17 +172,9 @@ define_aes_impl!(Aes128, Aes128Enc, Aes128Dec, U16, 11, "AES-128");
define_aes_impl!(Aes192, Aes192Enc, Aes192Dec, U24, 13, "AES-192");
define_aes_impl!(Aes256, Aes256Enc, Aes256Dec, U32, 15, "AES-256");

// TODO(tarcieri): use `stdarch` intrinsic for this when it becomes available
#[inline(always)]
unsafe fn vst1q_u8(dst: *mut u8, src: uint8x16_t) {
dst.copy_from_nonoverlapping(&src as *const _ as *const u8, 16);
}

#[cfg(test)]
mod tests {
use super::{
decrypt, decrypt8, encrypt, encrypt8, expand_key, inv_expanded_keys, vst1q_u8, ParBlocks,
};
use super::{decrypt, decrypt8, encrypt, encrypt8, expand_key, inv_expanded_keys, ParBlocks};
use core::{arch::aarch64::*, convert::TryInto};
use hex_literal::hex;

Expand Down
1 change: 0 additions & 1 deletion aes/src/armv8/decrypt.rs
@@ -1,6 +1,5 @@
//! AES decryption support.

use super::vst1q_u8;
use crate::{Block, ParBlocks};
use core::arch::aarch64::*;

Expand Down
1 change: 0 additions & 1 deletion aes/src/armv8/encrypt.rs
@@ -1,6 +1,5 @@
//! AES encryption support

use super::vst1q_u8;
use crate::{Block, ParBlocks};
use core::arch::aarch64::*;

Expand Down
1 change: 0 additions & 1 deletion aes/src/armv8/hazmat.rs
Expand Up @@ -4,7 +4,6 @@
//! implementations in this crate, but instead provides raw AES-NI accelerated
//! access to the AES round function gated under the `hazmat` crate feature.

use super::vst1q_u8;
use crate::{Block, ParBlocks};
use core::arch::aarch64::*;

Expand Down

0 comments on commit ccbc2f8

Please sign in to comment.