chore(core): replace `gen.sh` with `generate_certificates.py`
What changed, and why it matters
This is a routine developer tooling change. Trezor replaced a shell script used to convert certificate files into C header files with a new Python script that does the same job. The actual certificate data did not change, only the wrapper format and build integration were updated. There is no indication this fixes or introduces a security vulnerability.
No security action required. Treat as normal build/maintenance refactor. If reviewing, verify that the new Python generator produces byte-for-byte identical DER output and that `make certs_check` passes in CI.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes two gen.sh scripts under core/embed/sec/optiga/unix/certs/ and core/embed/sec/secret/unix/certs/, and introduces core/tools/generate_certificates.py. The generated .h files now use a #define macro (OPTIGA_DEVICE_CERT_CHAIN / MCU_DEVICE_CERT) instead of static const unsigned char ..._der[] plus a length variable. The consuming C code (core/embed/sec/optiga/unix/optiga.c) was updated to use the new macro. The Makefile gained certs and certs_check targets. The DER byte content appears identical between old and new headers; only the C representation and generation tooling changed.
Changed components
core/embed/sec/optiga/unix/certs/T2B1.hcore/embed/sec/optiga/unix/certs/T3B1.hcore/embed/sec/optiga/unix/certs/T3T1.hcore/embed/sec/optiga/unix/certs/T3W1.hcore/embed/sec/optiga/unix/certs/gen.shcore/embed/sec/optiga/unix/optiga.ccore/embed/sec/secret/unix/certs/T3W1.hcore/embed/sec/secret/unix/certs/gen.shcore/tools/generate_certificates.pyMakefileInspect captured patch +436 / −353
diff --git a/Makefile b/Makefile
index 3f31072f..c6086f4f 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,7 @@
tropic_config tropic_config_check \
hsm_keys hsm_keys_check \
prodtest_error_codes prodtest_error_codes_check \
+ certs certs_check \
gen gen_check \
uvlock_check
@@ -233,9 +234,15 @@ prodtest_error_codes: ## generate prodtest error codes JSON
prodtest_error_codes_check: ## check prodtest error codes JSON is up to date
python3 core/tools/prodtest_error_codes.py --check
-gen: templates mocks icons protobuf vendorheader solana_templates bootloader_hashes lsgen tropic_config hsm_keys prodtest_error_codes ## regenerate auto-generated files from sources
+certs:
+ ./core/tools/generate_certificates.py
-gen_check: templates_check mocks_check icons_check protobuf_check vendorheader_check solana_templates_check bootloader_hashes_check lsgen_check tropic_config_check hsm_keys_check prodtest_error_codes_check ## check validity of auto-generated files
+certs_check:
+ ./core/tools/generate_certificates.py --check
+
+gen: templates mocks icons protobuf vendorheader solana_templates bootloader_hashes lsgen tropic_config hsm_keys prodtest_error_codes certs ## regenerate auto-generated files from sources
+
+gen_check: templates_check mocks_check icons_check protobuf_check vendorheader_check solana_templates_check bootloader_hashes_check lsgen_check tropic_config_check hsm_keys_check prodtest_error_codes_check certs_check ## check validity of auto-generated files
uvlock_check: ## check that uv.lock is up to date
@echo [UVLOCK-CHECK]
diff --git a/core/embed/sec/optiga/unix/certs/T2B1.h b/core/embed/sec/optiga/unix/certs/T2B1.h
index 2380fb25..0c5567b5 100644
--- a/core/embed/sec/optiga/unix/certs/T2B1.h
+++ b/core/embed/sec/optiga/unix/certs/T2B1.h
@@ -1,80 +1,83 @@
-// This file was generated via ./gen.sh
+// This file is auto-generated by `core/tools/generate_certificates.py`.
+// Do not edit this file directly. Instead, run `make gen` or `make certs`
+// in the root directory.
-static const unsigned char T2B1_der[] = {
- 0x30, 0x82, 0x01, 0x9f, 0x30, 0x82, 0x01, 0x45, 0xa0, 0x03, 0x02, 0x01,
- 0x02, 0x02, 0x04, 0x4e, 0xe2, 0xa5, 0x0f, 0x30, 0x0a, 0x06, 0x08, 0x2a,
- 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x4f, 0x31, 0x0b, 0x30,
- 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e,
- 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65,
- 0x7a, 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20,
- 0x73, 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03,
- 0x55, 0x04, 0x03, 0x0c, 0x17, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20,
- 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e,
- 0x67, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x32, 0x30, 0x34,
- 0x33, 0x30, 0x31, 0x34, 0x31, 0x36, 0x30, 0x31, 0x5a, 0x17, 0x0d, 0x34,
- 0x32, 0x30, 0x34, 0x33, 0x30, 0x31, 0x34, 0x31, 0x36, 0x30, 0x31, 0x5a,
- 0x30, 0x1d, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
- 0x12, 0x54, 0x32, 0x42, 0x31, 0x20, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72,
- 0x20, 0x53, 0x61, 0x66, 0x65, 0x20, 0x33, 0x30, 0x59, 0x30, 0x13, 0x06,
- 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86,
- 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x9b, 0xbf,
- 0x06, 0xda, 0xd9, 0xab, 0x59, 0x05, 0xe0, 0x54, 0x71, 0xce, 0x16, 0xd5,
- 0x22, 0x2c, 0x89, 0xc2, 0xca, 0xa3, 0x9f, 0x26, 0x26, 0x7a, 0xc0, 0x74,
- 0x71, 0x29, 0x88, 0x5f, 0xbd, 0x44, 0x1b, 0xcc, 0x7f, 0xa8, 0x4d, 0xe1,
- 0x20, 0xa3, 0x67, 0x55, 0xda, 0xf3, 0x0a, 0x6f, 0x47, 0xe8, 0xc0, 0xd4,
- 0xbd, 0xdc, 0x15, 0x03, 0x6e, 0xd2, 0xa3, 0x44, 0x7d, 0xfa, 0x7a, 0x1d,
- 0x3e, 0x88, 0xa3, 0x41, 0x30, 0x3f, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d,
- 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x00, 0x80, 0x30, 0x0c,
- 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00,
- 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80,
- 0x14, 0x67, 0xc5, 0xd4, 0xe7, 0xf0, 0x8f, 0x91, 0xb6, 0xe7, 0x48, 0xdf,
- 0x42, 0xbf, 0x9f, 0x74, 0x1f, 0x43, 0xd2, 0x73, 0x75, 0x30, 0x0a, 0x06,
- 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00,
- 0x30, 0x45, 0x02, 0x21, 0x00, 0xbe, 0x4c, 0x46, 0x8b, 0x7a, 0xdd, 0x75,
- 0x77, 0xc4, 0xd9, 0xa4, 0xa7, 0xf7, 0x82, 0x6d, 0xf5, 0x33, 0x0b, 0x50,
- 0x96, 0x51, 0xaf, 0x61, 0xc5, 0x76, 0xc1, 0xd0, 0x5e, 0x5e, 0x67, 0x8a,
- 0x4e, 0x02, 0x20, 0x40, 0xa7, 0xdd, 0x93, 0x83, 0xa8, 0x40, 0x24, 0xc4,
- 0xf9, 0xca, 0x89, 0xd9, 0x96, 0xa4, 0xf0, 0x1d, 0x7d, 0x8d, 0x37, 0xb5,
- 0x0b, 0x2b, 0x98, 0x3f, 0xcc, 0x48, 0xee, 0xa4, 0x15, 0x5e, 0x55, 0x30,
- 0x82, 0x01, 0xde, 0x30, 0x82, 0x01, 0x84, 0xa0, 0x03, 0x02, 0x01, 0x02,
- 0x02, 0x04, 0x48, 0xf1, 0xf6, 0xc5, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86,
- 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x54, 0x31, 0x0b, 0x30, 0x09,
- 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, 0x30,
- 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, 0x7a,
- 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, 0x73,
- 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55,
- 0x04, 0x03, 0x0c, 0x1c, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x4d,
- 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67,
- 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, 0x30, 0x20, 0x17, 0x0d,
- 0x32, 0x33, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
- 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x35, 0x33, 0x30, 0x31, 0x30, 0x31, 0x30,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x4f, 0x31, 0x0b, 0x30, 0x09,
- 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, 0x30,
- 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, 0x7a,
- 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, 0x73,
- 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55,
- 0x04, 0x03, 0x0c, 0x17, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x4d,
- 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67,
- 0x20, 0x43, 0x41, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48,
- 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03,
- 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xba, 0x60, 0x84, 0xcb, 0x9f, 0xba,
- 0x7c, 0x86, 0xd5, 0xd5, 0xa8, 0x61, 0x08, 0xa9, 0x1d, 0x55, 0xa2, 0x70,
- 0x56, 0xda, 0x4e, 0xab, 0xbe, 0xdd, 0xe8, 0x8a, 0x95, 0xe1, 0xca, 0xe8,
- 0xbc, 0xe3, 0x62, 0x08, 0x89, 0x16, 0x7a, 0xaf, 0x7f, 0x2d, 0xb1, 0x66,
- 0x99, 0x8f, 0x95, 0x09, 0x84, 0xaa, 0x19, 0x5e, 0x86, 0x8f, 0x96, 0xe2,
- 0x28, 0x03, 0xc3, 0xcd, 0x99, 0x1b, 0xe3, 0x1d, 0x39, 0xe7, 0xa3, 0x47,
- 0x30, 0x45, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff,
- 0x04, 0x04, 0x03, 0x02, 0x02, 0x04, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d,
- 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02,
- 0x01, 0x00, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30,
- 0x16, 0x80, 0x14, 0xc8, 0xb5, 0xb2, 0x43, 0xb3, 0x30, 0x43, 0xcc, 0x08,
- 0xb4, 0xdc, 0x3a, 0x72, 0xa1, 0xde, 0xcd, 0xcf, 0xd7, 0xea, 0xdb, 0x30,
- 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03,
- 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x02, 0xc1, 0x02, 0x0a, 0xb3, 0xc6,
- 0x4e, 0xd9, 0xe6, 0x58, 0xfd, 0xf8, 0x70, 0x93, 0x72, 0xc9, 0xe0, 0x53,
- 0x82, 0xde, 0x4e, 0x58, 0x75, 0x80, 0xc8, 0xba, 0xc4, 0x2f, 0x43, 0x78,
- 0x4a, 0xd9, 0x02, 0x21, 0x00, 0x99, 0x00, 0x98, 0x1c, 0xbc, 0x68, 0xae,
- 0xb0, 0x6d, 0x3e, 0xa9, 0x11, 0x94, 0x8d, 0x63, 0x11, 0xd6, 0xf6, 0x94,
- 0x40, 0x3a, 0xbb, 0xbb, 0x65, 0x9e, 0x5a, 0xf5, 0x2b, 0xf3, 0x2e, 0x33,
- 0xc4};
-static const unsigned int T2B1_der_len = 901;
+#define OPTIGA_DEVICE_CERT_CHAIN \
+ { \
+ 0x30, 0x82, 0x01, 0x9f, 0x30, 0x82, 0x01, 0x45, 0xa0, 0x03, 0x02, 0x01, \
+ 0x02, 0x02, 0x04, 0x4e, 0xe2, 0xa5, 0x0f, 0x30, 0x0a, 0x06, 0x08, 0x2a, \
+ 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x4f, 0x31, 0x0b, 0x30, \
+ 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, \
+ 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, \
+ 0x7a, 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, \
+ 0x73, 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, \
+ 0x55, 0x04, 0x03, 0x0c, 0x17, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, \
+ 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, \
+ 0x67, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x32, 0x30, 0x34, \
+ 0x33, 0x30, 0x31, 0x34, 0x31, 0x36, 0x30, 0x31, 0x5a, 0x17, 0x0d, 0x34, \
+ 0x32, 0x30, 0x34, 0x33, 0x30, 0x31, 0x34, 0x31, 0x36, 0x30, 0x31, 0x5a, \
+ 0x30, 0x1d, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, \
+ 0x12, 0x54, 0x32, 0x42, 0x31, 0x20, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, \
+ 0x20, 0x53, 0x61, 0x66, 0x65, 0x20, 0x33, 0x30, 0x59, 0x30, 0x13, 0x06, \
+ 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, \
+ 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x9b, 0xbf, \
+ 0x06, 0xda, 0xd9, 0xab, 0x59, 0x05, 0xe0, 0x54, 0x71, 0xce, 0x16, 0xd5, \
+ 0x22, 0x2c, 0x89, 0xc2, 0xca, 0xa3, 0x9f, 0x26, 0x26, 0x7a, 0xc0, 0x74, \
+ 0x71, 0x29, 0x88, 0x5f, 0xbd, 0x44, 0x1b, 0xcc, 0x7f, 0xa8, 0x4d, 0xe1, \
+ 0x20, 0xa3, 0x67, 0x55, 0xda, 0xf3, 0x0a, 0x6f, 0x47, 0xe8, 0xc0, 0xd4, \
+ 0xbd, 0xdc, 0x15, 0x03, 0x6e, 0xd2, 0xa3, 0x44, 0x7d, 0xfa, 0x7a, 0x1d, \
+ 0x3e, 0x88, 0xa3, 0x41, 0x30, 0x3f, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, \
+ 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x00, 0x80, 0x30, 0x0c, \
+ 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00, \
+ 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, \
+ 0x14, 0x67, 0xc5, 0xd4, 0xe7, 0xf0, 0x8f, 0x91, 0xb6, 0xe7, 0x48, 0xdf, \
+ 0x42, 0xbf, 0x9f, 0x74, 0x1f, 0x43, 0xd2, 0x73, 0x75, 0x30, 0x0a, 0x06, \
+ 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, \
+ 0x30, 0x45, 0x02, 0x21, 0x00, 0xbe, 0x4c, 0x46, 0x8b, 0x7a, 0xdd, 0x75, \
+ 0x77, 0xc4, 0xd9, 0xa4, 0xa7, 0xf7, 0x82, 0x6d, 0xf5, 0x33, 0x0b, 0x50, \
+ 0x96, 0x51, 0xaf, 0x61, 0xc5, 0x76, 0xc1, 0xd0, 0x5e, 0x5e, 0x67, 0x8a, \
+ 0x4e, 0x02, 0x20, 0x40, 0xa7, 0xdd, 0x93, 0x83, 0xa8, 0x40, 0x24, 0xc4, \
+ 0xf9, 0xca, 0x89, 0xd9, 0x96, 0xa4, 0xf0, 0x1d, 0x7d, 0x8d, 0x37, 0xb5, \
+ 0x0b, 0x2b, 0x98, 0x3f, 0xcc, 0x48, 0xee, 0xa4, 0x15, 0x5e, 0x55, 0x30, \
+ 0x82, 0x01, 0xde, 0x30, 0x82, 0x01, 0x84, 0xa0, 0x03, 0x02, 0x01, 0x02, \
+ 0x02, 0x04, 0x48, 0xf1, 0xf6, 0xc5, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, \
+ 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x54, 0x31, 0x0b, 0x30, 0x09, \
+ 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, 0x30, \
+ 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, 0x7a, \
+ 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, 0x73, \
+ 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, \
+ 0x04, 0x03, 0x0c, 0x1c, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x4d, \
+ 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67, \
+ 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, 0x30, 0x20, 0x17, 0x0d, \
+ 0x32, 0x33, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, \
+ 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x35, 0x33, 0x30, 0x31, 0x30, 0x31, 0x30, \
+ 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x4f, 0x31, 0x0b, 0x30, 0x09, \
+ 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, 0x30, \
+ 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, 0x7a, \
+ 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, 0x73, \
+ 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, \
+ 0x04, 0x03, 0x0c, 0x17, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x4d, \
+ 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67, \
+ 0x20, 0x43, 0x41, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, \
+ 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, \
+ 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xba, 0x60, 0x84, 0xcb, 0x9f, 0xba, \
+ 0x7c, 0x86, 0xd5, 0xd5, 0xa8, 0x61, 0x08, 0xa9, 0x1d, 0x55, 0xa2, 0x70, \
+ 0x56, 0xda, 0x4e, 0xab, 0xbe, 0xdd, 0xe8, 0x8a, 0x95, 0xe1, 0xca, 0xe8, \
+ 0xbc, 0xe3, 0x62, 0x08, 0x89, 0x16, 0x7a, 0xaf, 0x7f, 0x2d, 0xb1, 0x66, \
+ 0x99, 0x8f, 0x95, 0x09, 0x84, 0xaa, 0x19, 0x5e, 0x86, 0x8f, 0x96, 0xe2, \
+ 0x28, 0x03, 0xc3, 0xcd, 0x99, 0x1b, 0xe3, 0x1d, 0x39, 0xe7, 0xa3, 0x47, \
+ 0x30, 0x45, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, \
+ 0x04, 0x04, 0x03, 0x02, 0x02, 0x04, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, \
+ 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, \
+ 0x01, 0x00, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, \
+ 0x16, 0x80, 0x14, 0xc8, 0xb5, 0xb2, 0x43, 0xb3, 0x30, 0x43, 0xcc, 0x08, \
+ 0xb4, 0xdc, 0x3a, 0x72, 0xa1, 0xde, 0xcd, 0xcf, 0xd7, 0xea, 0xdb, 0x30, \
+ 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, \
+ 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x02, 0xc1, 0x02, 0x0a, 0xb3, 0xc6, \
+ 0x4e, 0xd9, 0xe6, 0x58, 0xfd, 0xf8, 0x70, 0x93, 0x72, 0xc9, 0xe0, 0x53, \
+ 0x82, 0xde, 0x4e, 0x58, 0x75, 0x80, 0xc8, 0xba, 0xc4, 0x2f, 0x43, 0x78, \
+ 0x4a, 0xd9, 0x02, 0x21, 0x00, 0x99, 0x00, 0x98, 0x1c, 0xbc, 0x68, 0xae, \
+ 0xb0, 0x6d, 0x3e, 0xa9, 0x11, 0x94, 0x8d, 0x63, 0x11, 0xd6, 0xf6, 0x94, \
+ 0x40, 0x3a, 0xbb, 0xbb, 0x65, 0x9e, 0x5a, 0xf5, 0x2b, 0xf3, 0x2e, 0x33, \
+ 0xc4, \
+ }
diff --git a/core/embed/sec/optiga/unix/certs/T3B1.h b/core/embed/sec/optiga/unix/certs/T3B1.h
index 775d44c1..4d7c5ee9 100644
--- a/core/embed/sec/optiga/unix/certs/T3B1.h
+++ b/core/embed/sec/optiga/unix/certs/T3B1.h
@@ -1,80 +1,83 @@
-// This file was generated via ./gen.sh
+// This file is auto-generated by `core/tools/generate_certificates.py`.
+// Do not edit this file directly. Instead, run `make gen` or `make certs`
+// in the root directory.
-static const unsigned char T3B1_der[] = {
- 0x30, 0x82, 0x01, 0xa3, 0x30, 0x82, 0x01, 0x49, 0xa0, 0x03, 0x02, 0x01,
- 0x02, 0x02, 0x04, 0x43, 0xd8, 0x69, 0x17, 0x30, 0x0a, 0x06, 0x08, 0x2a,
- 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x4f, 0x31, 0x0b, 0x30,
- 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e,
- 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65,
- 0x7a, 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20,
- 0x73, 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03,
- 0x55, 0x04, 0x03, 0x0c, 0x17, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20,
- 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e,
- 0x67, 0x20, 0x43, 0x41, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x35,
- 0x30, 0x34, 0x31, 0x34, 0x31, 0x32, 0x31, 0x38, 0x31, 0x33, 0x5a, 0x18,
- 0x0f, 0x32, 0x30, 0x35, 0x35, 0x30, 0x34, 0x30, 0x37, 0x31, 0x32, 0x31,
- 0x38, 0x31, 0x33, 0x5a, 0x30, 0x1d, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03,
- 0x55, 0x04, 0x03, 0x0c, 0x12, 0x54, 0x33, 0x42, 0x31, 0x20, 0x54, 0x72,
- 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x53, 0x61, 0x66, 0x65, 0x20, 0x33, 0x30,
- 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01,
- 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42,
- 0x00, 0x04, 0x9b, 0xbf, 0x06, 0xda, 0xd9, 0xab, 0x59, 0x05, 0xe0, 0x54,
- 0x71, 0xce, 0x16, 0xd5, 0x22, 0x2c, 0x89, 0xc2, 0xca, 0xa3, 0x9f, 0x26,
- 0x26, 0x7a, 0xc0, 0x74, 0x71, 0x29, 0x88, 0x5f, 0xbd, 0x44, 0x1b, 0xcc,
- 0x7f, 0xa8, 0x4d, 0xe1, 0x20, 0xa3, 0x67, 0x55, 0xda, 0xf3, 0x0a, 0x6f,
- 0x47, 0xe8, 0xc0, 0xd4, 0xbd, 0xdc, 0x15, 0x03, 0x6e, 0xd2, 0xa3, 0x44,
- 0x7d, 0xfa, 0x7a, 0x1d, 0x3e, 0x88, 0xa3, 0x41, 0x30, 0x3f, 0x30, 0x0e,
- 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02,
- 0x00, 0x80, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff,
- 0x04, 0x02, 0x30, 0x00, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04,
- 0x18, 0x30, 0x16, 0x80, 0x14, 0x6b, 0xd4, 0xf9, 0x69, 0x8b, 0xd1, 0xaa,
- 0xb1, 0xd7, 0x02, 0x50, 0x5a, 0x05, 0x58, 0x24, 0x08, 0x40, 0x16, 0xb5,
- 0xfc, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03,
- 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x5a, 0xc6, 0x35, 0x63,
- 0x24, 0xb6, 0x6c, 0x2e, 0x73, 0xc1, 0xb7, 0xa1, 0xa5, 0xea, 0xb0, 0x7a,
- 0x4e, 0xe6, 0x7b, 0x60, 0xea, 0x04, 0x2b, 0x57, 0x11, 0x66, 0x59, 0x6d,
- 0x3e, 0x54, 0x94, 0x2b, 0x02, 0x21, 0x00, 0xe1, 0x4d, 0x9d, 0xcd, 0xd9,
- 0x97, 0xc9, 0x86, 0xcb, 0xd8, 0xbe, 0x22, 0x50, 0xf9, 0x8c, 0xfe, 0xf2,
- 0xaf, 0x12, 0xa2, 0xe8, 0x6e, 0x69, 0x95, 0xad, 0x09, 0x85, 0x77, 0xe9,
- 0x70, 0x84, 0xc9, 0x30, 0x82, 0x01, 0xe1, 0x30, 0x82, 0x01, 0x88, 0xa0,
- 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x67, 0xfc, 0xfd, 0x25, 0x78, 0x25,
- 0xb1, 0x8f, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04,
- 0x03, 0x02, 0x30, 0x54, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
- 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55,
- 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x43,
- 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, 0x73, 0x2e, 0x72, 0x2e, 0x6f,
- 0x2e, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1c,
- 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x66,
- 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x52, 0x6f, 0x6f,
- 0x74, 0x20, 0x43, 0x41, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x35, 0x30, 0x34,
- 0x31, 0x34, 0x31, 0x32, 0x31, 0x38, 0x34, 0x36, 0x5a, 0x18, 0x0f, 0x32,
- 0x30, 0x35, 0x35, 0x30, 0x34, 0x31, 0x34, 0x31, 0x32, 0x31, 0x38, 0x34,
- 0x36, 0x5a, 0x30, 0x4f, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
- 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55,
- 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x43,
- 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, 0x73, 0x2e, 0x72, 0x2e, 0x6f,
- 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x17,
- 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x66,
- 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x41, 0x30,
- 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01,
- 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42,
- 0x00, 0x04, 0x10, 0xa6, 0xbc, 0x4f, 0x9e, 0xb5, 0x2f, 0xd4, 0x50, 0xbe,
- 0x2c, 0x36, 0x51, 0x89, 0xea, 0x6a, 0x52, 0x3f, 0xdd, 0xdd, 0x62, 0xe4,
- 0x45, 0x66, 0xdc, 0x34, 0x9a, 0x8c, 0x7f, 0x81, 0x31, 0x44, 0xcd, 0xe8,
- 0x1c, 0x8c, 0x10, 0x6b, 0x74, 0xbf, 0xce, 0xae, 0x9c, 0x8c, 0xa5, 0x20,
- 0x2a, 0xf6, 0x35, 0xce, 0x1a, 0x53, 0x30, 0xc4, 0x1c, 0x70, 0x8e, 0xbb,
- 0xf5, 0x05, 0xe0, 0x25, 0xc3, 0x39, 0xa3, 0x47, 0x30, 0x45, 0x30, 0x0e,
- 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02,
- 0x02, 0x04, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff,
- 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x00, 0x30, 0x1f,
- 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xc8,
- 0xb5, 0xb2, 0x43, 0xb3, 0x30, 0x43, 0xcc, 0x08, 0xb4, 0xdc, 0x3a, 0x72,
- 0xa1, 0xde, 0xcd, 0xcf, 0xd7, 0xea, 0xdb, 0x30, 0x0a, 0x06, 0x08, 0x2a,
- 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x47, 0x00, 0x30, 0x44,
- 0x02, 0x20, 0x5a, 0xab, 0xde, 0x49, 0xac, 0xe0, 0x13, 0x60, 0x17, 0xef,
- 0x28, 0x68, 0xfc, 0x99, 0x55, 0xf8, 0xd2, 0x3d, 0x00, 0xf9, 0x68, 0x42,
- 0xf2, 0x28, 0x74, 0xa4, 0x7c, 0x68, 0x33, 0x3a, 0x0f, 0xc7, 0x02, 0x20,
- 0x01, 0x2a, 0x32, 0x12, 0xb9, 0x0c, 0x99, 0x6c, 0x8c, 0x8c, 0xa3, 0xfb,
- 0x22, 0x0e, 0x6e, 0xf7, 0x4c, 0x80, 0x84, 0xf9, 0x56, 0x3f, 0x95, 0x86,
- 0xc9, 0xd5, 0xb5, 0xcb, 0xee, 0x67, 0x3a, 0x1c};
-static const unsigned int T3B1_der_len = 908;
+#define OPTIGA_DEVICE_CERT_CHAIN \
+ { \
+ 0x30, 0x82, 0x01, 0xa3, 0x30, 0x82, 0x01, 0x49, 0xa0, 0x03, 0x02, 0x01, \
+ 0x02, 0x02, 0x04, 0x43, 0xd8, 0x69, 0x17, 0x30, 0x0a, 0x06, 0x08, 0x2a, \
+ 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x4f, 0x31, 0x0b, 0x30, \
+ 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, \
+ 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, \
+ 0x7a, 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, \
+ 0x73, 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, \
+ 0x55, 0x04, 0x03, 0x0c, 0x17, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, \
+ 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, \
+ 0x67, 0x20, 0x43, 0x41, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x35, \
+ 0x30, 0x34, 0x31, 0x34, 0x31, 0x32, 0x31, 0x38, 0x31, 0x33, 0x5a, 0x18, \
+ 0x0f, 0x32, 0x30, 0x35, 0x35, 0x30, 0x34, 0x30, 0x37, 0x31, 0x32, 0x31, \
+ 0x38, 0x31, 0x33, 0x5a, 0x30, 0x1d, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, \
+ 0x55, 0x04, 0x03, 0x0c, 0x12, 0x54, 0x33, 0x42, 0x31, 0x20, 0x54, 0x72, \
+ 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x53, 0x61, 0x66, 0x65, 0x20, 0x33, 0x30, \
+ 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, \
+ 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, \
+ 0x00, 0x04, 0x9b, 0xbf, 0x06, 0xda, 0xd9, 0xab, 0x59, 0x05, 0xe0, 0x54, \
+ 0x71, 0xce, 0x16, 0xd5, 0x22, 0x2c, 0x89, 0xc2, 0xca, 0xa3, 0x9f, 0x26, \
+ 0x26, 0x7a, 0xc0, 0x74, 0x71, 0x29, 0x88, 0x5f, 0xbd, 0x44, 0x1b, 0xcc, \
+ 0x7f, 0xa8, 0x4d, 0xe1, 0x20, 0xa3, 0x67, 0x55, 0xda, 0xf3, 0x0a, 0x6f, \
+ 0x47, 0xe8, 0xc0, 0xd4, 0xbd, 0xdc, 0x15, 0x03, 0x6e, 0xd2, 0xa3, 0x44, \
+ 0x7d, 0xfa, 0x7a, 0x1d, 0x3e, 0x88, 0xa3, 0x41, 0x30, 0x3f, 0x30, 0x0e, \
+ 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, \
+ 0x00, 0x80, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, \
+ 0x04, 0x02, 0x30, 0x00, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, \
+ 0x18, 0x30, 0x16, 0x80, 0x14, 0x6b, 0xd4, 0xf9, 0x69, 0x8b, 0xd1, 0xaa, \
+ 0xb1, 0xd7, 0x02, 0x50, 0x5a, 0x05, 0x58, 0x24, 0x08, 0x40, 0x16, 0xb5, \
+ 0xfc, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, \
+ 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x5a, 0xc6, 0x35, 0x63, \
+ 0x24, 0xb6, 0x6c, 0x2e, 0x73, 0xc1, 0xb7, 0xa1, 0xa5, 0xea, 0xb0, 0x7a, \
+ 0x4e, 0xe6, 0x7b, 0x60, 0xea, 0x04, 0x2b, 0x57, 0x11, 0x66, 0x59, 0x6d, \
+ 0x3e, 0x54, 0x94, 0x2b, 0x02, 0x21, 0x00, 0xe1, 0x4d, 0x9d, 0xcd, 0xd9, \
+ 0x97, 0xc9, 0x86, 0xcb, 0xd8, 0xbe, 0x22, 0x50, 0xf9, 0x8c, 0xfe, 0xf2, \
+ 0xaf, 0x12, 0xa2, 0xe8, 0x6e, 0x69, 0x95, 0xad, 0x09, 0x85, 0x77, 0xe9, \
+ 0x70, 0x84, 0xc9, 0x30, 0x82, 0x01, 0xe1, 0x30, 0x82, 0x01, 0x88, 0xa0, \
+ 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x67, 0xfc, 0xfd, 0x25, 0x78, 0x25, \
+ 0xb1, 0x8f, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, \
+ 0x03, 0x02, 0x30, 0x54, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \
+ 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, \
+ 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x43, \
+ 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, 0x73, 0x2e, 0x72, 0x2e, 0x6f, \
+ 0x2e, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1c, \
+ 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x66, \
+ 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x52, 0x6f, 0x6f, \
+ 0x74, 0x20, 0x43, 0x41, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x35, 0x30, 0x34, \
+ 0x31, 0x34, 0x31, 0x32, 0x31, 0x38, 0x34, 0x36, 0x5a, 0x18, 0x0f, 0x32, \
+ 0x30, 0x35, 0x35, 0x30, 0x34, 0x31, 0x34, 0x31, 0x32, 0x31, 0x38, 0x34, \
+ 0x36, 0x5a, 0x30, 0x4f, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \
+ 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, \
+ 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x43, \
+ 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, 0x73, 0x2e, 0x72, 0x2e, 0x6f, \
+ 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x17, \
+ 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x66, \
+ 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x41, 0x30, \
+ 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, \
+ 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, \
+ 0x00, 0x04, 0x10, 0xa6, 0xbc, 0x4f, 0x9e, 0xb5, 0x2f, 0xd4, 0x50, 0xbe, \
+ 0x2c, 0x36, 0x51, 0x89, 0xea, 0x6a, 0x52, 0x3f, 0xdd, 0xdd, 0x62, 0xe4, \
+ 0x45, 0x66, 0xdc, 0x34, 0x9a, 0x8c, 0x7f, 0x81, 0x31, 0x44, 0xcd, 0xe8, \
+ 0x1c, 0x8c, 0x10, 0x6b, 0x74, 0xbf, 0xce, 0xae, 0x9c, 0x8c, 0xa5, 0x20, \
+ 0x2a, 0xf6, 0x35, 0xce, 0x1a, 0x53, 0x30, 0xc4, 0x1c, 0x70, 0x8e, 0xbb, \
+ 0xf5, 0x05, 0xe0, 0x25, 0xc3, 0x39, 0xa3, 0x47, 0x30, 0x45, 0x30, 0x0e, \
+ 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, \
+ 0x02, 0x04, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, \
+ 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x00, 0x30, 0x1f, \
+ 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xc8, \
+ 0xb5, 0xb2, 0x43, 0xb3, 0x30, 0x43, 0xcc, 0x08, 0xb4, 0xdc, 0x3a, 0x72, \
+ 0xa1, 0xde, 0xcd, 0xcf, 0xd7, 0xea, 0xdb, 0x30, 0x0a, 0x06, 0x08, 0x2a, \
+ 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x47, 0x00, 0x30, 0x44, \
+ 0x02, 0x20, 0x5a, 0xab, 0xde, 0x49, 0xac, 0xe0, 0x13, 0x60, 0x17, 0xef, \
+ 0x28, 0x68, 0xfc, 0x99, 0x55, 0xf8, 0xd2, 0x3d, 0x00, 0xf9, 0x68, 0x42, \
+ 0xf2, 0x28, 0x74, 0xa4, 0x7c, 0x68, 0x33, 0x3a, 0x0f, 0xc7, 0x02, 0x20, \
+ 0x01, 0x2a, 0x32, 0x12, 0xb9, 0x0c, 0x99, 0x6c, 0x8c, 0x8c, 0xa3, 0xfb, \
+ 0x22, 0x0e, 0x6e, 0xf7, 0x4c, 0x80, 0x84, 0xf9, 0x56, 0x3f, 0x95, 0x86, \
+ 0xc9, 0xd5, 0xb5, 0xcb, 0xee, 0x67, 0x3a, 0x1c, \
+ }
diff --git a/core/embed/sec/optiga/unix/certs/T3T1.h b/core/embed/sec/optiga/unix/certs/T3T1.h
index bd1eb7a9..88405a16 100644
--- a/core/embed/sec/optiga/unix/certs/T3T1.h
+++ b/core/embed/sec/optiga/unix/certs/T3T1.h
@@ -1,80 +1,83 @@
-// This file was generated via ./gen.sh
+// This file is auto-generated by `core/tools/generate_certificates.py`.
+// Do not edit this file directly. Instead, run `make gen` or `make certs`
+// in the root directory.
-static const unsigned char T3T1_der[] = {
- 0x30, 0x82, 0x01, 0x9f, 0x30, 0x82, 0x01, 0x45, 0xa0, 0x03, 0x02, 0x01,
- 0x02, 0x02, 0x04, 0x01, 0xbf, 0xf0, 0xa4, 0x30, 0x0a, 0x06, 0x08, 0x2a,
- 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x4f, 0x31, 0x0b, 0x30,
- 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e,
- 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65,
- 0x7a, 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20,
- 0x73, 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03,
- 0x55, 0x04, 0x03, 0x0c, 0x17, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20,
- 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e,
- 0x67, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x32, 0x30, 0x35,
- 0x32, 0x34, 0x30, 0x36, 0x34, 0x31, 0x31, 0x38, 0x5a, 0x17, 0x0d, 0x34,
- 0x32, 0x30, 0x35, 0x32, 0x34, 0x30, 0x36, 0x34, 0x31, 0x31, 0x38, 0x5a,
- 0x30, 0x1d, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
- 0x12, 0x54, 0x33, 0x54, 0x31, 0x20, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72,
- 0x20, 0x53, 0x61, 0x66, 0x65, 0x20, 0x35, 0x30, 0x59, 0x30, 0x13, 0x06,
- 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86,
- 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x9b, 0xbf,
- 0x06, 0xda, 0xd9, 0xab, 0x59, 0x05, 0xe0, 0x54, 0x71, 0xce, 0x16, 0xd5,
- 0x22, 0x2c, 0x89, 0xc2, 0xca, 0xa3, 0x9f, 0x26, 0x26, 0x7a, 0xc0, 0x74,
- 0x71, 0x29, 0x88, 0x5f, 0xbd, 0x44, 0x1b, 0xcc, 0x7f, 0xa8, 0x4d, 0xe1,
- 0x20, 0xa3, 0x67, 0x55, 0xda, 0xf3, 0x0a, 0x6f, 0x47, 0xe8, 0xc0, 0xd4,
- 0xbd, 0xdc, 0x15, 0x03, 0x6e, 0xd2, 0xa3, 0x44, 0x7d, 0xfa, 0x7a, 0x1d,
- 0x3e, 0x88, 0xa3, 0x41, 0x30, 0x3f, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d,
- 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x00, 0x80, 0x30, 0x0c,
- 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00,
- 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80,
- 0x14, 0x7d, 0xee, 0x76, 0xc3, 0xb3, 0x0f, 0xdf, 0x0e, 0x8d, 0x3b, 0x52,
- 0x67, 0x5d, 0xf2, 0x31, 0x89, 0xe7, 0xb9, 0x2b, 0xa4, 0x30, 0x0a, 0x06,
- 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00,
- 0x30, 0x45, 0x02, 0x21, 0x00, 0xdd, 0xac, 0x37, 0x5e, 0xe2, 0x5e, 0xc0,
- 0x2f, 0x49, 0xcb, 0x14, 0x45, 0xfc, 0xfa, 0xe5, 0x5b, 0xce, 0x8b, 0x36,
- 0x56, 0x4e, 0x53, 0x75, 0xb5, 0x81, 0x75, 0xf0, 0xb4, 0x33, 0x9a, 0x94,
- 0xef, 0x02, 0x20, 0x2a, 0xfc, 0xa5, 0xd3, 0x7d, 0x8f, 0x20, 0xd6, 0xbc,
- 0xbd, 0x60, 0x69, 0x00, 0x08, 0x5e, 0xa2, 0xb2, 0xba, 0xb4, 0x14, 0x2b,
- 0xff, 0x21, 0xc7, 0x34, 0xa5, 0xd5, 0x91, 0xff, 0x80, 0xda, 0x6b, 0x30,
- 0x82, 0x01, 0xe3, 0x30, 0x82, 0x01, 0x88, 0xa0, 0x03, 0x02, 0x01, 0x02,
- 0x02, 0x08, 0x65, 0xf1, 0xaa, 0x48, 0x40, 0x84, 0x7a, 0xe6, 0x30, 0x0a,
- 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x54,
- 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43,
- 0x5a, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15,
- 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61,
- 0x6e, 0x79, 0x20, 0x73, 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x25, 0x30,
- 0x23, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1c, 0x54, 0x72, 0x65, 0x7a,
- 0x6f, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75,
- 0x72, 0x69, 0x6e, 0x67, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41,
- 0x30, 0x20, 0x17, 0x0d, 0x32, 0x34, 0x30, 0x33, 0x31, 0x33, 0x31, 0x33,
- 0x32, 0x39, 0x34, 0x34, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x35, 0x34, 0x30,
- 0x33, 0x30, 0x36, 0x31, 0x33, 0x32, 0x39, 0x34, 0x34, 0x5a, 0x30, 0x4f,
- 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43,
- 0x5a, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15,
- 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61,
- 0x6e, 0x79, 0x20, 0x73, 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x20, 0x30,
- 0x1e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x17, 0x54, 0x72, 0x65, 0x7a,
- 0x6f, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75,
- 0x72, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x41, 0x30, 0x59, 0x30, 0x13, 0x06,
- 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86,
- 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x82, 0x9e,
- 0x89, 0x65, 0x01, 0x8f, 0xeb, 0x54, 0x2e, 0x92, 0x36, 0xc9, 0xb2, 0xce,
- 0x08, 0xf8, 0x64, 0xa5, 0x5e, 0xd9, 0x18, 0x3d, 0x02, 0x59, 0x56, 0x4f,
- 0x0e, 0x05, 0x34, 0x5b, 0x04, 0x67, 0x6a, 0x0b, 0xef, 0x36, 0xc5, 0x9d,
- 0x21, 0xd3, 0xc2, 0x48, 0x68, 0xb5, 0x60, 0x1f, 0x0b, 0x11, 0x93, 0xa6,
- 0xbf, 0xcf, 0x6d, 0x81, 0x4e, 0x1c, 0xfb, 0x79, 0xc2, 0x25, 0x6a, 0x05,
- 0xe9, 0x53, 0xa3, 0x47, 0x30, 0x45, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d,
- 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x02, 0x04, 0x30, 0x12,
- 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30, 0x06,
- 0x01, 0x01, 0xff, 0x02, 0x01, 0x00, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d,
- 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xce, 0x0a, 0xf2, 0x0f, 0xab,
- 0x8a, 0xb8, 0xa0, 0xb1, 0x5d, 0x62, 0x15, 0xbd, 0x67, 0x2d, 0xeb, 0x8c,
- 0x8d, 0x63, 0x4f, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
- 0x04, 0x03, 0x02, 0x03, 0x49, 0x00, 0x30, 0x46, 0x02, 0x21, 0x00, 0xde,
- 0x59, 0xce, 0x16, 0xba, 0xb9, 0x5f, 0xd7, 0xf9, 0xde, 0xe1, 0x75, 0x3e,
- 0x97, 0x6b, 0x67, 0x65, 0xaa, 0x26, 0x85, 0x52, 0x0e, 0x84, 0xc3, 0xbe,
- 0x7e, 0x08, 0x9e, 0x38, 0x61, 0x5c, 0x81, 0x02, 0x21, 0x00, 0xf8, 0x9b,
- 0xee, 0x7e, 0xd4, 0x8f, 0x5d, 0x71, 0x2b, 0xff, 0x38, 0x5c, 0xa6, 0xd7,
- 0x7a, 0xe3, 0xa4, 0x6e, 0x61, 0xcf, 0x62, 0xff, 0x2e, 0xff, 0x7d, 0x06,
- 0x9a, 0x23, 0x56, 0x4d, 0x4a, 0x27};
-static const unsigned int T3T1_der_len = 906;
+#define OPTIGA_DEVICE_CERT_CHAIN \
+ { \
+ 0x30, 0x82, 0x01, 0x9f, 0x30, 0x82, 0x01, 0x45, 0xa0, 0x03, 0x02, 0x01, \
+ 0x02, 0x02, 0x04, 0x01, 0xbf, 0xf0, 0xa4, 0x30, 0x0a, 0x06, 0x08, 0x2a, \
+ 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x4f, 0x31, 0x0b, 0x30, \
+ 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, \
+ 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, \
+ 0x7a, 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, \
+ 0x73, 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, \
+ 0x55, 0x04, 0x03, 0x0c, 0x17, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, \
+ 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, \
+ 0x67, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x32, 0x30, 0x35, \
+ 0x32, 0x34, 0x30, 0x36, 0x34, 0x31, 0x31, 0x38, 0x5a, 0x17, 0x0d, 0x34, \
+ 0x32, 0x30, 0x35, 0x32, 0x34, 0x30, 0x36, 0x34, 0x31, 0x31, 0x38, 0x5a, \
+ 0x30, 0x1d, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, \
+ 0x12, 0x54, 0x33, 0x54, 0x31, 0x20, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, \
+ 0x20, 0x53, 0x61, 0x66, 0x65, 0x20, 0x35, 0x30, 0x59, 0x30, 0x13, 0x06, \
+ 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, \
+ 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x9b, 0xbf, \
+ 0x06, 0xda, 0xd9, 0xab, 0x59, 0x05, 0xe0, 0x54, 0x71, 0xce, 0x16, 0xd5, \
+ 0x22, 0x2c, 0x89, 0xc2, 0xca, 0xa3, 0x9f, 0x26, 0x26, 0x7a, 0xc0, 0x74, \
+ 0x71, 0x29, 0x88, 0x5f, 0xbd, 0x44, 0x1b, 0xcc, 0x7f, 0xa8, 0x4d, 0xe1, \
+ 0x20, 0xa3, 0x67, 0x55, 0xda, 0xf3, 0x0a, 0x6f, 0x47, 0xe8, 0xc0, 0xd4, \
+ 0xbd, 0xdc, 0x15, 0x03, 0x6e, 0xd2, 0xa3, 0x44, 0x7d, 0xfa, 0x7a, 0x1d, \
+ 0x3e, 0x88, 0xa3, 0x41, 0x30, 0x3f, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, \
+ 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x00, 0x80, 0x30, 0x0c, \
+ 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00, \
+ 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, \
+ 0x14, 0x7d, 0xee, 0x76, 0xc3, 0xb3, 0x0f, 0xdf, 0x0e, 0x8d, 0x3b, 0x52, \
+ 0x67, 0x5d, 0xf2, 0x31, 0x89, 0xe7, 0xb9, 0x2b, 0xa4, 0x30, 0x0a, 0x06, \
+ 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, \
+ 0x30, 0x45, 0x02, 0x21, 0x00, 0xdd, 0xac, 0x37, 0x5e, 0xe2, 0x5e, 0xc0, \
+ 0x2f, 0x49, 0xcb, 0x14, 0x45, 0xfc, 0xfa, 0xe5, 0x5b, 0xce, 0x8b, 0x36, \
+ 0x56, 0x4e, 0x53, 0x75, 0xb5, 0x81, 0x75, 0xf0, 0xb4, 0x33, 0x9a, 0x94, \
+ 0xef, 0x02, 0x20, 0x2a, 0xfc, 0xa5, 0xd3, 0x7d, 0x8f, 0x20, 0xd6, 0xbc, \
+ 0xbd, 0x60, 0x69, 0x00, 0x08, 0x5e, 0xa2, 0xb2, 0xba, 0xb4, 0x14, 0x2b, \
+ 0xff, 0x21, 0xc7, 0x34, 0xa5, 0xd5, 0x91, 0xff, 0x80, 0xda, 0x6b, 0x30, \
+ 0x82, 0x01, 0xe3, 0x30, 0x82, 0x01, 0x88, 0xa0, 0x03, 0x02, 0x01, 0x02, \
+ 0x02, 0x08, 0x65, 0xf1, 0xaa, 0x48, 0x40, 0x84, 0x7a, 0xe6, 0x30, 0x0a, \
+ 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x54, \
+ 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, \
+ 0x5a, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, \
+ 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, \
+ 0x6e, 0x79, 0x20, 0x73, 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x25, 0x30, \
+ 0x23, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1c, 0x54, 0x72, 0x65, 0x7a, \
+ 0x6f, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, \
+ 0x72, 0x69, 0x6e, 0x67, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, \
+ 0x30, 0x20, 0x17, 0x0d, 0x32, 0x34, 0x30, 0x33, 0x31, 0x33, 0x31, 0x33, \
+ 0x32, 0x39, 0x34, 0x34, 0x5a, 0x18, 0x0f, 0x32, 0x30, 0x35, 0x34, 0x30, \
+ 0x33, 0x30, 0x36, 0x31, 0x33, 0x32, 0x39, 0x34, 0x34, 0x5a, 0x30, 0x4f, \
+ 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, \
+ 0x5a, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, \
+ 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, \
+ 0x6e, 0x79, 0x20, 0x73, 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x20, 0x30, \
+ 0x1e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x17, 0x54, 0x72, 0x65, 0x7a, \
+ 0x6f, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, \
+ 0x72, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x41, 0x30, 0x59, 0x30, 0x13, 0x06, \
+ 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, \
+ 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x82, 0x9e, \
+ 0x89, 0x65, 0x01, 0x8f, 0xeb, 0x54, 0x2e, 0x92, 0x36, 0xc9, 0xb2, 0xce, \
+ 0x08, 0xf8, 0x64, 0xa5, 0x5e, 0xd9, 0x18, 0x3d, 0x02, 0x59, 0x56, 0x4f, \
+ 0x0e, 0x05, 0x34, 0x5b, 0x04, 0x67, 0x6a, 0x0b, 0xef, 0x36, 0xc5, 0x9d, \
+ 0x21, 0xd3, 0xc2, 0x48, 0x68, 0xb5, 0x60, 0x1f, 0x0b, 0x11, 0x93, 0xa6, \
+ 0xbf, 0xcf, 0x6d, 0x81, 0x4e, 0x1c, 0xfb, 0x79, 0xc2, 0x25, 0x6a, 0x05, \
+ 0xe9, 0x53, 0xa3, 0x47, 0x30, 0x45, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, \
+ 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x02, 0x04, 0x30, 0x12, \
+ 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30, 0x06, \
+ 0x01, 0x01, 0xff, 0x02, 0x01, 0x00, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, \
+ 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xce, 0x0a, 0xf2, 0x0f, 0xab, \
+ 0x8a, 0xb8, 0xa0, 0xb1, 0x5d, 0x62, 0x15, 0xbd, 0x67, 0x2d, 0xeb, 0x8c, \
+ 0x8d, 0x63, 0x4f, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, \
+ 0x04, 0x03, 0x02, 0x03, 0x49, 0x00, 0x30, 0x46, 0x02, 0x21, 0x00, 0xde, \
+ 0x59, 0xce, 0x16, 0xba, 0xb9, 0x5f, 0xd7, 0xf9, 0xde, 0xe1, 0x75, 0x3e, \
+ 0x97, 0x6b, 0x67, 0x65, 0xaa, 0x26, 0x85, 0x52, 0x0e, 0x84, 0xc3, 0xbe, \
+ 0x7e, 0x08, 0x9e, 0x38, 0x61, 0x5c, 0x81, 0x02, 0x21, 0x00, 0xf8, 0x9b, \
+ 0xee, 0x7e, 0xd4, 0x8f, 0x5d, 0x71, 0x2b, 0xff, 0x38, 0x5c, 0xa6, 0xd7, \
+ 0x7a, 0xe3, 0xa4, 0x6e, 0x61, 0xcf, 0x62, 0xff, 0x2e, 0xff, 0x7d, 0x06, \
+ 0x9a, 0x23, 0x56, 0x4d, 0x4a, 0x27, \
+ }
diff --git a/core/embed/sec/optiga/unix/certs/T3W1.h b/core/embed/sec/optiga/unix/certs/T3W1.h
index 73c12071..9e433cdd 100644
--- a/core/embed/sec/optiga/unix/certs/T3W1.h
+++ b/core/embed/sec/optiga/unix/certs/T3W1.h
@@ -1,80 +1,83 @@
-// This file was generated via ./gen.sh
+// This file is auto-generated by `core/tools/generate_certificates.py`.
+// Do not edit this file directly. Instead, run `make gen` or `make certs`
+// in the root directory.
-static const unsigned char T3W1_der[] = {
- 0x30, 0x82, 0x01, 0xa3, 0x30, 0x82, 0x01, 0x49, 0xa0, 0x03, 0x02, 0x01,
- 0x02, 0x02, 0x04, 0x21, 0xa6, 0x48, 0xa1, 0x30, 0x0a, 0x06, 0x08, 0x2a,
- 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x4f, 0x31, 0x0b, 0x30,
- 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e,
- 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65,
- 0x7a, 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20,
- 0x73, 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03,
- 0x55, 0x04, 0x03, 0x0c, 0x17, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20,
- 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e,
- 0x67, 0x20, 0x43, 0x41, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x35,
- 0x30, 0x34, 0x31, 0x30, 0x31, 0x31, 0x34, 0x30, 0x35, 0x30, 0x5a, 0x18,
- 0x0f, 0x32, 0x30, 0x35, 0x35, 0x30, 0x34, 0x30, 0x33, 0x31, 0x31, 0x34,
- 0x30, 0x35, 0x30, 0x5a, 0x30, 0x1d, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03,
- 0x55, 0x04, 0x03, 0x0c, 0x12, 0x54, 0x33, 0x57, 0x31, 0x20, 0x54, 0x72,
- 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x53, 0x61, 0x66, 0x65, 0x20, 0x37, 0x30,
- 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01,
- 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42,
- 0x00, 0x04, 0x9b, 0xbf, 0x06, 0xda, 0xd9, 0xab, 0x59, 0x05, 0xe0, 0x54,
- 0x71, 0xce, 0x16, 0xd5, 0x22, 0x2c, 0x89, 0xc2, 0xca, 0xa3, 0x9f, 0x26,
- 0x26, 0x7a, 0xc0, 0x74, 0x71, 0x29, 0x88, 0x5f, 0xbd, 0x44, 0x1b, 0xcc,
- 0x7f, 0xa8, 0x4d, 0xe1, 0x20, 0xa3, 0x67, 0x55, 0xda, 0xf3, 0x0a, 0x6f,
- 0x47, 0xe8, 0xc0, 0xd4, 0xbd, 0xdc, 0x15, 0x03, 0x6e, 0xd2, 0xa3, 0x44,
- 0x7d, 0xfa, 0x7a, 0x1d, 0x3e, 0x88, 0xa3, 0x41, 0x30, 0x3f, 0x30, 0x0e,
- 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02,
- 0x00, 0x80, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff,
- 0x04, 0x02, 0x30, 0x00, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04,
- 0x18, 0x30, 0x16, 0x80, 0x14, 0x93, 0xe0, 0xf9, 0x2e, 0x12, 0x66, 0x94,
- 0xaf, 0xf3, 0x7f, 0x70, 0xb5, 0xbb, 0xf4, 0x69, 0x57, 0xcb, 0xbe, 0xe2,
- 0xcb, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03,
- 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x21, 0x00, 0xab, 0x04, 0x22,
- 0x1e, 0xba, 0x8c, 0x64, 0x71, 0xee, 0x5a, 0xbc, 0x76, 0xfe, 0x84, 0x93,
- 0x94, 0xac, 0xdc, 0x6a, 0x5e, 0xa5, 0x32, 0x65, 0xd5, 0x6e, 0x74, 0x41,
- 0x30, 0x0c, 0xdd, 0xba, 0xe7, 0x02, 0x20, 0x38, 0x35, 0x75, 0x58, 0x6d,
- 0x63, 0x7b, 0xd6, 0x12, 0xcb, 0x16, 0x5d, 0x3f, 0xae, 0x7d, 0x6c, 0xda,
- 0xba, 0x09, 0x1d, 0x31, 0x9d, 0x45, 0x9c, 0x60, 0x7e, 0xaa, 0x1a, 0x18,
- 0x8f, 0x8c, 0xcc, 0x30, 0x82, 0x01, 0xe2, 0x30, 0x82, 0x01, 0x88, 0xa0,
- 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x67, 0xf7, 0xad, 0xbe, 0x2c, 0x29,
- 0x29, 0xdc, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04,
- 0x03, 0x02, 0x30, 0x54, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
- 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55,
- 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x43,
- 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, 0x73, 0x2e, 0x72, 0x2e, 0x6f,
- 0x2e, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1c,
- 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x66,
- 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x52, 0x6f, 0x6f,
- 0x74, 0x20, 0x43, 0x41, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x35, 0x30, 0x34,
- 0x31, 0x30, 0x31, 0x31, 0x33, 0x38, 0x33, 0x38, 0x5a, 0x18, 0x0f, 0x32,
- 0x30, 0x35, 0x35, 0x30, 0x34, 0x31, 0x30, 0x31, 0x31, 0x33, 0x38, 0x33,
- 0x38, 0x5a, 0x30, 0x4f, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
- 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55,
- 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x43,
- 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, 0x73, 0x2e, 0x72, 0x2e, 0x6f,
- 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x17,
- 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x66,
- 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x41, 0x30,
- 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01,
- 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42,
- 0x00, 0x04, 0xa5, 0xd7, 0x01, 0xfc, 0xed, 0x9b, 0x5a, 0x2c, 0xd0, 0x76,
- 0xa0, 0x2d, 0x8a, 0x98, 0xe7, 0x79, 0xc5, 0x49, 0x46, 0xee, 0xfc, 0x7b,
- 0x25, 0x25, 0xfa, 0xc7, 0x82, 0xfa, 0x3d, 0x65, 0xb5, 0xd9, 0xe6, 0xa8,
- 0xc9, 0x09, 0x46, 0xbd, 0x30, 0xb3, 0x5d, 0xfe, 0xec, 0x34, 0xa0, 0x53,
- 0xf1, 0x10, 0x6b, 0xa1, 0x30, 0xa8, 0x47, 0x20, 0x37, 0xf2, 0xdb, 0x8c,
- 0xf2, 0xc4, 0xb3, 0xb6, 0xe9, 0x3a, 0xa3, 0x47, 0x30, 0x45, 0x30, 0x0e,
- 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02,
- 0x02, 0x04, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff,
- 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x00, 0x30, 0x1f,
- 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x37,
- 0x41, 0x8f, 0x47, 0xc1, 0x47, 0x4c, 0x2b, 0xea, 0x90, 0x70, 0xcc, 0x92,
- 0x54, 0x18, 0x63, 0x3b, 0xdb, 0x8d, 0xa1, 0x30, 0x0a, 0x06, 0x08, 0x2a,
- 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45,
- 0x02, 0x20, 0x61, 0x62, 0xac, 0x65, 0x78, 0xe7, 0xa0, 0xaf, 0x97, 0x7e,
- 0x5b, 0xfc, 0xe1, 0x82, 0x78, 0xf3, 0xa7, 0x62, 0x38, 0xb2, 0x7c, 0x00,
- 0x75, 0x15, 0x38, 0x67, 0xbb, 0xed, 0x15, 0x6c, 0x70, 0x0f, 0x02, 0x21,
- 0x00, 0xfe, 0x9a, 0x8d, 0x98, 0x6d, 0xe1, 0x36, 0x7e, 0xdd, 0x12, 0x3a,
- 0x3a, 0x63, 0xfd, 0xc4, 0x16, 0x7e, 0x1d, 0xce, 0x97, 0x9d, 0xc5, 0x01,
- 0x93, 0x9f, 0xb7, 0x17, 0x23, 0xe7, 0xcf, 0x2f, 0x6f};
-static const unsigned int T3W1_der_len = 909;
+#define OPTIGA_DEVICE_CERT_CHAIN \
+ { \
+ 0x30, 0x82, 0x01, 0xa3, 0x30, 0x82, 0x01, 0x49, 0xa0, 0x03, 0x02, 0x01, \
+ 0x02, 0x02, 0x04, 0x21, 0xa6, 0x48, 0xa1, 0x30, 0x0a, 0x06, 0x08, 0x2a, \
+ 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x4f, 0x31, 0x0b, 0x30, \
+ 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, \
+ 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, \
+ 0x7a, 0x6f, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, \
+ 0x73, 0x2e, 0x72, 0x2e, 0x6f, 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, \
+ 0x55, 0x04, 0x03, 0x0c, 0x17, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, \
+ 0x4d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, \
+ 0x67, 0x20, 0x43, 0x41, 0x30, 0x22, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x35, \
+ 0x30, 0x34, 0x31, 0x30, 0x31, 0x31, 0x34, 0x30, 0x35, 0x30, 0x5a, 0x18, \
+ 0x0f, 0x32, 0x30, 0x35, 0x35, 0x30, 0x34, 0x30, 0x33, 0x31, 0x31, 0x34, \
+ 0x30, 0x35, 0x30, 0x5a, 0x30, 0x1d, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, \
+ 0x55, 0x04, 0x03, 0x0c, 0x12, 0x54, 0x33, 0x57, 0x31, 0x20, 0x54, 0x72, \
+ 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x53, 0x61, 0x66, 0x65, 0x20, 0x37, 0x30, \
+ 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, \
+ 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, \
+ 0x00, 0x04, 0x9b, 0xbf, 0x06, 0xda, 0xd9, 0xab, 0x59, 0x05, 0xe0, 0x54, \
+ 0x71, 0xce, 0x16, 0xd5, 0x22, 0x2c, 0x89, 0xc2, 0xca, 0xa3, 0x9f, 0x26, \
+ 0x26, 0x7a, 0xc0, 0x74, 0x71, 0x29, 0x88, 0x5f, 0xbd, 0x44, 0x1b, 0xcc, \
+ 0x7f, 0xa8, 0x4d, 0xe1, 0x20, 0xa3, 0x67, 0x55, 0xda, 0xf3, 0x0a, 0x6f, \
+ 0x47, 0xe8, 0xc0, 0xd4, 0xbd, 0xdc, 0x15, 0x03, 0x6e, 0xd2, 0xa3, 0x44, \
+ 0x7d, 0xfa, 0x7a, 0x1d, 0x3e, 0x88, 0xa3, 0x41, 0x30, 0x3f, 0x30, 0x0e, \
+ 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, \
+ 0x00, 0x80, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, \
+ 0x04, 0x02, 0x30, 0x00, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, \
+ 0x18, 0x30, 0x16, 0x80, 0x14, 0x93, 0xe0, 0xf9, 0x2e, 0x12, 0x66, 0x94, \
+ 0xaf, 0xf3, 0x7f, 0x70, 0xb5, 0xbb, 0xf4, 0x69, 0x57, 0xcb, 0xbe, 0xe2, \
+ 0xcb, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, \
+ 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x21, 0x00, 0xab, 0x04, 0x22, \
+ 0x1e, 0xba, 0x8c, 0x64, 0x71, 0xee, 0x5a, 0xbc, 0x76, 0xfe, 0x84, 0x93, \
+ 0x94, 0xac, 0xdc, 0x6a, 0x5e, 0xa5, 0x32, 0x65, 0xd5, 0x6e, 0x74, 0x41, \
+ 0x30, 0x0c, 0xdd, 0xba, 0xe7, 0x02, 0x20, 0x38, 0x35, 0x75, 0x58, 0x6d, \
+ 0x63, 0x7b, 0xd6, 0x12, 0xcb, 0x16, 0x5d, 0x3f, 0xae, 0x7d, 0x6c, 0xda, \
+ 0xba, 0x09, 0x1d, 0x31, 0x9d, 0x45, 0x9c, 0x60, 0x7e, 0xaa, 0x1a, 0x18, \
+ 0x8f, 0x8c, 0xcc, 0x30, 0x82, 0x01, 0xe2, 0x30, 0x82, 0x01, 0x88, 0xa0, \
+ 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x67, 0xf7, 0xad, 0xbe, 0x2c, 0x29, \
+ 0x29, 0xdc, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, \
+ 0x03, 0x02, 0x30, 0x54, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \
+ 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, \
+ 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x43, \
+ 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, 0x73, 0x2e, 0x72, 0x2e, 0x6f, \
+ 0x2e, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1c, \
+ 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x66, \
+ 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x52, 0x6f, 0x6f, \
+ 0x74, 0x20, 0x43, 0x41, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x35, 0x30, 0x34, \
+ 0x31, 0x30, 0x31, 0x31, 0x33, 0x38, 0x33, 0x38, 0x5a, 0x18, 0x0f, 0x32, \
+ 0x30, 0x35, 0x35, 0x30, 0x34, 0x31, 0x30, 0x31, 0x31, 0x33, 0x38, 0x33, \
+ 0x38, 0x5a, 0x30, 0x4f, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \
+ 0x06, 0x13, 0x02, 0x43, 0x5a, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, \
+ 0x04, 0x0a, 0x0c, 0x15, 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x43, \
+ 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x20, 0x73, 0x2e, 0x72, 0x2e, 0x6f, \
+ 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x17, \
+ 0x54, 0x72, 0x65, 0x7a, 0x6f, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x75, 0x66, \
+ 0x61, 0x63, 0x74, 0x75, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x43, 0x41, 0x30, \
+ 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, \
+ 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, \
+ 0x00, 0x04, 0xa5, 0xd7, 0x01, 0xfc, 0xed, 0x9b, 0x5a, 0x2c, 0xd0, 0x76, \
+ 0xa0, 0x2d, 0x8a, 0x98, 0xe7, 0x79, 0xc5, 0x49, 0x46, 0xee, 0xfc, 0x7b, \
+ 0x25, 0x25, 0xfa, 0xc7, 0x82, 0xfa, 0x3d, 0x65, 0xb5, 0xd9, 0xe6, 0xa8, \
+ 0xc9, 0x09, 0x46, 0xbd, 0x30, 0xb3, 0x5d, 0xfe, 0xec, 0x34, 0xa0, 0x53, \
+ 0xf1, 0x10, 0x6b, 0xa1, 0x30, 0xa8, 0x47, 0x20, 0x37, 0xf2, 0xdb, 0x8c, \
+ 0xf2, 0xc4, 0xb3, 0xb6, 0xe9, 0x3a, 0xa3, 0x47, 0x30, 0x45, 0x30, 0x0e, \
+ 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, \
+ 0x02, 0x04, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, \
+ 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x00, 0x30, 0x1f, \
+ 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x37, \
+ 0x41, 0x8f, 0x47, 0xc1, 0x47, 0x4c, 0x2b, 0xea, 0x90, 0x70, 0xcc, 0x92, \
+ 0x54, 0x18, 0x63, 0x3b, 0xdb, 0x8d, 0xa1, 0x30, 0x0a, 0x06, 0x08, 0x2a, \
+ 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, \
+ 0x02, 0x20, 0x61, 0x62, 0xac, 0x65, 0x78, 0xe7, 0xa0, 0xaf, 0x97, 0x7e, \
+ 0x5b, 0xfc, 0xe1, 0x82, 0x78, 0xf3, 0xa7, 0x62, 0x38, 0xb2, 0x7c, 0x00, \
+ 0x75, 0x15, 0x38, 0x67, 0xbb, 0xed, 0x15, 0x6c, 0x70, 0x0f, 0x02, 0x21, \
+ 0x00, 0xfe, 0x9a, 0x8d, 0x98, 0x6d, 0xe1, 0x36, 0x7e, 0xdd, 0x12, 0x3a, \
+ 0x3a, 0x63, 0xfd, 0xc4, 0x16, 0x7e, 0x1d, 0xce, 0x97, 0x9d, 0xc5, 0x01, \
+ 0x93, 0x9f, 0xb7, 0x17, 0x23, 0xe7, 0xcf, 0x2f, 0x6f, \
+ }
diff --git a/core/embed/sec/optiga/unix/certs/gen.sh b/core/embed/sec/optiga/unix/certs/gen.sh
deleted file mode 100755
index a27c6fde..00000000
--- a/core/embed/sec/optiga/unix/certs/gen.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-cd "$(dirname "$0")"
-for file in *.der
-do
- header_file="${file%.der}.h"
- echo "// This file was generated via ./gen.sh" > "$header_file"
- echo >> "$header_file"
- xxd -i "$file" | sed 's/unsigned/static const unsigned/' >> "$header_file"
- clang-format -i "$header_file"
-done
diff --git a/core/embed/sec/optiga/unix/optiga.c b/core/embed/sec/optiga/unix/optiga.c
index 2fdc42a3..fd8dd932 100644
--- a/core/embed/sec/optiga/unix/optiga.c
+++ b/core/embed/sec/optiga/unix/optiga.c
@@ -29,20 +29,18 @@
#if defined(TREZOR_MODEL_T2B1)
#include "certs/T2B1.h"
-#define DEVICE_CERT_CHAIN T2B1_der
#elif defined(TREZOR_MODEL_T3T1)
#include "certs/T3T1.h"
-#define DEVICE_CERT_CHAIN T3T1_der
#elif defined(TREZOR_MODEL_T3B1)
#include "certs/T3B1.h"
-#define DEVICE_CERT_CHAIN T3B1_der
#elif defined(TREZOR_MODEL_T3W1)
#include "certs/T3W1.h"
-#define DEVICE_CERT_CHAIN T3W1_der
#else
#error "Cert chain for specified model is not available."
#endif
+static const uint8_t optiga_device_cert_chain[] = OPTIGA_DEVICE_CERT_CHAIN;
+
optiga_sign_result optiga_sign(uint8_t index, const uint8_t *digest,
size_t digest_size, uint8_t *der_signature,
size_t max_der_signature_size,
@@ -73,7 +71,7 @@ bool optiga_cert_size(uint8_t index, size_t *cert_size) {
return false;
}
- *cert_size = sizeof(DEVICE_CERT_CHAIN);
+ *cert_size = sizeof(optiga_device_cert_chain);
return true;
}
@@ -83,12 +81,12 @@ bool optiga_read_cert(uint8_t index, uint8_t *cert, size_t max_cert_size,
return false;
}
- if (max_cert_size < sizeof(DEVICE_CERT_CHAIN)) {
+ if (max_cert_size < sizeof(optiga_device_cert_chain)) {
return false;
}
- memcpy(cert, DEVICE_CERT_CHAIN, sizeof(DEVICE_CERT_CHAIN));
- *cert_size = sizeof(DEVICE_CERT_CHAIN);
+ memcpy(cert, optiga_device_cert_chain, sizeof(optiga_device_cert_chain));
+ *cert_size = sizeof(optiga_device_cert_chain);
return true;
}
diff --git a/core/embed/sec/secret/unix/certs/T3W1.h b/core/embed/sec/secret/unix/certs/T3W1.h
index 352a44bf..124fc7c6 100644
--- a/core/embed/sec/secret/unix/certs/T3W1.h
+++ b/core/embed/sec/secret/unix/certs/T3W1.h
@@ -1,4 +1,8 @@
-// This file was generated via ./gen.sh
+// This file is auto-generated by `core/tools/generate_certificates.py`.
+// Do not edit this file directly. Instead, run `make gen` or `make certs`
+// in the root directory.
-static uint8_t mcu_device_cert[MCU_ATTESTATION_MAX_CERT_SIZE] = {0x30, 0x00};
-static size_t mcu_device_cert_size = 2;
+#define MCU_DEVICE_CERT \
+ { \
+ 0x30, 0x00, \
+ }
diff --git a/core/embed/sec/secret/unix/certs/gen.sh b/core/embed/sec/secret/unix/certs/gen.sh
deleted file mode 100755
index 0f8486ca..00000000
--- a/core/embed/sec/secret/unix/certs/gen.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-cd "$(dirname "$0")"
-for file in *.der
-do
- header_file="${file%.der}.h"
- echo "// This file was generated via ./gen.sh" > "$header_file"
- echo >> "$header_file"
- xxd -i "$file" | sed '
- s/unsigned.*_der\[\]/static uint8_t mcu_device_cert\[MCU_ATTESTATION_MAX_CERT_SIZE\]/;
- s/unsigned.*_len/static size_t mcu_device_cert_size/' >> "$header_file"
- clang-format -i "$header_file"
-done
diff --git a/core/tools/generate_certificates.py b/core/tools/generate_certificates.py
new file mode 100755
index 00000000..d7f936e6
--- /dev/null
+++ b/core/tools/generate_certificates.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python3
+
+from pathlib import Path
+
+import click
+
+ROOT = Path(__file__).resolve().parent.parent.parent
+OPTIGA_CERTS_DIR = ROOT / "core/embed/sec/optiga/unix/certs"
+MCU_CERTS_DIR = ROOT / "core/embed/sec/secret/unix/certs"
+
+COMMENT = f"""// This file is auto-generated by `{Path(__file__).relative_to(ROOT)}`.
+// Do not edit this file directly. Instead, run `make gen` or `make certs`
+// in the root directory."""
+
+
+def bytes_to_header(data: bytes, variable_name: str) -> str:
+ chunks = [data[i : i + 12] for i in range(0, len(data), 12)]
+ byte_lines = [", ".join(f"0x{b:02x}" for b in chunk) for chunk in chunks]
+
+ define_lines = [f"#define {variable_name}", " {"]
+ for byte_line in byte_lines:
+ define_lines.append(f" {byte_line},")
+ define_lines.append(" }")
+
+ width = max(len(line) for line in define_lines[:-1]) + 1
+ for i in range(len(define_lines) - 1):
+ define_lines[i] = define_lines[i].ljust(width) + "\\"
+
+ lines = [COMMENT, "", *define_lines]
+ return "\n".join(lines) + "\n"
+
+
+def process_cert(
+ der_path: Path, header_path: Path, variable_name: str, check: bool
+) -> None:
+ content = bytes_to_header(der_path.read_bytes(), variable_name)
+ if check:
+ if not header_path.exists():
+ raise click.ClickException(f"{header_path} is missing")
+ if header_path.read_text() != content:
+ raise click.ClickException(f"{header_path} is out of date")
+ else:
+ header_path.write_text(content)
+ print(f"Generated {header_path}")
+
+
+@click.command()
+@click.option("--check", is_flag=True)
+def generate(check: bool) -> None:
+ process_cert(
+ OPTIGA_CERTS_DIR / "T2B1.der",
+ OPTIGA_CERTS_DIR / "T2B1.h",
+ "OPTIGA_DEVICE_CERT_CHAIN",
+ check,
+ )
+ process_cert(
+ OPTIGA_CERTS_DIR / "T3B1.der",
+ OPTIGA_CERTS_DIR / "T3B1.h",
+ "OPTIGA_DEVICE_CERT_CHAIN",
+ check,
+ )
+ process_cert(
+ OPTIGA_CERTS_DIR / "T3T1.der",
+ OPTIGA_CERTS_DIR / "T3T1.h",
+ "OPTIGA_DEVICE_CERT_CHAIN",
+ check,
+ )
+ process_cert(
+ OPTIGA_CERTS_DIR / "T3W1.der",
+ OPTIGA_CERTS_DIR / "T3W1.h",
+ "OPTIGA_DEVICE_CERT_CHAIN",
+ check,
+ )
+ process_cert(
+ MCU_CERTS_DIR / "T3W1.der",
+ MCU_CERTS_DIR / "T3W1.h",
+ "MCU_DEVICE_CERT",
+ check,
+ )
+
+ if check:
+ print("All files are up to date.")
+
+
+if __name__ == "__main__":
+ generate()
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.