Conversation
1. Summary & MotivationML-DSA-87 signature verification on OpenTitan was previously measured at ~8.60 ms on Gen 2 ASIC (150 MHz), exceeding the target performance budget of Hardware profiling on the ChipWhisperer CW340 FPGA showed that the pure OTBN coprocessor computation is only 2.13 ms (318,789 cycles). The primary latency bottleneck was host CPU (Ibex) data marshalling over TileLink-Uncached-Lite (TL-UL) MMIO:
This PR introduces 2. Security Analysis
3. Empirical Hardware Measurements (ChipWhisperer CW340 FPGA)A. Step-by-Step Cycle Breakdown (1,821 words / 7,284 bytes input)
B. Latency Comparison across Target Clocks
4. Changes Included
|
a3c79f0 to
3d618b0
Compare
andrea-caforio
left a comment
There was a problem hiding this comment.
Thanks @GillonB, that's a crazy speedup. :-) How much does it degrade if you add back the CRC?
3d618b0 to
e2133e6
Compare
|
@andrea-caforio Still getting decent gains with the CRC:
Update the PR to get rid completely of random indexing copy as all privates are blinded already |
| * Write to OTBN's data memory (DMEM). | ||
| * | ||
| * To mitigate SCA, write in random order to the DMEM. | ||
| * Writes data to OTBN's data memory (DMEM) and verifies the LOAD_CHECKSUM |
There was a problem hiding this comment.
I am not sure if we really should get rid of the random order here. It might be worth adding a new otbn_dmem_write_unardened function.
There was a problem hiding this comment.
Ack. Updated the changes to add a new public data dmem copy
e2133e6 to
d5d91ce
Compare
| crc32_add8(&ctx, (uint8_t)offset); | ||
| crc32_add8(&ctx, (uint8_t)(offset >> 8)); | ||
|
|
||
| HARDENED_CHECK_LT(i, num_words); |
| OTBN_ADDR_T_INIT(mldsa87_verify, mldsa87_verify_pk); | ||
| HARDENED_TRY(otbn_dmem_write(public_key->key_length / sizeof(uint32_t), | ||
| public_key->key, kOtbnPk)); | ||
| HARDENED_TRY(otbn_dmem_write_public(public_key->key_length / sizeof(uint32_t), |
There was a problem hiding this comment.
I would then be consistent and apply it to all public data, I guess also RSA gains here
Add otbn_dmem_write_public() for linear public transfers and optimize DMEM CRC-32 calculation using direct crc32_add32/add8 instructions. Signed-off-by: Bastien Gillon <bgillon@google.com>
Add sc_otbn_dmem_write_public() in the silicon_creator OTBN driver to perform linear MMIO stores for non-sensitive public data without consuming PRNG entropy, and add unit test coverage. Signed-off-by: Bastien Gillon <bgillon@google.com>
…blic Switch non-sensitive public parameters (public keys, signatures, digests, ciphertext, modes) to otbn_dmem_write_public() across RSA, ML-KEM, ML-DSA, ECDSA, Ed25519, and ECDH. Signed-off-by: Bastien Gillon <bgillon@google.com>
…mem_write_public Switch non-sensitive public data transfers to sc_otbn_dmem_write_public() for OTBN application loading and boot services (sigverify, attestation, and status clearing). Signed-off-by: Bastien Gillon <bgillon@google.com>
d5d91ce to
9361c57
Compare
| const otbn_addr_t kOtbnVarRsaInOut = OTBN_ADDR_T_INIT(run_rsa, inout); | ||
| HARDENED_TRY(otbn_dmem_write(num_words, base, kOtbnVarRsaInOut)); | ||
| const otbn_addr_t kOtbnVarRsaN = OTBN_ADDR_T_INIT(run_rsa, rsa_n); | ||
| HARDENED_TRY(otbn_dmem_write(num_words, modulus, kOtbnVarRsaN)); |
|
|
||
| // Set the base, the modulus n and private exponent d. | ||
| const otbn_addr_t kOtbnVarRsaInOut = OTBN_ADDR_T_INIT(run_rsa, inout); | ||
| HARDENED_TRY(otbn_dmem_write(num_words, base, kOtbnVarRsaInOut)); |
There was a problem hiding this comment.
This is a public value (ciphertext or message digest)
ML-DSA-87 signature verification was previously bottlenecked by host CPU data marshalling over TL-UL MMIO, taking 568,648 cycles (~3.79 ms @ 150 MHz) to write the 1,821-word public input buffer (pk, sig, mu) due to side-channel Fisher-Yates PRNG random-order permutation and per-word software CRC-32 checksum calculation.
Because signature verification operates exclusively on public data, side-channel shuffling and software CRC verification on input writes provide no cryptographic protection and are unnecessary overhead.
This change:
This reduces DMEM write latency from 568,648 cycles to 23,763 cycles (23.9x speedup) and enables ML-DSA-87 verification with a cached/preloaded OTBN app image to complete in 2.29 ms on 150 MHz silicon.