mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-25 15:58:08 +00:00
legacy: implement EndSession
This commit is contained in:
parent
4909821f35
commit
58621711d1
@ -582,9 +582,13 @@ static void get_root_node_callback(uint32_t iter, uint32_t total) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t *config_getSeed(void) {
|
const uint8_t *config_getSeed(void) {
|
||||||
|
if (activeSessionCache == NULL) {
|
||||||
|
fsm_sendFailure(FailureType_Failure_ProcessError, "Invalid session");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// root node is properly cached
|
// root node is properly cached
|
||||||
if ((activeSessionCache != NULL) &&
|
if (activeSessionCache->seedCached == sectrue) {
|
||||||
(activeSessionCache->seedCached == sectrue)) {
|
|
||||||
return activeSessionCache->seed;
|
return activeSessionCache->seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,10 +612,6 @@ const uint8_t *config_getSeed(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
char oldTiny = usbTiny(1);
|
char oldTiny = usbTiny(1);
|
||||||
if (activeSessionCache == NULL) {
|
|
||||||
// this should not happen if the Host behaves and sends Initialize first
|
|
||||||
session_startSession(NULL);
|
|
||||||
}
|
|
||||||
mnemonic_to_seed(mnemonic, passphrase, activeSessionCache->seed,
|
mnemonic_to_seed(mnemonic, passphrase, activeSessionCache->seed,
|
||||||
get_root_node_callback); // BIP-0039
|
get_root_node_callback); // BIP-0039
|
||||||
memzero(mnemonic, sizeof(mnemonic));
|
memzero(mnemonic, sizeof(mnemonic));
|
||||||
@ -858,6 +858,12 @@ uint8_t *session_startSession(const uint8_t *received_session_id) {
|
|||||||
return activeSessionCache->id;
|
return activeSessionCache->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void session_endCurrentSession(void) {
|
||||||
|
if (activeSessionCache == NULL) return;
|
||||||
|
session_clearCache(activeSessionCache);
|
||||||
|
activeSessionCache = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
bool session_isUnlocked(void) { return sectrue == storage_is_unlocked(); }
|
bool session_isUnlocked(void) { return sectrue == storage_is_unlocked(); }
|
||||||
|
|
||||||
bool config_isInitialized(void) {
|
bool config_isInitialized(void) {
|
||||||
|
@ -90,6 +90,7 @@ extern Storage configUpdate;
|
|||||||
|
|
||||||
void config_init(void);
|
void config_init(void);
|
||||||
void session_clear(bool lock);
|
void session_clear(bool lock);
|
||||||
|
void session_endCurrentSession(void);
|
||||||
void config_lockDevice(void);
|
void config_lockDevice(void);
|
||||||
|
|
||||||
void config_loadDevice(const LoadDevice *msg);
|
void config_loadDevice(const LoadDevice *msg);
|
||||||
|
@ -354,8 +354,8 @@ void fsm_msgLockDevice(const LockDevice *msg) {
|
|||||||
|
|
||||||
void fsm_msgEndSession(const EndSession *msg) {
|
void fsm_msgEndSession(const EndSession *msg) {
|
||||||
(void)msg;
|
(void)msg;
|
||||||
// TODO
|
session_endCurrentSession();
|
||||||
fsm_sendFailure(FailureType_Failure_FirmwareError, "Not implemented");
|
fsm_sendSuccess(_("Session ended"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsm_msgApplySettings(const ApplySettings *msg) {
|
void fsm_msgApplySettings(const ApplySettings *msg) {
|
||||||
|
Loading…
Reference in New Issue
Block a user