diff --git a/drivers/src/hmac384_kdf.rs b/drivers/src/hmac_kdf.rs similarity index 98% rename from drivers/src/hmac384_kdf.rs rename to drivers/src/hmac_kdf.rs index cf4c51660b..a145d53a6f 100644 --- a/drivers/src/hmac384_kdf.rs +++ b/drivers/src/hmac_kdf.rs @@ -4,7 +4,7 @@ Licensed under the Apache-2.0 license. File Name: - hmac384_kdf.rs + hmac_kdf.rs Abstract: diff --git a/drivers/src/lib.rs b/drivers/src/lib.rs index 0dd9e4d5d9..31a54c33e1 100644 --- a/drivers/src/lib.rs +++ b/drivers/src/lib.rs @@ -32,7 +32,7 @@ mod fuse_bank; pub mod fuse_log; pub mod hand_off; mod hmac; -mod hmac384_kdf; +mod hmac_kdf; mod key_vault; mod kv_access; mod lms; @@ -77,7 +77,7 @@ pub use fuse_bank::{ }; pub use hand_off::FirmwareHandoffTable; pub use hmac::{Hmac, HmacData, HmacKey, HmacMode, HmacOp, HmacTag}; -pub use hmac384_kdf::hmac_kdf; +pub use hmac_kdf::hmac_kdf; pub use key_vault::{KeyId, KeyUsage, KeyVault}; pub use kv_access::{KeyReadArgs, KeyWriteArgs}; pub use lms::{ diff --git a/kat/src/kats_env.rs b/kat/src/kats_env.rs index b2de48da31..fc5827b141 100644 --- a/kat/src/kats_env.rs +++ b/kat/src/kats_env.rs @@ -17,8 +17,8 @@ pub struct KatsEnv<'a> { // SHA2-512/384 Accelerator pub sha2_512_384_acc: &'a mut Sha2_512_384Acc, - /// Hmac384 Engine - pub hmac384: &'a mut Hmac, + /// Hmac-512/384 Engine + pub hmac: &'a mut Hmac, /// Cryptographically Secure Random Number Generator pub trng: &'a mut Trng, diff --git a/kat/src/lib.rs b/kat/src/lib.rs index f71bc6bce6..660661bd63 100644 --- a/kat/src/lib.rs +++ b/kat/src/lib.rs @@ -59,7 +59,7 @@ pub fn execute_kat(env: &mut KatsEnv) -> CaliptraResult<()> { Ecc384Kat::default().execute(env.ecc384, env.trng)?; cprintln!("[kat] HMAC-384Kdf"); - Hmac384KdfKat::default().execute(env.hmac384, env.trng)?; + Hmac384KdfKat::default().execute(env.hmac, env.trng)?; cprintln!("[kat] LMS"); LmsKat::default().execute(env.sha256, env.lms)?; diff --git a/rom/dev/src/flow/cold_reset/fw_processor.rs b/rom/dev/src/flow/cold_reset/fw_processor.rs index 6164428da8..a5fd27070a 100644 --- a/rom/dev/src/flow/cold_reset/fw_processor.rs +++ b/rom/dev/src/flow/cold_reset/fw_processor.rs @@ -71,8 +71,8 @@ impl FirmwareProcessor { // SHA2-512/384 Accelerator sha2_512_384_acc: &mut env.sha2_512_384_acc, - // Hmac Engine - hmac384: &mut env.hmac, + // Hmac-512/384 Engine + hmac: &mut env.hmac, /// Cryptographically Secure Random Number Generator trng: &mut env.trng, diff --git a/rom/dev/src/main.rs b/rom/dev/src/main.rs index 382444867e..e8464de91d 100644 --- a/rom/dev/src/main.rs +++ b/rom/dev/src/main.rs @@ -139,8 +139,8 @@ pub extern "C" fn rom_entry() -> ! { // SHA2-512/384 Accelerator sha2_512_384_acc: &mut env.sha2_512_384_acc, - // Hmac Engine - hmac384: &mut env.hmac, + // Hmac-512/384 Engine + hmac: &mut env.hmac, /// Cryptographically Secure Random Number Generator trng: &mut env.trng, diff --git a/runtime/src/certify_key_extended.rs b/runtime/src/certify_key_extended.rs index 0e806131e8..8c33768ad3 100644 --- a/runtime/src/certify_key_extended.rs +++ b/runtime/src/certify_key_extended.rs @@ -55,7 +55,7 @@ impl CertifyKeyExtendedCmd { &mut drivers.sha384, &mut drivers.trng, &mut drivers.ecc384, - &mut drivers.hmac384, + &mut drivers.hmac, &mut drivers.key_vault, &mut pdata.fht.rt_dice_pub_key, key_id_rt_cdi, diff --git a/runtime/src/disable.rs b/runtime/src/disable.rs index 864ab71522..9d889049aa 100644 --- a/runtime/src/disable.rs +++ b/runtime/src/disable.rs @@ -55,7 +55,7 @@ impl DisableAttestationCmd { fn zero_rt_cdi(drivers: &mut Drivers) -> CaliptraResult<()> { let key_id_rt_cdi = Drivers::get_key_id_rt_cdi(drivers)?; hmac_kdf( - &mut drivers.hmac384, + &mut drivers.hmac, HmacKey::Array4x12(&Array4x12::default()), b"zero_rt_cdi", None, diff --git a/runtime/src/dpe_crypto.rs b/runtime/src/dpe_crypto.rs index 51dd86bbd8..46f29b4996 100644 --- a/runtime/src/dpe_crypto.rs +++ b/runtime/src/dpe_crypto.rs @@ -43,7 +43,7 @@ impl<'a> DpeCrypto<'a> { sha384: &'a mut Sha384, trng: &'a mut Trng, ecc384: &'a mut Ecc384, - hmac384: &'a mut Hmac, + hmac: &'a mut Hmac, key_vault: &'a mut KeyVault, rt_pub_key: &'a mut Ecc384PubKey, key_id_rt_cdi: KeyId, @@ -53,7 +53,7 @@ impl<'a> DpeCrypto<'a> { sha384, trng, ecc384, - hmac: hmac384, + hmac, key_vault, rt_pub_key, key_id_rt_cdi, diff --git a/runtime/src/drivers.rs b/runtime/src/drivers.rs index e00b0f90e4..659be4b62b 100644 --- a/runtime/src/drivers.rs +++ b/runtime/src/drivers.rs @@ -81,8 +81,8 @@ pub struct Drivers { // SHA2-512/384 Accelerator pub sha2_512_384_acc: Sha2_512_384Acc, - /// Hmac384 Engine - pub hmac384: Hmac, + /// Hmac-512/384 Engine + pub hmac: Hmac, /// Cryptographically Secure Random Number Generator pub trng: Trng, @@ -133,7 +133,7 @@ impl Drivers { sha256: Sha256::new(Sha256Reg::new()), sha384: Sha384::new(Sha512Reg::new()), sha2_512_384_acc: Sha2_512_384Acc::new(Sha512AccCsr::new()), - hmac384: Hmac::new(HmacReg::new()), + hmac: Hmac::new(HmacReg::new()), ecc384: Ecc384::new(EccReg::new()), sha1: Sha1::default(), lms: Lms::default(), @@ -384,7 +384,7 @@ impl Drivers { &mut drivers.sha384, &mut drivers.trng, &mut drivers.ecc384, - &mut drivers.hmac384, + &mut drivers.hmac, &mut drivers.key_vault, &mut pdata.fht.rt_dice_pub_key, key_id_rt_cdi, diff --git a/runtime/src/fips.rs b/runtime/src/fips.rs index 6a5a068dcb..0d963101c9 100644 --- a/runtime/src/fips.rs +++ b/runtime/src/fips.rs @@ -159,8 +159,8 @@ pub mod fips_self_test_cmd { // SHA2-512/384 Accelerator sha2_512_384_acc: &mut env.sha2_512_384_acc, - // Hmac384 Engine - hmac384: &mut env.hmac384, + // Hmac-512/384 Engine + hmac: &mut env.hmac, /// Cryptographically Secure Random Number Generator trng: &mut env.trng, diff --git a/runtime/src/hmac.rs b/runtime/src/hmac.rs index 4527a3b375..a0a56aa9a7 100644 --- a/runtime/src/hmac.rs +++ b/runtime/src/hmac.rs @@ -45,7 +45,7 @@ fn ecc384_key_gen( priv_key: KeyId, ) -> CaliptraResult { hmac_kdf( - &mut drivers.hmac384, + &mut drivers.hmac, KeyReadArgs::new(input).into(), label, None, @@ -93,7 +93,7 @@ impl Hmac { /// * `output` - KeyId which the output hash should be written to #[cfg_attr(not(feature = "no-cfi"), cfi_impl_fn)] pub fn hmac384_hash(drivers: &mut Drivers, input: KeyId, output: KeyId) -> CaliptraResult<()> { - drivers.hmac384.hmac( + drivers.hmac.hmac( &KeyReadArgs::new(input).into(), &HmacData::Slice(&[]), &mut drivers.trng, @@ -150,7 +150,7 @@ impl Hmac { hasher.finalize(&mut pubkey_digest)?; let mut hmac_output = Array4x12::default(); - drivers.hmac384.hmac( + drivers.hmac.hmac( &HmacKey::Array4x12(&pubkey_digest), &HmacData::Slice(data), &mut drivers.trng, diff --git a/runtime/src/invoke_dpe.rs b/runtime/src/invoke_dpe.rs index 4a731e16ca..0ee8773768 100644 --- a/runtime/src/invoke_dpe.rs +++ b/runtime/src/invoke_dpe.rs @@ -55,7 +55,7 @@ impl InvokeDpeCmd { &mut drivers.sha384, &mut drivers.trng, &mut drivers.ecc384, - &mut drivers.hmac384, + &mut drivers.hmac, &mut drivers.key_vault, &mut pdata.fht.rt_dice_pub_key, key_id_rt_cdi, diff --git a/runtime/src/stash_measurement.rs b/runtime/src/stash_measurement.rs index 7f13210ec5..12856259da 100644 --- a/runtime/src/stash_measurement.rs +++ b/runtime/src/stash_measurement.rs @@ -57,7 +57,7 @@ impl StashMeasurementCmd { &mut drivers.sha384, &mut drivers.trng, &mut drivers.ecc384, - &mut drivers.hmac384, + &mut drivers.hmac, &mut drivers.key_vault, &mut pdata.fht.rt_dice_pub_key, key_id_rt_cdi, diff --git a/sw-emulator/lib/periph/src/hmac.rs b/sw-emulator/lib/periph/src/hmac.rs index b24e7b3489..f7b54d5a95 100644 --- a/sw-emulator/lib/periph/src/hmac.rs +++ b/sw-emulator/lib/periph/src/hmac.rs @@ -641,12 +641,6 @@ impl HmacSha { fn tag_write_complete(&mut self) { let key_id = self.tag_write_ctrl.reg.read(TagWriteControl::KEY_ID); - // let temp = &self.tag.as_bytes()[..self.key_len() * 4]; - // println!("EMU: HMAC Tag: "); - // for i in 0..temp.len() { - // print!("{:x}, ", temp[i]); - // } - // println!(); // Store the tag in the key-vault. // Tag is in big-endian format and is stored in the same format. let tag_write_result = match self