From 6b31b8eec3e3f69a6ce5db8f6068523809bcfd2f Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Fri, 3 May 2024 14:57:55 +0200 Subject: [PATCH] chore(core): change USB manufacturer and product strings for new models [no changelog] --- .../bootloader/.changelog.d/3770.changed | 1 + core/embed/bootloader/main.c | 4 ++-- core/embed/bootloader_ci/main.c | 4 ++-- .../extmod/modtrezorutils/modtrezorutils.c | 20 +++++++++++++++++++ core/embed/models/model_D001.h | 2 ++ core/embed/models/model_D002.h | 2 ++ core/embed/models/model_T1B1.h | 2 ++ core/embed/models/model_T2B1.h | 2 ++ core/embed/models/model_T2T1.h | 2 ++ core/embed/models/model_T3T1.h | 2 ++ core/embed/prodtest/.changelog.d/3770.changed | 1 + core/embed/prodtest/main.c | 4 ++-- core/mocks/generated/trezorutils.pyi | 4 ++++ core/src/trezor/utils.py | 2 ++ core/src/usb.py | 4 ++-- 15 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 core/embed/bootloader/.changelog.d/3770.changed create mode 100644 core/embed/prodtest/.changelog.d/3770.changed diff --git a/core/embed/bootloader/.changelog.d/3770.changed b/core/embed/bootloader/.changelog.d/3770.changed new file mode 100644 index 0000000000..27ea35b84c --- /dev/null +++ b/core/embed/bootloader/.changelog.d/3770.changed @@ -0,0 +1 @@ +[T3T1] Changed USB manufacturer string to "Trezor Company" and product string to "Trezor Safe 5" in the USB descriptor strings. diff --git a/core/embed/bootloader/main.c b/core/embed/bootloader/main.c index 180bef9433..999edaca9a 100644 --- a/core/embed/bootloader/main.c +++ b/core/embed/bootloader/main.c @@ -98,8 +98,8 @@ static void usb_init_all(secbool usb21_landing) { .vendor_id = 0x1209, .product_id = 0x53C0, .release_num = 0x0200, - .manufacturer = "SatoshiLabs", - .product = "TREZOR", + .manufacturer = MODEL_USB_MANUFACTURER, + .product = MODEL_USB_PRODUCT, .serial_number = "000000000000000000000000", .interface = "TREZOR Interface", .usb21_enabled = sectrue, diff --git a/core/embed/bootloader_ci/main.c b/core/embed/bootloader_ci/main.c index 40c56d58a9..7ae4071043 100644 --- a/core/embed/bootloader_ci/main.c +++ b/core/embed/bootloader_ci/main.c @@ -56,8 +56,8 @@ static void usb_init_all(secbool usb21_landing) { .vendor_id = 0x1209, .product_id = 0x53C0, .release_num = 0x0200, - .manufacturer = "SatoshiLabs", - .product = "TREZOR", + .manufacturer = MODEL_USB_MANUFACTURER, + .product = MODEL_USB_PRODUCT, .serial_number = "000000000000000000000000", .interface = "TREZOR Interface", .usb21_enabled = sectrue, diff --git a/core/embed/extmod/modtrezorutils/modtrezorutils.c b/core/embed/extmod/modtrezorutils/modtrezorutils.c index 004f6941af..bff4e7532f 100644 --- a/core/embed/extmod/modtrezorutils/modtrezorutils.c +++ b/core/embed/extmod/modtrezorutils/modtrezorutils.c @@ -390,6 +390,18 @@ STATIC mp_obj_str_t mod_trezorutils_full_name_obj = { sizeof(MODEL_FULL_NAME) - 1, (const byte *)MODEL_FULL_NAME}; +STATIC mp_obj_str_t mod_trezorutils_model_usb_manufacturer_obj = { + {&mp_type_str}, + 0, + sizeof(MODEL_USB_MANUFACTURER) - 1, + (const byte *)MODEL_USB_MANUFACTURER}; + +STATIC mp_obj_str_t mod_trezorutils_model_usb_product_obj = { + {&mp_type_str}, + 0, + sizeof(MODEL_USB_PRODUCT) - 1, + (const byte *)MODEL_USB_PRODUCT}; + STATIC mp_obj_tuple_t mod_trezorutils_version_obj = { {&mp_type_tuple}, 4, @@ -410,6 +422,10 @@ STATIC mp_obj_tuple_t mod_trezorutils_version_obj = { /// """Model name.""" /// MODEL_FULL_NAME: str /// """Full name including Trezor prefix.""" +/// MODEL_USB_MANUFACTURER: str +/// """USB Manufacturer name.""" +/// MODEL_USB_PRODUCT: str +/// """USB Product name.""" /// INTERNAL_MODEL: str /// """Internal model code.""" /// EMULATOR: bool @@ -464,6 +480,10 @@ STATIC const mp_rom_map_elem_t mp_module_trezorutils_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_MODEL), MP_ROM_PTR(&mod_trezorutils_model_name_obj)}, {MP_ROM_QSTR(MP_QSTR_MODEL_FULL_NAME), MP_ROM_PTR(&mod_trezorutils_full_name_obj)}, + {MP_ROM_QSTR(MP_QSTR_MODEL_USB_MANUFACTURER), + MP_ROM_PTR(&mod_trezorutils_model_usb_manufacturer_obj)}, + {MP_ROM_QSTR(MP_QSTR_MODEL_USB_PRODUCT), + MP_ROM_PTR(&mod_trezorutils_model_usb_product_obj)}, {MP_ROM_QSTR(MP_QSTR_INTERNAL_MODEL), MP_ROM_QSTR(MODEL_INTERNAL_NAME_QSTR)}, #ifdef TREZOR_EMULATOR diff --git a/core/embed/models/model_D001.h b/core/embed/models/model_D001.h index 9f54bad1a7..5871173426 100644 --- a/core/embed/models/model_D001.h +++ b/core/embed/models/model_D001.h @@ -6,6 +6,8 @@ #define MODEL_INTERNAL_NAME "D001" #define MODEL_INTERNAL_NAME_TOKEN T #define MODEL_INTERNAL_NAME_QSTR MP_QSTR_D001 +#define MODEL_USB_MANUFACTURER "Trezor DIY" +#define MODEL_USB_PRODUCT MODEL_FULL_NAME /*** Discovery uses DEV keys in any build variant ***/ #define MODEL_BOARDLOADER_KEYS \ diff --git a/core/embed/models/model_D002.h b/core/embed/models/model_D002.h index 3c6d8d6a85..fbbde2c9af 100644 --- a/core/embed/models/model_D002.h +++ b/core/embed/models/model_D002.h @@ -9,6 +9,8 @@ #define MODEL_INTERNAL_NAME_TOKEN D002 #define MODEL_NAME_QSTR MP_QSTR_T #define MODEL_INTERNAL_NAME_QSTR MP_QSTR_D001 +#define MODEL_USB_MANUFACTURER "Trezor DIY" +#define MODEL_USB_PRODUCT MODEL_FULL_NAME /*** Discovery uses DEV keys in any build variant ***/ #define MODEL_BOARDLOADER_KEYS \ diff --git a/core/embed/models/model_T1B1.h b/core/embed/models/model_T1B1.h index c29414ea68..e54613a03e 100644 --- a/core/embed/models/model_T1B1.h +++ b/core/embed/models/model_T1B1.h @@ -6,6 +6,8 @@ #define MODEL_INTERNAL_NAME "T1B1" #define MODEL_INTERNAL_NAME_TOKEN T1B1 #define MODEL_INTERNAL_NAME_QSTR MP_QSTR_T1B1 +#define MODEL_USB_MANUFACTURER "SatoshiLabs" +#define MODEL_USB_PRODUCT "TREZOR" #define IMAGE_CHUNK_SIZE (64 * 1024) #define IMAGE_HASH_SHA256 diff --git a/core/embed/models/model_T2B1.h b/core/embed/models/model_T2B1.h index 12774b757b..a0bd57dc95 100644 --- a/core/embed/models/model_T2B1.h +++ b/core/embed/models/model_T2B1.h @@ -6,6 +6,8 @@ #define MODEL_INTERNAL_NAME "T2B1" #define MODEL_INTERNAL_NAME_TOKEN T2B1 #define MODEL_INTERNAL_NAME_QSTR MP_QSTR_T2B1 +#define MODEL_USB_MANUFACTURER "SatoshiLabs" +#define MODEL_USB_PRODUCT "TREZOR" /*** PRODUCTION KEYS ***/ #define MODEL_BOARDLOADER_KEYS \ diff --git a/core/embed/models/model_T2T1.h b/core/embed/models/model_T2T1.h index 1af939a55b..f814644650 100644 --- a/core/embed/models/model_T2T1.h +++ b/core/embed/models/model_T2T1.h @@ -6,6 +6,8 @@ #define MODEL_INTERNAL_NAME "T2T1" #define MODEL_INTERNAL_NAME_TOKEN T2T1 #define MODEL_INTERNAL_NAME_QSTR MP_QSTR_T2T1 +#define MODEL_USB_MANUFACTURER "SatoshiLabs" +#define MODEL_USB_PRODUCT "TREZOR" /*** PRODUCTION KEYS ***/ #define MODEL_BOARDLOADER_KEYS \ diff --git a/core/embed/models/model_T3T1.h b/core/embed/models/model_T3T1.h index 85717f7f22..e876159dc6 100644 --- a/core/embed/models/model_T3T1.h +++ b/core/embed/models/model_T3T1.h @@ -8,6 +8,8 @@ #define MODEL_INTERNAL_NAME "T3T1" #define MODEL_INTERNAL_NAME_TOKEN T3T1 #define MODEL_INTERNAL_NAME_QSTR MP_QSTR_T3T1 +#define MODEL_USB_MANUFACTURER "Trezor Company" +#define MODEL_USB_PRODUCT MODEL_FULL_NAME #define MODEL_BOARDLOADER_KEYS \ (const uint8_t *)"\x76\xaf\x42\x6e\x61\x40\x6b\xad\x7c\x07\x7b\x40\x9c\x66\xfd\xe3\x9f\xb8\x17\x91\x93\x13\xae\x1e\x4c\x02\x53\x5c\x80\xbe\xed\x96", \ diff --git a/core/embed/prodtest/.changelog.d/3770.changed b/core/embed/prodtest/.changelog.d/3770.changed new file mode 100644 index 0000000000..27ea35b84c --- /dev/null +++ b/core/embed/prodtest/.changelog.d/3770.changed @@ -0,0 +1 @@ +[T3T1] Changed USB manufacturer string to "Trezor Company" and product string to "Trezor Safe 5" in the USB descriptor strings. diff --git a/core/embed/prodtest/main.c b/core/embed/prodtest/main.c index 3495432bb4..e18a40c784 100644 --- a/core/embed/prodtest/main.c +++ b/core/embed/prodtest/main.c @@ -123,8 +123,8 @@ static void usb_init_all(void) { .vendor_id = 0x1209, .product_id = 0x53C1, .release_num = 0x0400, - .manufacturer = "SatoshiLabs", - .product = "TREZOR", + .manufacturer = MODEL_USB_MANUFACTURER, + .product = MODEL_USB_PRODUCT, .serial_number = "000000000000", .interface = "TREZOR Interface", .usb21_enabled = secfalse, diff --git a/core/mocks/generated/trezorutils.pyi b/core/mocks/generated/trezorutils.pyi index faabdad69a..088da5cd27 100644 --- a/core/mocks/generated/trezorutils.pyi +++ b/core/mocks/generated/trezorutils.pyi @@ -132,6 +132,10 @@ MODEL: str """Model name.""" MODEL_FULL_NAME: str """Full name including Trezor prefix.""" +MODEL_USB_MANUFACTURER: str +"""USB Manufacturer name.""" +MODEL_USB_PRODUCT: str +"""USB Product name.""" INTERNAL_MODEL: str """Internal model code.""" EMULATOR: bool diff --git a/core/src/trezor/utils.py b/core/src/trezor/utils.py index 0768d845c7..2ee5b05f96 100644 --- a/core/src/trezor/utils.py +++ b/core/src/trezor/utils.py @@ -6,6 +6,8 @@ from trezorutils import ( # noqa: F401 INTERNAL_MODEL, MODEL, MODEL_FULL_NAME, + MODEL_USB_MANUFACTURER, + MODEL_USB_PRODUCT, SCM_REVISION, UI_LAYOUT, USE_BACKLIGHT, diff --git a/core/src/usb.py b/core/src/usb.py index fef89f3d78..5dde66a1e2 100644 --- a/core/src/usb.py +++ b/core/src/usb.py @@ -6,8 +6,8 @@ bus = io.USB( vendor_id=0x1209, product_id=0x53C1, release_num=0x0200, - manufacturer="SatoshiLabs", - product="TREZOR", + manufacturer=utils.MODEL_USB_MANUFACTURER, + product=utils.MODEL_USB_PRODUCT, interface="TREZOR Interface", usb21_landing=False, )