add wipe of LFS during seed clear

This commit is contained in:
Peter D. Gray 2024-03-26 09:56:46 -04:00
parent 086c0ec5c7
commit c0442a131c
No known key found for this signature in database
GPG Key ID: A2DCD558C2BE5D7C
2 changed files with 17 additions and 3 deletions

View File

@ -601,6 +601,10 @@ consequences.''', escape='4')
if ch != '4':
return await ux_aborted()
# clear settings, address cache, settings from tmp seeds / seedvault seeds
from files import wipe_flash_filesystem
wipe_flash_filesystem(False)
seed.clear_seed()
# NOT REACHED -- reset happens
@ -2018,8 +2022,16 @@ async def wipe_hsm_policy(*A):
hsm_delete_policy()
goto_top_menu()
async def wipe_address_cache(*a):
ok = await ux_confirm('''Clear cached addresses used in ownership search. Harmless to erase, just costs time.''')
if not ok: return
from ownership import OWNERSHIP
OWNERSHIP.wipe_all()
await ux_dramatic_pause("Cleared.", 3)
async def wipe_ovc(*a):
# Factory command: for dev and test units that have no bag number, and never will.
ok = await ux_confirm('''Clear history of segwit UTXO input values we have seen already. \
This data protects you against specific attacks. Use this only if certain a false-positive \
has occured in the detection logic.''')

View File

@ -44,7 +44,7 @@ def _try_microsd():
#sys.print_exception(exc)
return False
def wipe_flash_filesystem():
def wipe_flash_filesystem(do_rebuild=True):
# erase and re-format the flash filesystem (/flash/**)
import ckcc, pyb
from glob import dis
@ -67,9 +67,11 @@ def wipe_flash_filesystem():
for n in range(bcount):
fl.writeblocks(n, blk)
ckcc.rng_bytes(blk)
dis.progress_sofar(n, bcount)
if not do_rebuild:
return
# rebuild and mount /flash
dis.fullscreen('Rebuilding...')