diff --git a/Makefile b/Makefile index d54c4afc96..140c3faf54 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,6 @@ OBJS += buttons.o OBJS += layout.o OBJS += oled.o OBJS += rng.o -OBJS += serialno.o ifneq ($(EMULATOR),1) OBJS += setup.o diff --git a/bootloader/bootloader.c b/bootloader/bootloader.c index 780af28b82..b9f840cc94 100644 --- a/bootloader/bootloader.c +++ b/bootloader/bootloader.c @@ -31,7 +31,6 @@ #include "util.h" #include "signatures.h" #include "layout.h" -#include "serialno.h" #include "rng.h" #include "timer.h" @@ -106,18 +105,13 @@ void bootloader_loop(void) oledClear(); oledDrawBitmap(0, 0, &bmp_logo64); if (firmware_present()) { - oledDrawString(52, 0, "TREZOR", FONT_STANDARD); - static char serial[25]; - fill_serialno_fixed(serial); - oledDrawString(52, 20, "Serial No.", FONT_STANDARD); - oledDrawString(52, 40, serial + 12, FONT_STANDARD); // second part of serial - serial[12] = 0; - oledDrawString(52, 30, serial, FONT_STANDARD); // first part of serial - oledDrawStringRight(OLED_WIDTH - 1, OLED_HEIGHT - 8, "Loader " VERSTR(VERSION_MAJOR) "." VERSTR(VERSION_MINOR) "." VERSTR(VERSION_PATCH), FONT_STANDARD); + oledDrawStringCenter(90, 10, "TREZOR", FONT_STANDARD); + oledDrawStringCenter(90, 30, "Bootloader", FONT_STANDARD); + oledDrawStringCenter(90, 50, VERSTR(VERSION_MAJOR) "." VERSTR(VERSION_MINOR) "." VERSTR(VERSION_PATCH), FONT_STANDARD); } else { - oledDrawString(52, 10, "Welcome!", FONT_STANDARD); - oledDrawString(52, 30, "Please visit", FONT_STANDARD); - oledDrawString(52, 50, "trezor.io/start", FONT_STANDARD); + oledDrawStringCenter(90, 10, "Welcome!", FONT_STANDARD); + oledDrawStringCenter(90, 30, "Please visit", FONT_STANDARD); + oledDrawStringCenter(90, 50, "trezor.io/start", FONT_STANDARD); } oledRefresh(); diff --git a/bootloader/usb.c b/bootloader/usb.c index 2930c48c25..700fc81f1f 100644 --- a/bootloader/usb.c +++ b/bootloader/usb.c @@ -27,7 +27,6 @@ #include "oled.h" #include "rng.h" #include "usb.h" -#include "serialno.h" #include "layout.h" #include "util.h" #include "signatures.h" @@ -174,7 +173,7 @@ static void send_msg_failure(usbd_device *dev) static void send_msg_features(usbd_device *dev) { // response: Features message (id 17), payload len 30 - // - vendor = "bitcointrezor.com" + // - vendor = "trezor.io" // - major_version = VERSION_MAJOR // - minor_version = VERSION_MINOR // - patch_version = VERSION_PATCH @@ -188,9 +187,9 @@ static void send_msg_features(usbd_device *dev) // msg_id "\x00\x11" // msg_size - "\x00\x00\x00\x1e" + "\x00\x00\x00\x16" // data - "\x0a" "\x11" "bitcointrezor.com" + "\x0a" "\x09" "trezor.io" "\x10" VERSION_MAJOR_CHAR "\x18" VERSION_MINOR_CHAR "\x20" VERSION_PATCH_CHAR @@ -198,7 +197,7 @@ static void send_msg_features(usbd_device *dev) "\x90\x01" "\x00" "\xaa" "\x01" "1" // padding - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" , 64) != 64) {} } else { while ( usbd_ep_write_packet(dev, ENDPOINT_ADDRESS_IN, @@ -207,9 +206,9 @@ static void send_msg_features(usbd_device *dev) // msg_id "\x00\x11" // msg_size - "\x00\x00\x00\x1e" + "\x00\x00\x00\x16" // data - "\x0a\x11" "bitcointrezor.com" + "\x0a" "\x09" "trezor.io" "\x10" VERSION_MAJOR_CHAR "\x18" VERSION_MINOR_CHAR "\x20" VERSION_PATCH_CHAR @@ -217,7 +216,7 @@ static void send_msg_features(usbd_device *dev) "\x90\x01" "\x01" "\xaa" "\x01" "1" // padding - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" , 64) != 64) {} } } diff --git a/firmware/fsm_msg_common.h b/firmware/fsm_msg_common.h index 218102f7b1..524d12b114 100644 --- a/firmware/fsm_msg_common.h +++ b/firmware/fsm_msg_common.h @@ -41,7 +41,7 @@ void fsm_msgGetFeatures(const GetFeatures *msg) { (void)msg; RESP_INIT(Features); - resp->has_vendor = true; strlcpy(resp->vendor, "bitcointrezor.com", sizeof(resp->vendor)); + resp->has_vendor = true; strlcpy(resp->vendor, "trezor.io", sizeof(resp->vendor)); resp->has_major_version = true; resp->major_version = VERSION_MAJOR; resp->has_minor_version = true; resp->minor_version = VERSION_MINOR; resp->has_patch_version = true; resp->patch_version = VERSION_PATCH; diff --git a/firmware/layout2.c b/firmware/layout2.c index 14f334f572..15bc7ef41c 100644 --- a/firmware/layout2.c +++ b/firmware/layout2.c @@ -246,22 +246,22 @@ void layoutHome(void) } else { if (label && strlen(label) > 0) { oledDrawBitmap(44, 4, &bmp_logo48); - oledDrawStringCenter(OLED_HEIGHT - 8, label, FONT_STANDARD); + oledDrawStringCenter(OLED_WIDTH / 2, OLED_HEIGHT - 8, label, FONT_STANDARD); } else { oledDrawBitmap(40, 0, &bmp_logo64); } } if (storage_noBackup()) { oledBox(0, 0, 127, 8, false); - oledDrawStringCenter(0, "SEEDLESS", FONT_STANDARD); + oledDrawStringCenter(OLED_WIDTH / 2, 0, "SEEDLESS", FONT_STANDARD); } else if (storage_unfinishedBackup()) { oledBox(0, 0, 127, 8, false); - oledDrawStringCenter(0, "BACKUP FAILED!", FONT_STANDARD); + oledDrawStringCenter(OLED_WIDTH / 2, 0, "BACKUP FAILED!", FONT_STANDARD); } else if (storage_needsBackup()) { oledBox(0, 0, 127, 8, false); - oledDrawStringCenter(0, "NEEDS BACKUP!", FONT_STANDARD); + oledDrawStringCenter(OLED_WIDTH / 2, 0, "NEEDS BACKUP!", FONT_STANDARD); } oledRefresh(); diff --git a/firmware/pinmatrix.c b/firmware/pinmatrix.c index e2234292a8..94f8a06cc6 100644 --- a/firmware/pinmatrix.c +++ b/firmware/pinmatrix.c @@ -39,7 +39,7 @@ void pinmatrix_draw(const char *text) // use (2 - j) instead of j to achieve 789456123 layout int k = pinmatrix_perm[i + (2 - j) * 3] - '0'; if (text) { - oledDrawStringCenter(0, text, FONT_STANDARD); + oledDrawStringCenter(OLED_WIDTH / 2, 0, text, FONT_STANDARD); } oledDrawBitmap((OLED_WIDTH - 3 * w - 2 * pad) / 2 + i * (w + pad), OLED_HEIGHT - 3 * h - 2 * pad + j * (h + pad), bmp_digits[k]); } diff --git a/firmware/stellar.c b/firmware/stellar.c index dc6b88f903..662cd5922b 100644 --- a/firmware/stellar.c +++ b/firmware/stellar.c @@ -1870,7 +1870,7 @@ void stellar_layoutSigningDialog(const char *line1, const char *line2, const cha // Warnings (drawn centered between the buttons if (warning) { - oledDrawStringCenter(OLED_HEIGHT - 8, warning, FONT_STANDARD); + oledDrawStringCenter(OLED_WIDTH / 2, OLED_HEIGHT - 8, warning, FONT_STANDARD); } // Next / sign button diff --git a/layout.c b/layout.c index cb8302b904..6b3e5538a5 100644 --- a/layout.c +++ b/layout.c @@ -49,7 +49,7 @@ void layoutDialog(const BITMAP *icon, const char *btnNo, const char *btnYes, con if (line3) oledDrawString(left, 2 * 9, line3, FONT_STANDARD); if (line4) oledDrawString(left, 3 * 9, line4, FONT_STANDARD); if (desc) { - oledDrawStringCenter(OLED_HEIGHT - 2 * 9 - 1, desc, FONT_STANDARD); + oledDrawStringCenter(OLED_WIDTH / 2, OLED_HEIGHT - 2 * 9 - 1, desc, FONT_STANDARD); if (btnYes || btnNo) { oledHLine(OLED_HEIGHT - 21); } @@ -110,7 +110,7 @@ void layoutProgress(const char *desc, int permil) // text oledBox(0, OLED_HEIGHT - 16, OLED_WIDTH - 1, OLED_HEIGHT - 16 + 7, 0); if (desc) { - oledDrawStringCenter(OLED_HEIGHT - 16, desc, FONT_STANDARD); + oledDrawStringCenter(OLED_WIDTH / 2, OLED_HEIGHT - 16, desc, FONT_STANDARD); } oledRefresh(); } diff --git a/oled.c b/oled.c index 77f30d526e..00a03a27e6 100644 --- a/oled.c +++ b/oled.c @@ -301,9 +301,9 @@ void oledDrawString(int x, int y, const char* text, int font) } } -void oledDrawStringCenter(int y, const char* text, int font) +void oledDrawStringCenter(int x, int y, const char* text, int font) { - int x = ( OLED_WIDTH - oledStringWidth(text, font) ) / 2; + x = x - oledStringWidth(text, font) / 2; oledDrawString(x, y, text, font); } diff --git a/oled.h b/oled.h index fcd7cc7d1b..afc09829bf 100644 --- a/oled.h +++ b/oled.h @@ -46,7 +46,7 @@ void oledDrawChar(int x, int y, char c, int zoom); int oledStringWidth(const char *text, int font); void oledDrawString(int x, int y, const char* text, int font); -void oledDrawStringCenter(int y, const char* text, int font); +void oledDrawStringCenter(int x, int y, const char* text, int font); void oledDrawStringRight(int x, int y, const char* text, int font); void oledDrawBitmap(int x, int y, const BITMAP *bmp); void oledInvert(int x1, int y1, int x2, int y2); diff --git a/serialno.c b/serialno.c deleted file mode 100644 index c621f95471..0000000000 --- a/serialno.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of the TREZOR project, https://trezor.io/ - * - * Copyright (C) 2014 Pavol Rusnak - * - * 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 - -#include - -#include "serialno.h" -#include "util.h" -#include "sha2.h" - -void fill_serialno_fixed(char *s) -{ - uint32_t uuid[8]; - desig_get_unique_id(uuid); - sha256_Raw((const uint8_t *)uuid, 12, (uint8_t *)uuid); - sha256_Raw((const uint8_t *)uuid, 32, (uint8_t *)uuid); - data2hex(uuid, 12, s); -} diff --git a/serialno.h b/serialno.h deleted file mode 100644 index 4e157f9ce5..0000000000 --- a/serialno.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of the TREZOR project, https://trezor.io/ - * - * Copyright (C) 2014 Pavol Rusnak - * - * 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 __SERIALNO_H__ -#define __SERIALNO_H__ - -// buffer has to be (at least) 25 chars long -void fill_serialno_fixed(char *s); - -#endif