1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 09:28:13 +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] _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) set_seed(None)
if skip_passphrase: if not keep_passphrase:
set_passphrase("")
else:
set_passphrase(None) set_passphrase(None)

View File

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