From 4d850bffbc6022a3450fe4e1ccd5787752cd8067 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 5 Jan 2024 16:17:59 +0800 Subject: [PATCH] modulate the sha512 target based on the host configuration xous targets use the Precursor hardware engine for hashing all others use a software-only implementation. Not the most performant but the code is vendored in directly from the rustcrypto crate. --- services/engine-sha512/src/api.rs | 3 ++- services/engine-sha512/src/lib.rs | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/services/engine-sha512/src/api.rs b/services/engine-sha512/src/api.rs index cb523ab79..cd7c02f96 100644 --- a/services/engine-sha512/src/api.rs +++ b/services/engine-sha512/src/api.rs @@ -1,4 +1,5 @@ -pub(crate) const SERVER_NAME_SHA512: &str = "_Sha512 hardware accelerator server_"; +#[allow(dead_code)] +pub(crate) const SERVER_NAME_SHA512: &str = "_Sha512 hardware accelerator server_"; // not used in hosted config mod rkyv_enum; pub use rkyv_enum::*; diff --git a/services/engine-sha512/src/lib.rs b/services/engine-sha512/src/lib.rs index 5840d66fe..31c30dfe3 100644 --- a/services/engine-sha512/src/lib.rs +++ b/services/engine-sha512/src/lib.rs @@ -5,7 +5,12 @@ pub use api::*; mod consts; mod sha256; +#[cfg(target_os = "xous")] mod sha512; +#[cfg(not(target_os = "xous"))] +mod sha512_hosted; +#[cfg(not(target_os = "xous"))] +use sha512_hosted as sha512; pub use digest::{self, Digest}; pub use sha256::{Sha224, Sha256};