services/aes: use cfg(target_arch = riscv32) for vex AES

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
This commit is contained in:
Jean-Pierre De Jesus DIAZ 2023-04-20 14:51:08 +02:00
parent 834bc09867
commit dc528c4bc3
No known key found for this signature in database
GPG key ID: 6279AEC20A9524EC

View file

@ -26,16 +26,28 @@ pub type Block = GenericArray<u8, U16>;
pub type Block8 = GenericArray<Block, U8>;
// 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)