feat(legacy): Return fw_vendor in firmware Features message.

[no changelog]
pull/2251/head
Andrew Kozlik 2 years ago committed by Martin Milata
parent bd8d9c9c6b
commit d693b0c196

@ -7,6 +7,7 @@ endif
OBJS += buttons.o OBJS += buttons.o
OBJS += common.o OBJS += common.o
OBJS += flash.o OBJS += flash.o
OBJS += fw_signatures.o
OBJS += gen/bitmaps.o OBJS += gen/bitmaps.o
OBJS += gen/fonts.o OBJS += gen/fonts.o
OBJS += layout.o OBJS += layout.o

@ -1,7 +1,6 @@
NAME = bootloader-unaligned NAME = bootloader-unaligned
OBJS += bootloader.o OBJS += bootloader.o
OBJS += signatures.o
OBJS += usb.o OBJS += usb.o
# Overrides from libtrezor. # Overrides from libtrezor.
@ -10,6 +9,7 @@ CFLAGS += -DFONT_SKIP_FIXED=1
OBJS += ../buttons.small.o OBJS += ../buttons.small.o
OBJS += ../common.small.o OBJS += ../common.small.o
OBJS += ../flash.small.o OBJS += ../flash.small.o
OBJS += ../fw_signatures.small.o
OBJS += ../gen/bitmaps.small.o OBJS += ../gen/bitmaps.small.o
OBJS += ../gen/fonts.small.o OBJS += ../gen/fonts.small.o
OBJS += ../layout.small.o OBJS += ../layout.small.o

@ -26,12 +26,12 @@
#include "bootloader.h" #include "bootloader.h"
#include "buttons.h" #include "buttons.h"
#include "compiler_traits.h" #include "compiler_traits.h"
#include "fw_signatures.h"
#include "layout.h" #include "layout.h"
#include "memory.h" #include "memory.h"
#include "oled.h" #include "oled.h"
#include "rng.h" #include "rng.h"
#include "setup.h" #include "setup.h"
#include "signatures.h"
#include "supervise.h" #include "supervise.h"
#include "usb.h" #include "usb.h"
#include "util.h" #include "util.h"

@ -26,6 +26,7 @@
#include "bootloader.h" #include "bootloader.h"
#include "buttons.h" #include "buttons.h"
#include "ecdsa.h" #include "ecdsa.h"
#include "fw_signatures.h"
#include "layout.h" #include "layout.h"
#include "memory.h" #include "memory.h"
#include "memzero.h" #include "memzero.h"
@ -34,7 +35,6 @@
#include "secbool.h" #include "secbool.h"
#include "secp256k1.h" #include "secp256k1.h"
#include "sha2.h" #include "sha2.h"
#include "signatures.h"
#include "usb.h" #include "usb.h"
#include "util.h" #include "util.h"

@ -31,6 +31,7 @@
#include "debug.h" #include "debug.h"
#include "ecdsa.h" #include "ecdsa.h"
#include "fsm.h" #include "fsm.h"
#include "fw_signatures.h"
#include "gettext.h" #include "gettext.h"
#include "hmac.h" #include "hmac.h"
#include "layout2.h" #include "layout2.h"

@ -18,6 +18,14 @@
*/ */
bool get_features(Features *resp) { 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; resp->has_vendor = true;
strlcpy(resp->vendor, "trezor.io", sizeof(resp->vendor)); strlcpy(resp->vendor, "trezor.io", sizeof(resp->vendor));
resp->major_version = VERSION_MAJOR; resp->major_version = VERSION_MAJOR;

@ -19,13 +19,12 @@
#include <string.h> #include <string.h>
#include "bootloader.h"
#include "ecdsa.h" #include "ecdsa.h"
#include "fw_signatures.h"
#include "memory.h" #include "memory.h"
#include "memzero.h" #include "memzero.h"
#include "secp256k1.h" #include "secp256k1.h"
#include "sha2.h" #include "sha2.h"
#include "signatures.h"
const uint32_t FIRMWARE_MAGIC_OLD = 0x525a5254; // TRZR const uint32_t FIRMWARE_MAGIC_OLD = 0x525a5254; // TRZR
const uint32_t FIRMWARE_MAGIC_NEW = 0x465a5254; // TRZF const uint32_t FIRMWARE_MAGIC_NEW = 0x465a5254; // TRZF

@ -17,8 +17,8 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>. * along with this library. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __SIGNATURES_H__ #ifndef __FW_SIGNATURES_H__
#define __SIGNATURES_H__ #define __FW_SIGNATURES_H__
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>

@ -52,7 +52,7 @@
- sig1[64], sig2[64], sig3[64] - sig1[64], sig2[64], sig3[64]
- sigindex1[1], sigindex2[1], sigindex3[1] - sigindex1[1], sigindex2[1], sigindex3[1]
* reserved[415] area is reduced to reserved[220] * 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. We pad the firmware chunks with zeroes if they are shorted.

Loading…
Cancel
Save