Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MLDSA subj key id algo test #1877

Merged
merged 2 commits into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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