Skip to content

Commit efc3ad3

Browse files
committed
Merge branch 'slower-unlock'
2 parents 77af14c + a5811a5 commit efc3ad3

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ customers cannot upgrade their bootloader, its changes are recorded separately.
88

99
### [Unreleased]
1010
- Change title when entering recovery words to `1 of 24`, `2 of 24`, etc.
11-
- Unlock is now faster after password/passphrase entry (shorter unlock animation)
1211
- Remove option to restore from 18 recovery words
1312
- simulator: enable Test Merchant for payment requests
1413
- simulator: simulate a Nova device

src/rust/bitbox02/src/keystore.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,14 @@ pub async fn unlock_bip39(
152152
unlock_bip39_check(seed)?;
153153

154154
let (bip39_seed, root_fingerprint) =
155-
derive_bip39_seed(secp, seed, mnemonic_passphrase, yield_now).await;
155+
derive_bip39_seed(secp, seed, mnemonic_passphrase, &yield_now).await;
156+
157+
let (bip39_seed_2, root_fingerprint_2) =
158+
derive_bip39_seed(secp, seed, mnemonic_passphrase, &yield_now).await;
159+
160+
if bip39_seed != bip39_seed_2 || root_fingerprint != root_fingerprint_2 {
161+
return Err(Error::Memory);
162+
}
156163

157164
unlock_bip39_finalize(bip39_seed.as_slice().try_into().unwrap())?;
158165

src/ui/components/unlock_animation.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
// This many iterations times the slowdown factor to render the whole animation.
2727
#define LOCK_ANIMATION_N_FRAMES (38)
2828

29-
// Since BIP39 unlock takes 2048 iterations, and the screen frame rate is 30 (SCREEN_FRAME_RATE,
30-
// render is called only every 30th iteration), if we want both to finish at the same time, the
31-
// slowdown factor becomes the following:
32-
// (1.1f * (2048 / ((float)LOCK_ANIMATION_N_FRAMES * (float)SCREEN_FRAME_RATE)))
29+
// Since BIP39 unlock takes 2048*2 iterations (it is performed twice), and the screen frame rate is
30+
// 30 (SCREEN_FRAME_RATE, render is called only every 30th iteration), if we want both to finish at
31+
// the same time, the slowdown factor becomes the following:
32+
// (1.1f * (2048*2 / ((float)LOCK_ANIMATION_N_FRAMES * (float)SCREEN_FRAME_RATE)))
3333
// 10% is added so the animation takes a bit longer than the actual unlock.
34-
// The above value is 1.9761, we simply round up to 2.
35-
#define SLOWDOWN_FACTOR (2)
34+
// The above value is 3.95, we simply round up to 4.
35+
#define SLOWDOWN_FACTOR (4)
3636

3737
#define LOCK_ANIMATION_FRAME_WIDTH (28)
3838
#define LOCK_ANIMATION_FRAME_HEIGHT (25)
@@ -137,7 +137,7 @@ static const uint8_t LOCK_ANIMATION[LOCK_ANIMATION_ACTUAL_N_FRAMES][LOCK_ANIMATI
137137
*/
138138
static const uint8_t* _get_frame(int frame_idx)
139139
{
140-
if (frame_idx >= LOCK_ANIMATION_N_FRAMES) {
140+
if (frame_idx >= LOCK_ANIMATION_N_FRAMES + LOCK_ANIMATION_FRAMES_STOP_TIME) {
141141
Abort("Invalid lock animation frame requested.");
142142
}
143143
/* First part of the animation: Closed lock for LOCK_ANIMATION_FRAMES_STOP_TIME frames. */
@@ -166,7 +166,7 @@ static void _render(component_t* component)
166166
data_t* data = (data_t*)component->data;
167167
int frame = data->frame / SLOWDOWN_FACTOR;
168168

169-
if (frame >= LOCK_ANIMATION_N_FRAMES) {
169+
if (frame >= LOCK_ANIMATION_N_FRAMES + LOCK_ANIMATION_FRAMES_STOP_TIME) {
170170
/* End of the animation */
171171
if (data->on_done) {
172172
data->on_done(data->on_done_param);

0 commit comments

Comments
 (0)