Skip to content

Commit

Permalink
mldsa subj_key test
Browse files Browse the repository at this point in the history
  • Loading branch information
mtimkovich committed Jan 3, 2025
1 parent e11ed03 commit 75b6b18
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions rom/dev/tests/rom_integration_tests/test_idevid_derivation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
Expand All @@ -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::<u32>() * 16;
let mut uds_bytes = [0; UDS_LEN];
Expand Down

0 comments on commit 75b6b18

Please sign in to comment.