Skip to content

Commit

Permalink
drivers: Add driver for ml_dsa87 peripheral
Browse files Browse the repository at this point in the history
This adds both a driver and some unit tests.

Some TODOs are left in the driver as it is intended to hook this
peripheral to the keyvault in the future.

Signed-off-by: Arthur Heymans <arthur.heymans@9elements.com>
  • Loading branch information
ArthurHeymans committed Aug 28, 2024
1 parent 97751c2 commit a21c5ea
Show file tree
Hide file tree
Showing 8 changed files with 1,122 additions and 1 deletion.
6 changes: 6 additions & 0 deletions builder/src/firmware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ pub mod driver_tests {
..BASE_FWID
};

pub const ML_DSA87: FwId = FwId {
bin_name: "ml_dsa87",
..BASE_FWID
};

pub const ECC384: FwId = FwId {
bin_name: "ecc384",
..BASE_FWID
Expand Down Expand Up @@ -400,6 +405,7 @@ pub const REGISTERED_FW: &[&FwId] = &[
&hw_model_tests::TEST_UNITIALIZED_READ,
&hw_model_tests::TEST_PCR_EXTEND,
&driver_tests::DOE,
&driver_tests::ML_DSA87,
&driver_tests::ECC384,
&driver_tests::ECC384_SIGN_VALIDATION_FAILURE,
&driver_tests::ERROR_REPORTER,
Expand Down
3 changes: 3 additions & 0 deletions drivers/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ pub type Array4x8 = Array4xN<8, 32>;
pub type Array4x12 = Array4xN<12, 48>;
pub type Array4x16 = Array4xN<16, 64>;
pub type Array4x32 = Array4xN<32, 128>;
pub type Array4x648 = Array4xN<648, 2592>;
pub type Array4x1157 = Array4xN<1157, 4628>;
pub type Array4x1224 = Array4xN<1224, 4896>;

#[cfg(test)]
mod tests {
Expand Down
10 changes: 9 additions & 1 deletion drivers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ mod kv_access;
mod lms;
mod mailbox;
pub mod memory_layout;
mod ml_dsa87;
mod okref;
mod pcr_bank;
pub mod pcr_log;
Expand All @@ -52,7 +53,10 @@ mod soc_ifc;
mod trng;
mod trng_ext;

pub use array::{Array4x12, Array4x16, Array4x4, Array4x5, Array4x8, Array4xN};
pub use array::{
Array4x1157, Array4x12, Array4x1224, Array4x16, Array4x4, Array4x5, Array4x648, Array4x8,
Array4xN,
};
pub use array_concat::array_concat3;
pub use bounded_address::{BoundedAddr, MemBounds, RomAddr};
pub use caliptra_error::{CaliptraError, CaliptraResult};
Expand Down Expand Up @@ -82,6 +86,10 @@ pub use lms::{
Sha256Digest, D_INTR, D_LEAF, D_MESG, D_PBLC,
};
pub use mailbox::{Mailbox, MailboxRecvTxn, MailboxSendTxn};
pub use ml_dsa87::{
MlDsa87, MlDsa87MsgScalar, MlDsa87PublicKey, MlDsa87PublicKeyScalar, MlDsa87Result,
MlDsa87SecretKey, MlDsa87SecretKeyScalar, MlDsa87Seed, MlDsa87SignatureScalar,
};
pub use okref::okmutref;
pub use okref::okref;
pub use pcr_bank::{PcrBank, PcrId};
Expand Down
Loading

0 comments on commit a21c5ea

Please sign in to comment.