Skip to content

Conversation

benma
Copy link
Collaborator

@benma benma commented Oct 2, 2025

The sanity check to see if the seed has changed does not need a securechip operation, it can use the retained seed hash instead, same as unlock_bip39(). This reduces the number of securechip operations needed to do a password check, which reduces the risk of running into the Optiga throttling security mechanism.

This is based on #1621 so the reduction can be seen in the show_mnemonic unit test too

@benma benma requested a review from NickeZ October 2, 2025 08:01
@benma benma force-pushed the sc-events branch 2 times, most recently from 8e21085 to e741db0 Compare October 2, 2025 08:10
benma added 4 commits October 2, 2025 12:00
`show_and_confirm_mnemonic(hal: ...)` did not use the HAL for all UI:
show_mnemonic and confirm_mnemonic directly used the BitBox02 menu
workflow without going through HAL. Can't use `hal().ui().menu(...)`,
becaus:

- these functions bolt a cancel prompt on top
- show_mnemonic is not a normal menu where one can pick an entry, it's
  just a scroll-through for displaying the mnemonic

This should make it possible to mock/fake/test the mneomnic workflow
functions, and provide different implementations for them in future
BitBox hardware.
The default implementation is in terms of other HAL/UI functions. For
unit tests (e.g. in show_mnemonic.rs or bip85.rs), it is useful to be
able to skip over the implementation details, so the tests don't have
to mock selecting the right words in the quiz.
This also allows us to keep track of the number of secure chip
operations in all the scenarios.
The sanity check to see if the seed has changed does not need a
securechip operation, it can use the retained seed hash instead, same
as `unlock_bip39()`. This reduces the number of securechip operations
needed to do a password check, which reduces the risk of running into
the Optiga throttling security mechanism.
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