From 57b08c98ed6f6e56d11f7789553cc23a54dd13e2 Mon Sep 17 00:00:00 2001 From: matejcik Date: Thu, 23 Jul 2020 16:46:54 +0200 Subject: [PATCH] core: raise error on setting passphrase-on-device without passphrase --- core/src/apps/management/apply_settings.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/src/apps/management/apply_settings.py b/core/src/apps/management/apply_settings.py index 93f761ad81..6aa14ae8d2 100644 --- a/core/src/apps/management/apply_settings.py +++ b/core/src/apps/management/apply_settings.py @@ -43,10 +43,9 @@ async def apply_settings(ctx: wire.Context, msg: ApplySettings): await require_confirm_change_passphrase(ctx, msg.use_passphrase) storage.device.set_passphrase_enabled(msg.use_passphrase) - if ( - storage.device.is_passphrase_enabled() - and msg.passphrase_always_on_device is not None - ): + if msg.passphrase_always_on_device is not None: + if not storage.device.is_passphrase_enabled(): + raise wire.DataError("Passphrase is not enabled") await require_confirm_change_passphrase_source( ctx, msg.passphrase_always_on_device )