1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

check LoadDevice.skip_checksum field

This commit is contained in:
Pavol Rusnak 2014-12-08 19:58:13 +01:00
parent 983d1ff4b5
commit 10fc0b69fc

View File

@ -42,6 +42,7 @@
#include "hmac.h"
#include "crypto.h"
#include "base58.h"
#include "bip39.h"
// message methods
@ -295,6 +296,14 @@ void fsm_msgLoadDevice(LoadDevice *msg)
return;
}
if (msg->has_mnemonic && !(msg->has_skip_checksum && msg->skip_checksum) ) {
if (!mnemonic_check(msg->mnemonic)) {
fsm_sendFailure(FailureType_Failure_ActionCancelled, "Mnemonic with wrong checksum provided");
layoutHome();
return;
}
}
storage_loadDevice(msg);
storage_commit();
fsm_sendSuccess("Device loaded");