From b18ff6e17682e3dd1fd2a4b740255c00798d79ff Mon Sep 17 00:00:00 2001 From: Max Timkovich Date: Fri, 3 Jan 2025 14:55:28 -0800 Subject: [PATCH] mldsa subj_key test (#1877) --- .../test_idevid_derivation.rs | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/rom/dev/tests/rom_integration_tests/test_idevid_derivation.rs b/rom/dev/tests/rom_integration_tests/test_idevid_derivation.rs index 4430ba8b1f..5ea9cc9b77 100644 --- a/rom/dev/tests/rom_integration_tests/test_idevid_derivation.rs +++ b/rom/dev/tests/rom_integration_tests/test_idevid_derivation.rs @@ -5,7 +5,7 @@ use caliptra_builder::{firmware, ImageOptions}; use caliptra_common::mailbox_api::{CommandId, GetLdevCertResp, MailboxReqHeader}; use caliptra_drivers::{IdevidCertAttr, MfgFlags, X509KeyIdAlgo}; use caliptra_hw_model::{DefaultHwModel, Fuses, HwModel}; -use caliptra_image_types::ImageBundle; +use caliptra_image_types::{FwVerificationPqcKeyType, ImageBundle}; use openssl::pkey::{PKey, Public}; use openssl::x509::X509; use openssl::{rand::rand_bytes, x509::X509Req}; @@ -54,7 +54,7 @@ fn test_generate_csr() { } #[test] -fn test_idev_subj_key_id_algo() { +fn test_ecc_idev_subj_key_id_algo() { for algo in 0..(X509KeyIdAlgo::Fuse as u32 + 1) { let mut fuses = Fuses::default(); fuses.idevid_cert_attr[IdevidCertAttr::Flags as usize] = algo; @@ -68,6 +68,25 @@ fn test_idev_subj_key_id_algo() { } } +#[test] +fn test_mldsa_idev_subj_key_id_algo() { + for algo in 0..(X509KeyIdAlgo::Fuse as u32 + 1) { + let mut fuses = Fuses::default(); + fuses.idevid_cert_attr[IdevidCertAttr::Flags as usize] = algo; + + let image_options = ImageOptions { + pqc_key_type: FwVerificationPqcKeyType::MLDSA, + ..Default::default() + }; + + let (mut hw, image_bundle) = helpers::build_hw_model_and_image_bundle(fuses, image_options); + hw.upload_firmware(&image_bundle.to_bytes().unwrap()) + .unwrap(); + + hw.step_until_boot_status(RT_READY_FOR_COMMANDS, true); + } +} + fn fuses_with_random_uds() -> Fuses { const UDS_LEN: usize = core::mem::size_of::() * 16; let mut uds_bytes = [0; UDS_LEN];