Skip to content

feat(reset): dice-entropy fields for on-device roll collection - #119

Merged
BitHighlander merged 1 commit into
keepkey:up/release-protocolfrom
BitHighlander:feat/dice-entropy
Aug 4, 2026
Merged

feat(reset): dice-entropy fields for on-device roll collection#119
BitHighlander merged 1 commit into
keepkey:up/release-protocolfrom
BitHighlander:feat/dice-entropy

Conversation

@BitHighlander

Copy link
Copy Markdown
Collaborator

What

Four additions for the on-device dice-entropy ResetDevice flow (firmware PR: BitHighlander/keepkey-firmware#341-to-be):

  • ResetDevice.dice_entropy = 10 — ask the device to collect dice rolls with the single button and mix them into the internal entropy before it is displayed or committed. Tag 10 is the next free tag in this fork lineage (9 = u2f_counter; no reserved markers, gap tags deliberately not reused — same rationale as Features.supports_taproot).
  • DebugLinkDecision.input = 2 — synthetic keyboard input for on-device entry flows in DEBUG_LINK builds ('1'-'6' rolls, 'u' undo). Kept short (firmware sizes it at 40 chars) so the decoded nanopb struct fits the 64-byte tiny-message buffer.
  • DebugLinkState.dice_digest = 15 — SHA-256 of the collected ASCII roll string, so tests can prove the device received exactly the injected rolls.
  • ButtonRequestType.ButtonRequest_DiceRoll = 39 — announces the entry screen to the host (38 was the last used value; the reserved 30 gap is untouched).

Why device-side entry

Desktop-entered dice only defends while the device RNG contribution stays secret; against the compromised-host + weak-RNG combination the rolls must never touch the computer. Coldcard enters dice on the signer for the same reason.

Wire-verified end-to-end by the python-keepkey emulator test (keepkey/python-keepkey feat/dice-entropy): digest parity on 99 injected rolls with undo churn, and the post-mix internal entropy still reproducing the documented sha256(internal || external) mnemonic.

ResetDevice.dice_entropy=10 asks the device to collect dice rolls with
the single button and mix them into the internal entropy before it is
displayed or committed. DebugLinkDecision.input=2 lets debug builds
inject synthetic roll input (kept short so the decoded struct fits the
firmware tiny-message buffer). DebugLinkState.dice_digest=15 exposes
SHA-256 of the collected ASCII roll string so tests can prove the
device received exactly the injected rolls. ButtonRequest_DiceRoll=39
announces the entry screen to the host.
@BitHighlander
BitHighlander merged commit cf308fd into keepkey:up/release-protocol Aug 4, 2026
1 check passed
BitHighlander added a commit to BitHighlander/keepkey-firmware that referenced this pull request Aug 4, 2026
device-protocol -> cf308fd5e (merge of keepkey/device-protocol#119),
python-keepkey -> a8e41261c (merge of keepkey/python-keepkey#210).
Both previously pointed at the pre-merge branch commits; the old pins
remain ancestors of their base branches, so this is a pin move rather
than a content change. The pyk merge also brings in the taproot
confirmation-sequence commit that branch had and this one did not --
test_msg_signtx_taproot.py and test_msg_resetdevice.py both pass
against kkemu built from these pins (11/11), and the ARM full build is
unchanged at .text 616,604.
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.

1 participant