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

Dilithium driver #1624

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ArthurHeymans
Copy link
Contributor

This add preliminary driver support for the dilithium peripheral.
The code follows the ecc384 driver structure.

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 <[email protected]>
@mhatrevi mhatrevi marked this pull request as draft August 29, 2024 16:52
@vsonims vsonims added the Caliptra v2.0 Items to be considered for v2.0 Release label Oct 16, 2024
let secret_key = Array4x1224::read_from_reg(ml_dsa87.secret_key_out());

let public_key = Array4x648::read_from_reg(ml_dsa87.public_key());

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into an issue when enabling on Adam's Bridge RTL where the the sign was not completing. The feedback I got from MSFT is that the zeroize should happen between each operation. For enabling I added a call to zeroize here before the PCT.

ml_dsa87.ctrl().write(|w| w.ctrl(|w| w.signing()));

// Wait for hardware ready
wait::until(|| ml_dsa87.status().read().ready());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mean to wait for valid here, not ready.

ml_dsa87.ctrl().write(|w| w.ctrl(|w| w.verifying()));

// Wait for hardware ready
wait::until(|| ml_dsa87.status().read().ready());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mean to wait for valid here, not ready.

wait::until(|| ml_dsa87.status().read().ready());

let result = Array4x16::read_from_reg(ml_dsa87.verification_result());
// TODO currently emulator returns 1 on each word for success. Update when behavior is fleshed out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RDL says that it should match the first part of the signature: https://github.com/chipsalliance/adams-bridge/blob/main/src/mldsa_top/rtl/mldsa_reg.rdl#L168
I have not been able to get that with the RTL though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Caliptra v2.0 Items to be considered for v2.0 Release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants