feat(reset): dice-entropy fields for on-device roll collection - #119
Merged
BitHighlander merged 1 commit intoAug 4, 2026
Merged
Conversation
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 asFeatures.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.