mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
legacy: small nitpicks related to the new passphrase handling
This commit is contained in:
parent
15ed5cd19e
commit
73ed2f3450
@ -20,7 +20,7 @@ enum BackupType {
|
||||
* @next Features
|
||||
*/
|
||||
message Initialize {
|
||||
optional bytes session_id = 1; // assumed device session id; Trezor clears caches if it is different or empty
|
||||
optional bytes session_id = 3; // assumed device session id; Trezor clears caches if it is different or empty
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,6 +4,6 @@
|
||||
#define VERSION_BUILD 0
|
||||
|
||||
#define FIX_VERSION_MAJOR 2
|
||||
#define FIX_VERSION_MINOR 3
|
||||
#define FIX_VERSION_MINOR 2
|
||||
#define FIX_VERSION_PATCH 0
|
||||
#define FIX_VERSION_BUILD 0
|
||||
|
@ -22,5 +22,5 @@ class Initialize(p.MessageType):
|
||||
@classmethod
|
||||
def get_fields(cls) -> Dict:
|
||||
return {
|
||||
1: ('session_id', p.BytesType, 0),
|
||||
3: ('session_id', p.BytesType, 0),
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
Version 1.9.0? [not yet released]
|
||||
Version 1.9.0 [not yet released]
|
||||
* Disallow changing of settings via dry-run recovery
|
||||
* Wipe code
|
||||
* Make LoadDevice debug only and drop its XPRV feature
|
||||
|
@ -558,7 +558,7 @@ const uint8_t *config_getSeed(void) {
|
||||
// if storage has mnemonic, convert it to node and use it
|
||||
char mnemonic[MAX_MNEMONIC_LEN + 1] = {0};
|
||||
if (config_getMnemonic(mnemonic, sizeof(mnemonic))) {
|
||||
char passphrase[51];
|
||||
char passphrase[MAX_PASSPHRASE_LEN + 1] = {0};
|
||||
if (!protectPassphrase(passphrase)) {
|
||||
memzero(mnemonic, sizeof(mnemonic));
|
||||
memzero(passphrase, sizeof(passphrase));
|
||||
@ -614,8 +614,7 @@ bool config_getRootNode(HDNode *node, const char *curve) {
|
||||
if (seed == NULL) {
|
||||
return false;
|
||||
}
|
||||
int result;
|
||||
result = hdnode_from_seed(seed, 64, curve, node);
|
||||
int result = hdnode_from_seed(seed, 64, curve, node);
|
||||
if (result == 0) {
|
||||
fsm_sendFailure(FailureType_Failure_NotInitialized, _("Unsupported curve"));
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ void fsm_msgInitialize(const Initialize *msg) {
|
||||
signing_abort();
|
||||
if (msg && msg->has_session_id && msg->session_id.size == 32) {
|
||||
if (0 != memcmp(session_getSessionId(), msg->session_id.bytes, 32)) {
|
||||
// If session id was specified but does not match -> clear the cache.
|
||||
session_clear(false); // do not lock
|
||||
}
|
||||
} else {
|
||||
|
@ -351,10 +351,11 @@ bool protectChangeWipeCode(bool removal) {
|
||||
}
|
||||
|
||||
bool protectPassphrase(char *passphrase) {
|
||||
memzero(passphrase, MAX_PASSPHRASE_LEN + 1);
|
||||
bool passphrase_protection = false;
|
||||
config_getPassphraseProtection(&passphrase_protection);
|
||||
if (!passphrase_protection) {
|
||||
passphrase[0] = '\0';
|
||||
// passphrase already set to empty by memzero above
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -387,7 +388,6 @@ bool protectPassphrase(char *passphrase) {
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
// TODO: ask - why ppa->passphrase.size is not working? because of tiny?
|
||||
strlcpy(passphrase, ppa->passphrase, sizeof(ppa->passphrase));
|
||||
result = true;
|
||||
break;
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "messages-common.pb.h"
|
||||
#include "secbool.h"
|
||||
|
||||
#define MAX_PASSPHRASE_LEN 50
|
||||
|
||||
bool protectButton(ButtonRequestType type, bool confirm_only);
|
||||
secbool protectPinUiCallback(uint32_t wait, uint32_t progress,
|
||||
const char* message);
|
||||
|
@ -22,5 +22,5 @@ class Initialize(p.MessageType):
|
||||
@classmethod
|
||||
def get_fields(cls) -> Dict:
|
||||
return {
|
||||
1: ('session_id', p.BytesType, 0),
|
||||
3: ('session_id', p.BytesType, 0),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user