1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 23:08:14 +00:00

core: don't erase passphrase on ClearSession

This commit is contained in:
Pavol Rusnak 2019-05-13 19:35:32 +02:00
parent 4358318806
commit 4097f254d5
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 6 additions and 6 deletions

View File

@ -56,9 +56,7 @@ def set_passphrase(passphrase):
_cached_passphrase_fprint = _compute_state(b"FPRINT", passphrase or "")[:4]
def clear(skip_passphrase: bool = False):
def clear(keep_passphrase: bool = False):
set_seed(None)
if skip_passphrase:
set_passphrase("")
else:
if not keep_passphrase:
set_passphrase(None)

View File

@ -32,7 +32,9 @@ def get_features():
async def handle_Initialize(ctx, msg):
if msg.state is None or msg.state != cache.get_state(prev_state=bytes(msg.state)):
cache.clear(msg.skip_passphrase)
cache.clear()
if msg.skip_passphrase:
cache.set_passphrase("")
return get_features()
@ -45,7 +47,7 @@ async def handle_Cancel(ctx, msg):
async def handle_ClearSession(ctx, msg):
cache.clear()
cache.clear(keep_passphrase=True)
return Success(message="Session cleared")