Skip to content

Commit

Permalink
Add new feature hw-2.x
Browse files Browse the repository at this point in the history
- Dependency fips204 is included only if hw-2.x feature is enabled
  • Loading branch information
jacquelinewong committed Feb 12, 2025
1 parent 84f85e1 commit 0675d33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sw-emulator/lib/periph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,3 +29,4 @@ zerocopy.workspace = true

[features]
"hw-1.0" = []
"hw-2.x" = ["fips204"]
1 change: 1 addition & 0 deletions sw-emulator/lib/periph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion sw-emulator/lib/periph/src/root_bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ 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,
};
#[cfg(feature = "hw-2.x")]
use crate::ml_dsa87::MlDsa87;
use caliptra_api_types::SecurityState;
use caliptra_emu_bus::{Clock, Ram, Rom};
use caliptra_emu_cpu::{Pic, PicMmioRegisters};
Expand Down Expand Up @@ -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,

Expand Down Expand Up @@ -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]),
Expand Down

0 comments on commit 0675d33

Please sign in to comment.