diff --git a/legacy/Makefile b/legacy/Makefile index cc445af4a..4f433f5fc 100644 --- a/legacy/Makefile +++ b/legacy/Makefile @@ -7,6 +7,7 @@ endif OBJS += buttons.o OBJS += common.o OBJS += flash.o +OBJS += fw_signatures.o OBJS += gen/bitmaps.o OBJS += gen/fonts.o OBJS += layout.o diff --git a/legacy/bootloader/Makefile b/legacy/bootloader/Makefile index 3366c1362..dd8b0b866 100644 --- a/legacy/bootloader/Makefile +++ b/legacy/bootloader/Makefile @@ -1,7 +1,6 @@ NAME = bootloader-unaligned OBJS += bootloader.o -OBJS += signatures.o OBJS += usb.o # Overrides from libtrezor. @@ -10,6 +9,7 @@ CFLAGS += -DFONT_SKIP_FIXED=1 OBJS += ../buttons.small.o OBJS += ../common.small.o OBJS += ../flash.small.o +OBJS += ../fw_signatures.small.o OBJS += ../gen/bitmaps.small.o OBJS += ../gen/fonts.small.o OBJS += ../layout.small.o diff --git a/legacy/bootloader/bootloader.c b/legacy/bootloader/bootloader.c index f9b6c4939..bd7b987b8 100644 --- a/legacy/bootloader/bootloader.c +++ b/legacy/bootloader/bootloader.c @@ -26,12 +26,12 @@ #include "bootloader.h" #include "buttons.h" #include "compiler_traits.h" +#include "fw_signatures.h" #include "layout.h" #include "memory.h" #include "oled.h" #include "rng.h" #include "setup.h" -#include "signatures.h" #include "supervise.h" #include "usb.h" #include "util.h" diff --git a/legacy/bootloader/usb.c b/legacy/bootloader/usb.c index e410d062b..3698622ea 100644 --- a/legacy/bootloader/usb.c +++ b/legacy/bootloader/usb.c @@ -26,6 +26,7 @@ #include "bootloader.h" #include "buttons.h" #include "ecdsa.h" +#include "fw_signatures.h" #include "layout.h" #include "memory.h" #include "memzero.h" @@ -34,7 +35,6 @@ #include "secbool.h" #include "secp256k1.h" #include "sha2.h" -#include "signatures.h" #include "usb.h" #include "util.h" diff --git a/legacy/firmware/fsm.c b/legacy/firmware/fsm.c index b744a92cf..ff9f7fb54 100644 --- a/legacy/firmware/fsm.c +++ b/legacy/firmware/fsm.c @@ -31,6 +31,7 @@ #include "debug.h" #include "ecdsa.h" #include "fsm.h" +#include "fw_signatures.h" #include "gettext.h" #include "hmac.h" #include "layout2.h" diff --git a/legacy/firmware/fsm_msg_common.h b/legacy/firmware/fsm_msg_common.h index 0b9e959cf..6442f3202 100644 --- a/legacy/firmware/fsm_msg_common.h +++ b/legacy/firmware/fsm_msg_common.h @@ -18,6 +18,14 @@ */ bool get_features(Features *resp) { + resp->has_fw_vendor = true; + const image_header *hdr = + (const image_header *)FLASH_PTR(FLASH_FWHEADER_START); + if (SIG_OK == signatures_new_ok(hdr, NULL)) { + strlcpy(resp->fw_vendor, "SatoshiLabs", sizeof(resp->fw_vendor)); + } else { + strlcpy(resp->fw_vendor, "UNSAFE, DO NOT USE!", sizeof(resp->fw_vendor)); + } resp->has_vendor = true; strlcpy(resp->vendor, "trezor.io", sizeof(resp->vendor)); resp->major_version = VERSION_MAJOR; diff --git a/legacy/bootloader/signatures.c b/legacy/fw_signatures.c similarity index 99% rename from legacy/bootloader/signatures.c rename to legacy/fw_signatures.c index bb34db6ed..29cb37a30 100644 --- a/legacy/bootloader/signatures.c +++ b/legacy/fw_signatures.c @@ -19,13 +19,12 @@ #include -#include "bootloader.h" #include "ecdsa.h" +#include "fw_signatures.h" #include "memory.h" #include "memzero.h" #include "secp256k1.h" #include "sha2.h" -#include "signatures.h" const uint32_t FIRMWARE_MAGIC_OLD = 0x525a5254; // TRZR const uint32_t FIRMWARE_MAGIC_NEW = 0x465a5254; // TRZF diff --git a/legacy/bootloader/signatures.h b/legacy/fw_signatures.h similarity index 97% rename from legacy/bootloader/signatures.h rename to legacy/fw_signatures.h index f52f470f7..1148dd2b4 100644 --- a/legacy/bootloader/signatures.h +++ b/legacy/fw_signatures.h @@ -17,8 +17,8 @@ * along with this library. If not, see . */ -#ifndef __SIGNATURES_H__ -#define __SIGNATURES_H__ +#ifndef __FW_SIGNATURES_H__ +#define __FW_SIGNATURES_H__ #include #include diff --git a/legacy/memory.h b/legacy/memory.h index 66b4b911c..e79267e32 100644 --- a/legacy/memory.h +++ b/legacy/memory.h @@ -52,7 +52,7 @@ - sig1[64], sig2[64], sig3[64] - sigindex1[1], sigindex2[1], sigindex3[1] * reserved[415] area is reduced to reserved[220] - - see signatures.c for more details + - see fw_signatures.c for more details We pad the firmware chunks with zeroes if they are shorted.