Skip to content

Commit

Permalink
Update remaining tests to test both PQC types. (#1918)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtimkovich authored Jan 30, 2025
1 parent 2db0854 commit d050720
Show file tree
Hide file tree
Showing 12 changed files with 1,125 additions and 865 deletions.
7 changes: 7 additions & 0 deletions fmc/tests/fmc_integration_tests/helpers.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Licensed under the Apache-2.0 license
use caliptra_image_types::FwVerificationPqcKeyType;

pub const PQC_KEY_TYPE: [FwVerificationPqcKeyType; 2] = [
FwVerificationPqcKeyType::LMS,
FwVerificationPqcKeyType::MLDSA,
];
2 changes: 2 additions & 0 deletions fmc/tests/fmc_integration_tests/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Licensed under the Apache-2.0 license

mod helpers;

mod test_hand_off;
mod test_panic_missing;
mod test_rtalias;
55 changes: 34 additions & 21 deletions fmc/tests/fmc_integration_tests/test_hand_off.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,43 @@
// Licensed under the Apache-2.0 license
use crate::helpers;
use caliptra_builder::{firmware, ImageOptions};
use caliptra_hw_model::{BootParams, HwModel, InitParams};
use caliptra_hw_model::{BootParams, Fuses, HwModel, InitParams};

#[test]
fn test_hand_off() {
let rom = caliptra_builder::rom_for_fw_integration_tests().unwrap();

let image = caliptra_builder::build_and_sign_image(
&firmware::FMC_WITH_UART,
&firmware::runtime_tests::BOOT,
ImageOptions::default(),
)
.unwrap();

let mut hw = caliptra_hw_model::new(
InitParams {
rom: &rom,
for pqc_key_type in helpers::PQC_KEY_TYPE.iter() {
let fuses = Fuses {
fuse_pqc_key_type: *pqc_key_type as u32,
..Default::default()
},
BootParams {
fw_image: Some(&image.to_bytes().unwrap()),
};
let image_options = ImageOptions {
pqc_key_type: *pqc_key_type,
..Default::default()
},
)
.unwrap();
};

let rom = caliptra_builder::rom_for_fw_integration_tests().unwrap();

let image = caliptra_builder::build_and_sign_image(
&firmware::FMC_WITH_UART,
&firmware::runtime_tests::BOOT,
image_options,
)
.unwrap();

let mut hw = caliptra_hw_model::new(
InitParams {
rom: &rom,
..Default::default()
},
BootParams {
fw_image: Some(&image.to_bytes().unwrap()),
fuses,
..Default::default()
},
)
.unwrap();

let mut output = vec![];
hw.copy_output_until_exit_success(&mut output).unwrap();
let mut output = vec![];
hw.copy_output_until_exit_success(&mut output).unwrap();
}
}
Loading

0 comments on commit d050720

Please sign in to comment.