Skip to content

Commit

Permalink
Reduce visibility of key ID constants.
Browse files Browse the repository at this point in the history
This prevents hardcoded values from being used where FHT should be used instead.
  • Loading branch information
bluegate010 committed Jan 17, 2024
1 parent 0d5ae88 commit 30d1c97
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
3 changes: 3 additions & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ default = ["std"]
emu = ["caliptra-drivers/emu"]
std = []
test_only_commands = ["caliptra-api/test_only_commands"]
rom = []
fmc = []
runtime = []
15 changes: 13 additions & 2 deletions common/src/keyids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,25 @@ Abstract:

use caliptra_drivers::KeyId;

#[cfg(feature = "rom")]
pub const KEY_ID_UDS: KeyId = KeyId::KeyId0;
#[cfg(feature = "rom")]
pub const KEY_ID_FE: KeyId = KeyId::KeyId1;
pub const KEY_ID_TMP: KeyId = KeyId::KeyId3;
pub const KEY_ID_ROM_FMC_CDI: KeyId = KeyId::KeyId6;
#[cfg(feature = "rom")]
pub const KEY_ID_IDEVID_PRIV_KEY: KeyId = KeyId::KeyId7;
#[cfg(feature = "rom")]
pub const KEY_ID_LDEVID_PRIV_KEY: KeyId = KeyId::KeyId5;
#[cfg(feature = "rom")]
pub const KEY_ID_ROM_FMC_CDI: KeyId = KeyId::KeyId6;
#[cfg(feature = "rom")]
pub const KEY_ID_FMC_PRIV_KEY: KeyId = KeyId::KeyId7;
#[cfg(feature = "fmc")]
pub const KEY_ID_RT_CDI: KeyId = KeyId::KeyId4;
#[cfg(feature = "fmc")]
pub const KEY_ID_RT_PRIV_KEY: KeyId = KeyId::KeyId5;
#[cfg(feature = "runtime")]
pub const KEY_ID_DPE_CDI: KeyId = KeyId::KeyId8;
#[cfg(feature = "runtime")]
pub const KEY_ID_DPE_PRIV_KEY: KeyId = KeyId::KeyId9;

pub const KEY_ID_TMP: KeyId = KeyId::KeyId3;
2 changes: 1 addition & 1 deletion fmc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
caliptra_common = { workspace = true, default-features = false }
caliptra_common = { workspace = true, default-features = false, features = ["fmc"] }
caliptra-cpu.workspace = true
caliptra-drivers.workspace = true
caliptra-error = { workspace = true, default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion rom/dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rust-version = "1.70"
[dependencies]
caliptra-cfi-lib = { workspace = true, default-features = false, features = ["cfi", "cfi-counter" ] }
caliptra-cfi-derive.workspace = true
caliptra_common = { workspace = true, default-features = false }
caliptra_common = { workspace = true, default-features = false, features = ["rom"] }
caliptra-drivers.workspace = true
caliptra-error = { workspace = true, default-features = false }
caliptra-image-types = { workspace = true, default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
caliptra_common = { workspace = true, default-features = false }
caliptra_common = { workspace = true, default-features = false, features = ["runtime"] }
caliptra-cpu.workspace = true
caliptra-drivers = { workspace = true, features = ["runtime", "no-cfi"] }
caliptra-error = { workspace = true, default-features = false }
Expand Down

0 comments on commit 30d1c97

Please sign in to comment.