Skip to content

[VAL] Tighten KV, PV, soc_ifc and MLDSA zeroize checks - #1565

Merged
calebofearth merged 3 commits into
mainfrom
user/mojtabab/pr1560-copilot-followup
Nov 30, 2026
Merged

calebofearth merged 3 commits into
mainfrom
user/mojtabab/pr1560-copilot-followup

Conversation

@mojtaba-bisheh

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #1560 that tightens several testbench checks raised in review. There are no design logic changes. In caliptra_top.sv, only assertion enables change.

  • KV: collision checks confirm that key data is erased, not only that read permission is revoked. Monitor wait helpers are now reentrant.
  • PV: the scoreboard checks the AHB response independently of the observed transaction.
  • soc_ifc: the register model covers INTERNAL_CSR_HMAC_KEY_LOCK.
  • caliptra_top: IMEM AHB error assertions are suppressed while the firmware-update reset window holds the bus idle.
  • MLDSA zeroize: the scan-mode path must observe zeroized data while the scrub is active, must end in a clean status, and must reach the expected warm-reset boot.

Verification

  • The affected KV, PV, soc_ifc and top-level tests pass across multiple seeds.
  • Targeted negative checks confirm that the new checks fail when their condition is violated.

Copilot AI balanced review requested due to automatic review settings November 23, 2026 20:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block approval of these testbench and assertion-enable updates.

No open issues 🎉

What changed in this PR

This follow-up to #1560 strengthens testbench checks for zeroization, bus responses, and reset behavior. It makes no design logic changes; the top-level RTL changes only assertion enables.

Changes:

  • Verify KV data erasure after write collisions and make monitor wait helpers reentrant.
  • Predict PV AHB responses independently and add the soc_ifc HMAC key-lock register to the testbench model.
  • Tighten MLDSA scan-zeroize completion and warm-reset checks, and suppress IMEM error assertions during firmware-update bus-idle windows.
File Description
src/​soc_ifc/​tb/​soc_ifc_tb_pkg.sv Models the HMAC key-lock address, mask, and write-one-to-set behavior.
src/​pcrvault/​uvmf_pv/​uvmf_template_output/​verification_ip/​environment_packages/​pv_env_pkg/​src/​pv_scoreboard.svh Updates comments to describe independent response prediction.
src/​pcrvault/​uvmf_pv/​uvmf_template_output/​verification_ip/​environment_packages/​pv_env_pkg/​src/​pv_predictor.svh Sets expected AHB responses to AHB_OKAY.
src/​keyvault/​uvmf_kv/​uvmf_template_output/​verification_ip/​interface_packages/​kv_write_pkg/​src/​kv_write_monitor_bfm.sv Makes the write-monitor clock wait task automatic.
src/​keyvault/​uvmf_kv/​uvmf_template_output/​verification_ip/​interface_packages/​kv_rst_pkg/​src/​kv_rst_monitor_bfm.sv Makes the reset-monitor clock wait task automatic.
src/​keyvault/​uvmf_kv/​uvmf_template_output/​verification_ip/​interface_packages/​kv_read_pkg/​src/​kv_read_monitor_bfm.sv Makes the read-monitor clock wait task automatic.
src/​keyvault/​uvmf_kv/​uvmf_template_output/​verification_ip/​environment_packages/​kv_env_pkg/​src/​kv_multi_write_collision_sequence.svh Restores read permission with a probe write to verify actual data erasure.
src/​integration/​test_suites/​smoke_test_mldsa_zeroize/​smoke_test_mldsa_zeroize.c Requires active-scrub readback, clean completion, and the expected warm-reset boot.
src/​integration/​rtl/​caliptra_top.sv Disables IMEM error-sequence assertions during firmware-update reset windows.

Review effort: Balanced

Follow-up to #1560 for review comments that were not addressed before
merge.

- caliptra_top: disable the IMEM AHB error-response assertions while
  fw_update_rst_window is asserted. The IMEM 2:1 mux forces the bus idle
  in that window and masks hresp/hreadyout, so the two-cycle ERROR
  handshake is not observable there.
- KV collision sequence: a denied read is masked to zero, so it only
  proved dest_valid was cleared. After each collision, write a probe word
  to restore read permission and re-read word 0 to prove the key data
  itself was erased.
- KV monitor BFMs: declare wait_for_num_clocks as automatic. The loop
  counter was static and shared between concurrent callers (predictor
  polling and sequence waits), which could shorten or lengthen waits.
- PV predictor: force the expected AHB response to OKAY instead of
  copying it from the observed transaction, so the scoreboard compare
  checks the response independently. The PV register block never
  returns an AHB error.
- soc_ifc TB: add INTERNAL_CSR_HMAC_KEY_LOCK to the register model with
  its 1-bit write-one-to-set mask, so the register sweep, reset and
  invalid-access tests cover it.
smoke_test_mldsa_zeroize could pass without exercising the scan-mode
path it targets.

- The readback loop runs only while MLDSA_STATUS is zero. If the scrub
  had already finished, the loop checked no words and the test still
  passed. In the scan path, fail when no word was read back while the
  scrub was active, and log the number of words checked.
- Scan zeroize completion only waited for READY. Also require VALID and
  ERROR to be clear, since the zeroize clears both.
- Every boot after the first passed unconditionally, so an unexpected
  reset in boot 1 could hide a failure. Set a persistent marker once
  the scan checks pass and, after the warm reset, require the second
  boot, the marker and CPTRA_RESET_REASON.WARM_RESET.
@mojtaba-bisheh
mojtaba-bisheh force-pushed the user/mojtabab/pr1560-copilot-followup branch from 5dea66a to 4bbfdf9 Compare November 30, 2026 14:30
Copilot AI balanced review requested due to automatic review settings November 30, 2026 14:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The instantiated abr_top/MLDSA implementation is absent, so confirming active-scrub observation by the readback guard and the expected warm-reset boot after scan exit requires simulator traces from the affected test.

No open issues 🎉

Review effort: Balanced

…lowup' with updated timestamp and hash after successful run
Copilot AI balanced review requested due to automatic review settings November 30, 2026 15:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the testbench-check enhancements.

No open issues 🎉

Review effort: Balanced

@mojtaba-bisheh mojtaba-bisheh changed the title [TB] Tighten KV, PV, soc_ifc and MLDSA zeroize checks [VAL] Tighten KV, PV, soc_ifc and MLDSA zeroize checks Nov 30, 2026
@calebofearth
calebofearth merged commit 6851766 into main Nov 30, 2026
84 checks passed
@calebofearth
calebofearth deleted the user/mojtabab/pr1560-copilot-followup branch November 30, 2026 22:25
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.

5 participants