use crate::Block;
#[cfg(all(target_arch = "aarch64", feature = "armv8"))]
use crate::armv8::hazmat as intrinsics;
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
use crate::ni::hazmat as intrinsics;
#[cfg(not(any(
target_arch = "x86_64",
target_arch = "x86",
all(target_arch = "aarch64", feature = "armv8")
)))]
compile_error!("the `hazmat` feature is currently only available on x86/x86-64 or aarch64");
cpufeatures::new!(aes_intrinsics, "aes");
pub fn cipher_round(block: &mut Block, round_key: &Block) {
if aes_intrinsics::get() {
unsafe { intrinsics::cipher_round(block, round_key) };
} else {
todo!("soft fallback for AES hazmat functions is not yet implemented");
}
}
pub fn equiv_inv_cipher_round(block: &mut Block, round_key: &Block) {
if aes_intrinsics::get() {
unsafe { intrinsics::equiv_inv_cipher_round(block, round_key) };
} else {
todo!("soft fallback for AES hazmat functions is not yet implemented");
}
}
pub fn mix_columns(block: &mut Block) {
if aes_intrinsics::get() {
unsafe { intrinsics::mix_columns(block) };
} else {
todo!("soft fallback for AES hazmat functions is not yet implemented");
}
}
pub fn inv_mix_columns(block: &mut Block) {
if aes_intrinsics::get() {
unsafe { intrinsics::inv_mix_columns(block) };
} else {
todo!("soft fallback for AES hazmat functions is not yet implemented");
}
}