diff --git a/legacy/firmware/config.c b/legacy/firmware/config.c index 12a511070..cc1e5c759 100644 --- a/legacy/firmware/config.c +++ b/legacy/firmware/config.c @@ -976,6 +976,8 @@ void config_wipe(void) { storage_set(KEY_UUID, config_uuid, sizeof(config_uuid)); storage_set(KEY_VERSION, &CONFIG_VERSION, sizeof(CONFIG_VERSION)); session_clear(false); + fsm_abortWorkflows(); + fsm_clearCosiNonce(); #if USE_BIP32_CACHE bip32_cache_clear(); diff --git a/legacy/firmware/fsm.h b/legacy/firmware/fsm.h index 74387b1fa..eb8518fb8 100644 --- a/legacy/firmware/fsm.h +++ b/legacy/firmware/fsm.h @@ -87,6 +87,7 @@ void fsm_msgSignIdentity(const SignIdentity *msg); void fsm_msgGetECDHSessionKey(const GetECDHSessionKey *msg); void fsm_msgCosiCommit(const CosiCommit *msg); void fsm_msgCosiSign(const CosiSign *msg); +void fsm_clearCosiNonce(void); // debug #if DEBUG_LINK diff --git a/legacy/firmware/fsm_msg_crypto.h b/legacy/firmware/fsm_msg_crypto.h index 1cdd6d541..72f2cdb28 100644 --- a/legacy/firmware/fsm_msg_crypto.h +++ b/legacy/firmware/fsm_msg_crypto.h @@ -334,6 +334,11 @@ void fsm_msgCosiSign(const CosiSign *msg) { } else { fsm_sendFailure(FailureType_Failure_FirmwareError, NULL); } - memzero(cosi_nonce, sizeof(cosi_nonce)); + fsm_clearCosiNonce(); layoutHome(); } + +void fsm_clearCosiNonce(void) { + cosi_nonce_is_set = false; + memzero(cosi_nonce, sizeof(cosi_nonce)); +}