From dc528c4bc3a8b6fb339cc6ebaddff54b6997a93d Mon Sep 17 00:00:00 2001 From: Jean-Pierre De Jesus DIAZ Date: Thu, 20 Apr 2023 14:51:08 +0200 Subject: [PATCH] services/aes: use cfg(target_arch = riscv32) for vex AES Signed-off-by: Jean-Pierre De Jesus DIAZ --- services/aes/src/lib.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/services/aes/src/lib.rs b/services/aes/src/lib.rs index 3ba3297c9..a07b05ff7 100644 --- a/services/aes/src/lib.rs +++ b/services/aes/src/lib.rs @@ -26,16 +26,28 @@ pub type Block = GenericArray; pub type Block8 = GenericArray; // vex patches +#[cfg(target_arch = "riscv32")] mod vex; // Note that we can't use 'feature' flags (for precursor, renode, hosted) because the AES // library is patched into functions that are oblivious to these features. // so this library has to fall back on the legacy method of determining which build target // is being specified. -#[cfg(any(target_os = "none", target_os = "xous"))] +#[cfg(all( + target_arch = "riscv32", + any(target_os = "none", target_os = "xous"), +))] pub use vex::{Aes128, Aes256}; -#[cfg(not(any(target_os = "none", target_os = "xous")))] +#[cfg(all( + not(target_arch = "riscv32"), + not(target_os = "none"), + not(target_os = "xous"), +))] pub use soft::Aes128Soft as Aes128; -#[cfg(not(any(target_os = "none", target_os = "xous")))] +#[cfg(all( + not(target_arch = "riscv32"), + not(target_os = "none"), + not(target_os = "xous"), +))] pub use soft::Aes256Soft as Aes256; /// Size of an AES block (128-bits; 16-bytes)