Skip to content

[dice] Refactor: Move DICE cert generation functions in a separate library - #30954

Merged
timothytrippel merged 2 commits into
lowRISC:earlgrey_1.0.0from
xorptr:perso_mldsa_ft_provisioning_refactor
Aug 24, 2026
Merged

[dice] Refactor: Move DICE cert generation functions in a separate library#30954
timothytrippel merged 2 commits into
lowRISC:earlgrey_1.0.0from
xorptr:perso_mldsa_ft_provisioning_refactor

Conversation

@xorptr

@xorptr xorptr commented Aug 6, 2026

Copy link
Copy Markdown

I am planning to use functions from //sw/device/silicon_creator/lib/cert:dice_mldsa library to derive seed for UDS MLDSA keygen in sw/device/silicon_creator/manuf/base/ft_personalize.c. Linking dice_mldsa library with ft_personalize.c runs into failure since it defines few functions from the already linked //sw/device/silicon_creator/lib/cert:dice (like dice_attest_cdi_0 and dice_attest_cdi_1). Since ft_personalize.c only needs functions to build and populate DICE certificate for UDS, CDI0, and CDI1, I am refactoring the code to move these function definitions inside a new library target //sw/device/silicon_creator/lib/cert:dice_cert_build so that they can be linked along with //sw/device/silicon_creator/lib/cert:dice_mldsa when building new ft_personalize.c with ML-DSA provisioning support

Tested by running //sw/host/provisioning/orchestrator/tests:e2e_emulation_cw340_test and //sw/device/silicon_creator/rom_ext/e2e/attestation:print_certs_test_fpga_cw340_rom_ext locally

Changes on top of PR #30939

I am planning on using [`ml-dsa = "0.1.1"`](https://crates.io/crates/ml-dsa)
library in host tooling for benchtop provisioning tests (ft provisioning). The
current rust toolchain errors out with the following message:

```
error[E0405]: cannot find trait `AsyncFn` in this scope
   --> external/rules_rust++crate+crate_index__signature-3.0.0/src/verifier.rs:114:37
    |
114 |     async fn verify_digest_async<F: AsyncFn(&mut D) -> Result<(), Error>>(
    |                                     ^^^^^^^ not found in this scope
    |
help: consider importing this trait
    |
3   + use core::ops::AsyncFn;
    |
```

To address this issue, I am updating the toolchain to nightly version
2025-02-01. `AsyncFn` was
[merged on 2025-01-30](rust-lang/rust#135852). By trial
and error, I found that the compiler stops running into that error starting
with nightly 2025-02-01

I also fixed clippy warnings (raised as errors by `-Dwarnings` that occurred
after updating the compiler toolchain

I verified the new hashes manually from [rust
CDN](https://static.rust-lang.org/dist/2025-02-01/channel-rust-nightly.toml)

Signed-off-by: Lovepreet Singh <lpsingh@google.com>
@xorptr
xorptr requested review from a team as code owners August 6, 2026 21:22
@xorptr
xorptr requested review from alees24 and cfrantz and removed request for a team August 6, 2026 21:22
@xorptr
xorptr force-pushed the perso_mldsa_ft_provisioning_refactor branch from 4661489 to a366e63 Compare August 7, 2026 04:08
@xorptr
xorptr force-pushed the perso_mldsa_ft_provisioning_refactor branch from a366e63 to 1131fbe Compare August 7, 2026 17:17
…brary

I am planning to use functions from
`//sw/device/silicon_creator/lib/cert:dice_mldsa` library to derive seed for
UDS MLDSA keygen in `sw/device/silicon_creator/manuf/base/ft_personalize.c`.
Linking `dice_mldsa` library with `ft_personalize.c` runs into failure since it
defines few functions from the already linked
`//sw/device/silicon_creator/lib/cert:dice` (like `dice_attest_cdi_0` and
`dice_attest_cdi_1`). Since `ft_personalize.c` only needs functions to build
and populate DICE certificate for UDS, CDI0, and CDI1, I am refactoring the
code to move these function definitions inside a new library target
`//sw/device/silicon_creator/lib/cert:dice_cert_build` so that they can be
linked along with `//sw/device/silicon_creator/lib/cert:dice_mldsa` when
building new `ft_personalize.c` with ML-DSA provisioning support

Tested by running
`//sw/host/provisioning/orchestrator/tests:e2e_emulation_cw340_test` and
`//sw/device/silicon_creator/rom_ext/e2e/attestation:print_certs_test_fpga_cw340_rom_ext`
locally

Signed-off-by: Lovepreet Singh <lpsingh@google.com>
@xorptr
xorptr force-pushed the perso_mldsa_ft_provisioning_refactor branch from 1131fbe to a7d2d39 Compare August 17, 2026 18:37
@timothytrippel
timothytrippel merged commit 5ecdacf into lowRISC:earlgrey_1.0.0 Aug 24, 2026
66 of 68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants