diff --git a/sw-emulator/lib/periph/Cargo.toml b/sw-emulator/lib/periph/Cargo.toml index 81972ab11d..0e8b568471 100644 --- a/sw-emulator/lib/periph/Cargo.toml +++ b/sw-emulator/lib/periph/Cargo.toml @@ -19,7 +19,7 @@ caliptra-emu-derive.workspace = true caliptra-emu-types.workspace = true caliptra-hw-model-types.workspace = true caliptra-registers.workspace = true -fips204.workspace = true +fips204 = { workspace = true, optional = true } lazy_static.workspace = true rand.workspace = true sha3.workspace = true @@ -29,3 +29,4 @@ zerocopy.workspace = true [features] "hw-1.0" = [] +"hw-2.x" = ["dep:fips204"] diff --git a/sw-emulator/lib/periph/src/lib.rs b/sw-emulator/lib/periph/src/lib.rs index 157470cf4b..59532d8375 100644 --- a/sw-emulator/lib/periph/src/lib.rs +++ b/sw-emulator/lib/periph/src/lib.rs @@ -25,6 +25,7 @@ mod hmac_sha384; mod iccm; mod key_vault; mod mailbox; +#[cfg(feature = "hw-2.x")] mod ml_dsa87; mod root_bus; mod sha512_acc; diff --git a/sw-emulator/lib/periph/src/root_bus.rs b/sw-emulator/lib/periph/src/root_bus.rs index 87a0e87a07..c0532a150d 100644 --- a/sw-emulator/lib/periph/src/root_bus.rs +++ b/sw-emulator/lib/periph/src/root_bus.rs @@ -12,11 +12,12 @@ Abstract: --*/ +#[cfg(feature = "hw-2.x")] +use crate::ml_dsa87::MlDsa87; use crate::MailboxRequester; use crate::{ helpers::words_from_bytes_be, iccm::Iccm, - ml_dsa87::MlDsa87, soc_reg::{DebugManufService, SocRegistersExternal}, AsymEcc384, Csrng, Doe, EmuCtrl, HashSha256, HashSha512, HmacSha384, KeyVault, MailboxExternal, MailboxInternal, MailboxRam, Sha512Accelerator, SocRegistersInternal, Uart, @@ -268,6 +269,7 @@ pub struct CaliptraRootBus { #[peripheral(offset = 0x1002_8000, mask = 0x0000_7fff)] pub sha256: HashSha256, + #[cfg(feature = "hw-2.x")] #[peripheral(offset = 0x1003_0000, mask = 0x0000_7fff)] // TODO update when known pub ml_dsa87: MlDsa87, @@ -332,6 +334,7 @@ impl CaliptraRootBus { key_vault: key_vault.clone(), sha512, sha256: HashSha256::new(clock), + #[cfg(feature = "hw-2.x")] ml_dsa87: MlDsa87::new(clock), iccm, dccm: Ram::new(vec![0; Self::DCCM_SIZE]),