diff --git a/Makefile b/Makefile index e7242896..1627c468 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ all: default APPNAME = "Recovery Check" APPVERSION_M = 1 APPVERSION_N = 2 -APPVERSION_P = 0 +APPVERSION_P = 1 APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" APP_LOAD_PARAMS = --appFlags 0x10 $(COMMON_LOAD_PARAMS) --curve secp256k1 --path "" diff --git a/glyphs/stax_recovery_64px.gif b/glyphs/stax_recovery_64px.gif deleted file mode 100644 index 7854f092..00000000 Binary files a/glyphs/stax_recovery_64px.gif and /dev/null differ diff --git a/glyphs/stax_recovery_check_64px.gif b/glyphs/stax_recovery_check_64px.gif index af4d15f4..d7be7510 100644 Binary files a/glyphs/stax_recovery_check_64px.gif and b/glyphs/stax_recovery_check_64px.gif differ diff --git a/icons/stax_recovery_check_32px.gif b/icons/stax_recovery_check_32px.gif index 2008fae9..36815d0a 100644 Binary files a/icons/stax_recovery_check_32px.gif and b/icons/stax_recovery_check_32px.gif differ diff --git a/src/nano/nanos_enter_phrase.c b/src/nano/nanos_enter_phrase.c index fb85be5d..fa830c1a 100644 --- a/src/nano/nanos_enter_phrase.c +++ b/src/nano/nanos_enter_phrase.c @@ -229,14 +229,18 @@ void compare_recovery_phrase(void) { cx_hmac_sha512_t ctx; const char key[] = "Bitcoin seed"; - cx_hmac_sha512_init(&ctx, (const uint8_t*) key, strlen(key)); - cx_hmac((cx_hmac_t*) &ctx, CX_LAST, buffer, 64, buffer, 64); + cx_hmac_sha512_init_no_throw(&ctx, (const uint8_t*) key, strlen(key)); + cx_hmac_no_throw((cx_hmac_t*) &ctx, CX_LAST, buffer, 64, buffer, 64); PRINTF("Root key from input:\n%.*H\n", 64, buffer); // get rootkey from device's seed uint8_t buffer_device[64]; - os_perso_derive_node_bip32(CX_CURVE_256K1, NULL, 0, buffer_device, buffer_device + 32); + if (os_derive_bip32_no_throw(CX_CURVE_256K1, NULL, 0, buffer_device, buffer_device + 32) != + CX_OK) { + PRINTF("An error occurred while comparing the recovery phrase\n"); + return; + } PRINTF("Root key from device: \n%.*H\n", 64, buffer_device); // compare both rootkey diff --git a/src/nano/nanox_enter_phrase.c b/src/nano/nanox_enter_phrase.c index 77d3f617..39f9bbda 100644 --- a/src/nano/nanox_enter_phrase.c +++ b/src/nano/nanox_enter_phrase.c @@ -397,7 +397,7 @@ const bagl_element_t* screen_onboarding_4_restore_word_before_element_display_ca return element; } -uint8_t compare_recovery_phrase(void) { +static uint8_t compare_recovery_phrase(void) { // convert mnemonic to hex-seed uint8_t buffer[64]; @@ -410,14 +410,18 @@ uint8_t compare_recovery_phrase(void) { cx_hmac_sha512_t ctx; const char key[] = "Bitcoin seed"; - cx_hmac_sha512_init(&ctx, (const uint8_t*) key, strlen(key)); - cx_hmac((cx_hmac_t*) &ctx, CX_LAST, buffer, 64, buffer, 64); + cx_hmac_sha512_init_no_throw(&ctx, (const uint8_t*) key, strlen(key)); + cx_hmac_no_throw((cx_hmac_t*) &ctx, CX_LAST, buffer, 64, buffer, 64); PRINTF("Root key from input:\n%.*H\n", 64, buffer); // get rootkey from device's seed uint8_t buffer_device[64]; - os_perso_derive_node_bip32(CX_CURVE_256K1, NULL, 0, buffer_device, buffer_device + 32); + if (os_derive_bip32_no_throw(CX_CURVE_256K1, NULL, 0, buffer_device, buffer_device + 32) != + CX_OK) { + PRINTF("An error occurred while comparing the recovery phrase\n"); + return 0; + } PRINTF("Root key from device: \n%.*H\n", 64, buffer_device); // compare both rootkey diff --git a/src/stax/passphrase_length_screen.c b/src/stax/passphrase_length_screen.c index 2fc41e40..e2f23706 100644 --- a/src/stax/passphrase_length_screen.c +++ b/src/stax/passphrase_length_screen.c @@ -13,7 +13,7 @@ nbgl_image_t *passphrase_length_set_icon() { nbgl_image_t *image = (nbgl_image_t *) nbgl_objPoolGet(IMAGE, 0); image->foregroundColor = BLACK; - image->buffer = &C_stax_recovery_64px; + image->buffer = &C_stax_recovery_check_64px; image->obj.area.bpp = NBGL_BPP_1; image->obj.alignmentMarginX = ICON_X; image->obj.alignmentMarginY = ICON_Y; diff --git a/tests/functional/navigator.py b/tests/functional/navigator.py index 33f14f51..7eae2509 100644 --- a/tests/functional/navigator.py +++ b/tests/functional/navigator.py @@ -62,4 +62,4 @@ def _write(self, characters: str): # the screen can be compared, when it has not reached its last state yet. # Adding extra time after writing to have a better chance to get the expected screen self.screen.keyboard.write(characters) - sleep(0.3) + sleep(1) diff --git a/tests/functional/snapshots/stax/check_previous_word/00003.png b/tests/functional/snapshots/stax/check_previous_word/00003.png index d9be1973..bbe94337 100644 Binary files a/tests/functional/snapshots/stax/check_previous_word/00003.png and b/tests/functional/snapshots/stax/check_previous_word/00003.png differ diff --git a/tests/functional/snapshots/stax/check_previous_word/00005.png b/tests/functional/snapshots/stax/check_previous_word/00005.png index a1d232fd..00328c26 100644 Binary files a/tests/functional/snapshots/stax/check_previous_word/00005.png and b/tests/functional/snapshots/stax/check_previous_word/00005.png differ diff --git a/tests/functional/snapshots/stax/correct.png b/tests/functional/snapshots/stax/correct.png index 29980ad8..e986f595 100644 Binary files a/tests/functional/snapshots/stax/correct.png and b/tests/functional/snapshots/stax/correct.png differ diff --git a/tests/functional/snapshots/stax/first_12.png b/tests/functional/snapshots/stax/first_12.png index 10682359..f8c75cb5 100644 Binary files a/tests/functional/snapshots/stax/first_12.png and b/tests/functional/snapshots/stax/first_12.png differ diff --git a/tests/functional/snapshots/stax/first_18.png b/tests/functional/snapshots/stax/first_18.png index 44a02522..bd8ca587 100644 Binary files a/tests/functional/snapshots/stax/first_18.png and b/tests/functional/snapshots/stax/first_18.png differ diff --git a/tests/functional/snapshots/stax/first_24.png b/tests/functional/snapshots/stax/first_24.png index b04d6fd4..f681254f 100644 Binary files a/tests/functional/snapshots/stax/first_24.png and b/tests/functional/snapshots/stax/first_24.png differ diff --git a/tests/functional/snapshots/stax/incorrect.png b/tests/functional/snapshots/stax/incorrect.png index 88fbe5ba..7d74653e 100644 Binary files a/tests/functional/snapshots/stax/incorrect.png and b/tests/functional/snapshots/stax/incorrect.png differ diff --git a/tests/functional/snapshots/stax/info.png b/tests/functional/snapshots/stax/info.png index 26a58219..6502711f 100644 Binary files a/tests/functional/snapshots/stax/info.png and b/tests/functional/snapshots/stax/info.png differ diff --git a/tests/functional/snapshots/stax/passphrase_length.png b/tests/functional/snapshots/stax/passphrase_length.png index 808a3431..3a385fc0 100644 Binary files a/tests/functional/snapshots/stax/passphrase_length.png and b/tests/functional/snapshots/stax/passphrase_length.png differ diff --git a/tests/functional/snapshots/stax/second_24.png b/tests/functional/snapshots/stax/second_24.png index c986e3d1..471a2439 100644 Binary files a/tests/functional/snapshots/stax/second_24.png and b/tests/functional/snapshots/stax/second_24.png differ diff --git a/tests/functional/snapshots/stax/third_24.png b/tests/functional/snapshots/stax/third_24.png index 921750b5..6b5a209e 100644 Binary files a/tests/functional/snapshots/stax/third_24.png and b/tests/functional/snapshots/stax/third_24.png differ diff --git a/tests/functional/snapshots/stax/welcome.png b/tests/functional/snapshots/stax/welcome.png index ab2b2db5..de43460d 100644 Binary files a/tests/functional/snapshots/stax/welcome.png and b/tests/functional/snapshots/stax/welcome.png differ diff --git a/tests/functional/test_fatstacks_options.py b/tests/functional/test_fatstacks_options.py index 1f2bd285..cc148dd2 100644 --- a/tests/functional/test_fatstacks_options.py +++ b/tests/functional/test_fatstacks_options.py @@ -12,14 +12,13 @@ def test_check_info_then_leave(navigator: StaxNavigator, functional_test_directory: str): instructions = format_instructions([ CustomNavInsID.HOME_TO_SETTINGS, - CustomNavInsID.SETTINGS_TO_HOME, - CustomNavInsID.HOME_TO_QUIT + CustomNavInsID.SETTINGS_TO_HOME ]) navigator.navigate_and_compare(functional_test_directory, "check_info_then_leave", instructions, screen_change_before_first_instruction=False, - screen_change_after_last_instruction=False) + screen_change_after_last_instruction=True) def test_check_all_passphrase_lengths(navigator: StaxNavigator, functional_test_directory: str):