From 2587e49843738c0a4b69abe16c42849e7eed4bf1 Mon Sep 17 00:00:00 2001 From: Jochen Hoenicke Date: Fri, 23 Mar 2018 13:10:04 +0100 Subject: [PATCH] Disable fastflash. It doesn't make sense any more and doesn't work with newer bootloaders. --- .travis.yml | 6 ++---- fastflash/Makefile | 22 ---------------------- fastflash/bootloader.c | 1 - fastflash/signatures.c | 28 ---------------------------- fastflash/usb.c | 1 - firmware/Makefile | 18 ------------------ firmware/fastflash.c | 41 ----------------------------------------- firmware/fastflash.h | 25 ------------------------- firmware/trezor.c | 8 -------- script/cibuild | 5 ----- 10 files changed, 2 insertions(+), 153 deletions(-) delete mode 100644 fastflash/Makefile delete mode 120000 fastflash/bootloader.c delete mode 100644 fastflash/signatures.c delete mode 120000 fastflash/usb.c delete mode 100644 firmware/fastflash.c delete mode 100644 firmware/fastflash.h diff --git a/.travis.yml b/.travis.yml index 89fd55befa..374b6f701e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,10 +16,8 @@ env: - PYTHON=python3 - PROTOBUF_VERSION=3.4.0 matrix: - - DEBUG_LINK=0 FASTFLASH=0 - - DEBUG_LINK=1 FASTFLASH=0 - - DEBUG_LINK=0 FASTFLASH=1 - - DEBUG_LINK=1 FASTFLASH=1 + - DEBUG_LINK=0 + - DEBUG_LINK=1 matrix: include: diff --git a/fastflash/Makefile b/fastflash/Makefile deleted file mode 100644 index 5b768eb49c..0000000000 --- a/fastflash/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -APPVER = fastflash - -NAME = bootloader - -OBJS += bootloader.o -OBJS += signatures.o -OBJS += usb.o - -OBJS += ../vendor/trezor-crypto/bignum.small.o -OBJS += ../vendor/trezor-crypto/ecdsa.small.o -OBJS += ../vendor/trezor-crypto/secp256k1.small.o -OBJS += ../vendor/trezor-crypto/sha2.small.o -OBJS += ../vendor/trezor-crypto/memzero.small.o - -CFLAGS += -DUSE_PRECOMPUTED_IV=0 -CFLAGS += -DUSE_PRECOMPUTED_CP=0 - -OPTFLAGS ?= -Os - -include ../Makefile.include - -CFLAGS += -I../bootloader diff --git a/fastflash/bootloader.c b/fastflash/bootloader.c deleted file mode 120000 index 3c60d798d4..0000000000 --- a/fastflash/bootloader.c +++ /dev/null @@ -1 +0,0 @@ -../bootloader/bootloader.c \ No newline at end of file diff --git a/fastflash/signatures.c b/fastflash/signatures.c deleted file mode 100644 index 556dd6a946..0000000000 --- a/fastflash/signatures.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is part of the TREZOR project, https://trezor.io/ - * - * Copyright (C) 2017 Saleem Rashid - * - * This library is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - */ - -#include -#include - -int signatures_ok(uint8_t *store_hash) -{ - (void) store_hash; - - return false; -} diff --git a/fastflash/usb.c b/fastflash/usb.c deleted file mode 120000 index 13b2a33e6b..0000000000 --- a/fastflash/usb.c +++ /dev/null @@ -1 +0,0 @@ -../bootloader/usb.c \ No newline at end of file diff --git a/firmware/Makefile b/firmware/Makefile index 915435363d..2e5b329333 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -1,10 +1,5 @@ APPVER = 1.0.0 -ifeq ($(FASTFLASH),1) -OBJS += fastflash.o -OBJS += bootloader.o -endif - NAME = trezor ifeq ($(EMULATOR),1) @@ -87,12 +82,6 @@ OBJS += protob/types.pb.o include ../Makefile.include -ifeq ($(FASTFLASH),1) -CFLAGS += -DFASTFLASH=1 -else -CFLAGS += -DFASTFLASH=0 -endif - DEBUG_LINK ?= 0 DEBUG_LOG ?= 0 @@ -105,13 +94,6 @@ CFLAGS += -DSCM_REVISION='"$(shell git rev-parse HEAD | sed 's:\(..\):\\x\1:g')" CFLAGS += -DUSE_ETHEREUM=1 CFLAGS += -DUSE_NEM=1 -bootloader.o: ../fastflash/bootloader.bin - $(OBJCOPY) -I binary -O elf32-littlearm -B arm \ - --redefine-sym _binary_$(shell echo -n "$<" | tr -c "[:alnum:]" "_")_start=__bootloader_start__ \ - --redefine-sym _binary_$(shell echo -n "$<" | tr -c "[:alnum:]" "_")_size=__bootloader_size__ \ - --rename-section .data=.rodata \ - $< $@ - coins_count.h: coins-gen.py coins.json $(PYTHON) $< count > $@ diff --git a/firmware/fastflash.c b/firmware/fastflash.c deleted file mode 100644 index e6b803b928..0000000000 --- a/firmware/fastflash.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of the TREZOR project, https://trezor.io/ - * - * Copyright (C) 2017 Saleem Rashid - * - * This library is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - */ - -#include "fastflash.h" -#include "util.h" - -#include -#include -#include - -#define bootloader_vec ((vector_table_t *) 0x20000000) - -void __attribute__((noreturn)) run_bootloader(void) -{ - extern uint8_t __bootloader_start__[]; - extern uint8_t __bootloader_size__[]; - - // zero out SRAM - memset_reg(_ram_start, _ram_end, 0); - - // copy bootloader - memcpy(bootloader_vec, __bootloader_start__, (size_t) __bootloader_size__); - - jump_to_firmware(bootloader_vec, FW_TRUSTED); -} diff --git a/firmware/fastflash.h b/firmware/fastflash.h deleted file mode 100644 index fe8bc05a9a..0000000000 --- a/firmware/fastflash.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This file is part of the TREZOR project, https://trezor.io/ - * - * Copyright (C) 2017 Saleem Rashid - * - * This library is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - */ - -#ifndef __FASTFLASH_H__ -#define __FASTFLASH_H__ - -void __attribute__((noreturn)) run_bootloader(void); - -#endif diff --git a/firmware/trezor.c b/firmware/trezor.c index 4491cd1f0b..7a008d20b8 100644 --- a/firmware/trezor.c +++ b/firmware/trezor.c @@ -31,7 +31,6 @@ #include "buttons.h" #include "gettext.h" #include "bl_check.h" -#include "fastflash.h" /* Screen timeout */ uint32_t system_millis_lock_start; @@ -97,13 +96,6 @@ int main(void) __stack_chk_guard = random32(); // this supports compiler provided unpredictable stack protection checks #endif -#if FASTFLASH - uint16_t state = gpio_port_read(BTN_PORT); - if ((state & BTN_PIN_NO) == 0) { - run_bootloader(); - } -#endif - timer_init(); #ifdef APPVER diff --git a/script/cibuild b/script/cibuild index b8dc112261..a4f0b07f22 100755 --- a/script/cibuild +++ b/script/cibuild @@ -14,11 +14,6 @@ else fi make - -if [ "$FASTFLASH" = 1 ]; then - make -C fastflash -fi - make -C bootloader make -C vendor/nanopb/generator/proto make -C firmware/protob