build-docker.sh --models T3T1 --targets bootloader core/bl2.1.16 gives the published image once the signature fields and the code hashes (left to the signing tool) are zeroed; the fingerprint build-docker.sh prints equals the published header's.Trezor Safe 5 bootloader 2.1.16
The published firmware image, checked against its published source. reproducible
517 / 638
functions proved equal to the source
41.7%
of code bytes proved (52,103 of 124,991)
68.5%
of source statements and branches proved
19
mismatches reported: 18 cverif false alarm, 1 unspecified in C
517 proved74 bounded1 differs where C leaves it open19 mismatch, cverif false alarm4 inconclusive23 unsupported
Constant time
4 functions are marked constant time by the specs trezor-crypto, secp256k1-zkp, trezor-storage; cverif checks that the published machine code's timing doesn't depend on their secrets, nor that of the helpers they pass secrets to (how). 61 spec entries are not in this image.
2 proved1 bounded1 mismatch, cverif false alarm
| Function | Claim | Detail |
|---|---|---|
memzeromarked | violation | argument 1 of the call to explicit_bzero points to secret memory, and explicit_bzero is not known to be constant time (vendor/trezor-crypto/memzero.c:55) any input |
ECRYPT_keysetupmarked | proved | constant time |
sha256_Transformmarked | proved | constant time |
sha512_Transformmarked | bounded | constant time on the explored paths only |
Chain of evidence
- Published imagebootloader-t3t1-2.1.16.bin, sha256
9e276650572519ce1524858527270e95eafa9fbf75773604e5977b8d776c3fb8 - Headerthe signed header's code hashes match the code
- Source
- Reproducible buildthe vendor's own build reproduces the published image byte for byte, signatures aside
- Source bundle166 C/assembly units linked into the image; 15 linked inputs have no C source (Rust, toolchain libraries); toolchain: arm-none-eabi-gcc (Arm GNU Toolchain 13.3.Rel1 (Build arm-13.24)) 13.3.1 20240614
- Extractioncode at
0xc010400, 129,024 bytes; every published byte is accounted for - Verificationcverif 0.1.5 on the published bytes: 517 of 638 functions proved, 1 flag group(s)
Findings
The image at data.trezor.io is byte-identical to
core/embed/models/T3T1/bootloaders/bootloader_T3T1.bin at core/v2.13.1 and to the bootloader embedded (raw deflate) in the published T3T1 firmware 2.13.1, which installs it. Its header's code hash matches. No vendor metadata names the bootloader's source commit; the tag core/bl2.1.16 is used.The bootloader UI is Rust (28 KB of code, 17.5 KB of data), out of cverif's scope, and so are
memcpy, memset, strlen and the __aeabi_mem* helpers: 12-byte weak C-ABI wrappers that tail-jump to Rust's compiler_builtins, in place of newlib's.Every unit is built with
-mcmse, for which GCC predefines __ARM_FEATURE_CMSE as 3; the STM32U5 headers select the secure peripheral aliases (FLASH at 0x50022000) and the secure-only code on it. verify.py passes -D__ARM_FEATURE_CMSE=3 (from 2026-12-05); before that, 47 functions showed false mismatches on peripheral accesses.BOOT_COMMAND_POWER_OFF = 0x24EEE8828 has nine hex digits, while every other command is a 32-bit constant; it looks like a typo, and it is in every Trezor core tree here (bootloaders 2.1.16 and 2.1.18, firmware 2.13.1). All producers and consumers of the command are C compiled with the same header, and the linker scripts align .boot_args to 8 after .boot_command, so the RAM layout is the same as with a 32-bit enumeration; code built with a 32-bit boot_command_t would leave the upper word unwritten, and a command compared as 64-bit would then not match. No effect was found in the code verified here.memzero is explicit_bzero(pnt, len). newlib's explicit_bzero falls through into bzero, which tail-calls memset (the compiler_builtins one): its branches depend on the pointer's alignment and the length, never on the bytes it overwrites. cverif has no constant-time knowledge of the library function.The bootloader holds no signing key or PIN.
ECRYPT_keysetup (key setup of the ChaCha-based random generator) is proved constant time; sha256_Transform and sha512_Transform are constant time on every path explored before the time limit; the one violation reported (memzero) is the library call above.stm32u5xx_hal_pcd.c defines these callbacks __weak and empty; embed/io/usb/stm32/usbd_conf.c defines them for real. The link map keeps usbd_conf.o's and discards the HAL's (.text.HAL_PCD_SetupStageCallback 0x0 0x2 ...hal_pcd.o). cverif compares the binary with the weak definition (issue 24), hence calls (USBD_LL_StallEP, USBD_LL_OpenEP, the class callbacks) and stores the empty function lacks.BOOT_COMMAND_POWER_OFF = 0x24EEE8828 (sys/startup/inc/sys/bootargs.h) does not fit 32 bits, so GCC makes boot_command_t 64-bit: g_boot_command is 8 bytes, bootargs_init copies it with ldrd/strd, bootargs_set takes the command in r0:r1. cverif reads the type as 32-bit (issue 25), so the upper word differs.The counterexample's queue has
rix == 2 with FRAME_BUFFER_COUNT == 2, so queue->entries[queue->rix] is past the array and lands on rix itself (r0 + 4): undefined behaviour. rix is only ever set by (rix + 1) % FRAME_BUFFER_COUNT or reset to 0.These are Rust
compiler_builtins thunks with no C source, compared with cverif's library model. The counterexample puts the destination at 0xffffffff so that the thunk's push {r7, lr} writes the same byte: an object overlapping the callee's new stack frame, which no C caller can produce.What the image is made of
Bytes by origin, from the link map. cverif verifies C and assembly; the rest counts as unverified.
| Origin | Bytes | Share |
|---|---|---|
| C | 82,054 | 63.1% |
| Rust | 45,701 | 35.1% |
| assembly | 1,648 | 1.3% |
| linker fill | 394 | 0.3% |
| toolchain libraries (newlib, libgcc) | 250 | 0.2% |
Functions
Every function of the image cverif compared with its source. Bounded: no difference within the explored paths, not a proof. Unsupported/inconclusive: a construct cverif doesn't model yet.
| Function | Status | Bytes | Detail |
|---|---|---|---|
HAL_PCD_MspInit0xc01f140 | mismatch | 256 | binary reads 4 byte(s) of the peripheral register at 0x56020c8c (instruction at 0xc01f15c) where the source makes no such access |
bootargs_set0xc01d174 | mismatch | 84 | memory at return: 4-byte value stored at 0x3002ff04: source gives 0x0, binary gives 0x80000006 for r1=0x80000006 mem[0x30030028]=0x9c mem[0x30030029]=0x7f mem[0x3003002a]=0xf5 mem[0x3003002b]=0x59 mem[0x30030740]=0xf7 mem[0x30030741]=0xff mem[0x30030742]=0xff mem[0x30030743]=0x7f |
fb_queue_take0xc020d70 | mismatch | 48 | memory at `msr primask` (event #3): 2-byte value stored at (r0 + 2*zext32(mem2.8[(r0 + 4)])): source gives 0xff00, binary gives 0xff01 for r0=0x61fa mem[0x61fe]=0x02 mem[0x61ff]=0x7e mem[0x30030028]=0x9f mem[0x30030029]=0x7f mem[0x3003002a]=0x1f mem[0x3003002b]=0x84 mem[0x30030740]=0x00 mem[0x30030741]=0x00 |
HAL_PCD_MspDeInit0xc01f240 | mismatch | 44 | binary reads 4 byte(s) of the peripheral register at 0x56020c8c (instruction at 0xc01f24a) where the source makes no such access |
bootargs_init0xc01d210 | mismatch | 32 | memory at return: 4-byte value stored at 0x300307cc: source gives 0x7fffffff, binary gives 0x80000000 for mem[0x3002ff04]=0x00 mem[0x3002ff05]=0x00 mem[0x3002ff06]=0x00 mem[0x3002ff07]=0x80 mem[0x30030028]=0xff mem[0x30030029]=0x7f mem[0x3003002a]=0xaa mem[0x3003002b]=0xaa |
HAL_PCD_ResetCallback0xc01f2a2 | mismatch | 32 | binary calls USBD_LL_OpenEP, which the source does not call at this point |
HAL_PCD_DataOutStageCallback0xc01f278 | mismatch | 18 | binary calls <indirect call>, which the source does not call at this point |
HAL_PCD_DataInStageCallback0xc01f28a | mismatch | 16 | binary calls <indirect call>, which the source does not call at this point |
HAL_PCD_SetupStageCallback0xc01f26c | mismatch | 12 | binary calls USBD_LL_StallEP, which the source does not call at this point |
memcpy0xc029a56 | mismatch | 12 | memory at return: 1-byte value stored at r0: source gives 0xc, binary gives 0x82 for r0=0xffffffff r1=0xc2081008 r2=0x1 mem[0xc2081008]=0x0c mem[0xffffffff]=0x82 |
memset0xc029abc | mismatch | 12 | memory at return: 1-byte value stored at r0: source gives 0x84, binary gives 0x0 for r0=0xffffffff r1=0x84 r2=0x1 mem[0xffffffff]=0x00 |
__aeabi_memcpy0xc029b0e | mismatch | 12 | memory at return: 1-byte value stored at r0: source gives 0x1, binary gives 0x0 for r0=0xffffffff r1=0x46281088 r2=0x1 mem[0x46281088]=0x01 mem[0xffffffff]=0x00 |
__aeabi_memcpy40xc029b32 | mismatch | 12 | memory at return: 1-byte value stored at r0: source gives 0x1, binary gives 0x0 for r0=0xffffffff r1=0x46281088 r2=0x1 mem[0x46281088]=0x01 mem[0xffffffff]=0x00 |
__aeabi_memclr0xc029b70 | mismatch | 12 | memory at return: 1-byte value stored at r0: source gives 0x0, binary gives 0x10 for r0=0xffffffff r1=0x1 mem[0xffffffff]=0x10 |
__aeabi_memclr40xc029b8a | mismatch | 12 | memory at return: 1-byte value stored at r0: source gives 0x0, binary gives 0x10 for r0=0xffffffff r1=0x1 mem[0xffffffff]=0x10 |
HAL_PCD_SOFCallback0xc01f29a | mismatch | 8 | binary calls <indirect call>, which the source does not call at this point |
HAL_PCD_SuspendCallback0xc01f2c2 | mismatch | 8 | memory at return: 1-byte value stored at (mem0.32[(r0 + 1288)] + 509): source gives 0x7f, binary gives 0x80 for r0=0x80207f26 mem[0x30030028]=0x80 mem[0x30030029]=0x80 mem[0x3003002a]=0xa0 mem[0x3003002b]=0x80 mem[0x30030740]=0x80 mem[0x30030741]=0x80 mem[0x30030742]=0x80 mem[0x30030743]=0x80 |
HAL_PCD_ResumeCallback0xc01f2ca | mismatch | 8 | memory at return: 1-byte value stored at (mem0.32[(r0 + 1288)] + 508): source gives 0x7f, binary gives 0x80 for r0=0x80808a7e mem[0x30030028]=0x80 mem[0x30030029]=0x80 mem[0x3003002a]=0x80 mem[0x3003002b]=0x80 mem[0x30030740]=0x80 mem[0x30030741]=0x80 mem[0x30030742]=0x80 mem[0x30030743]=0x80 |
HAL_PCD_DisconnectCallback0xc01f2ea | mismatch | 8 | binary calls <indirect call>, which the source does not call at this point |
curve25519_contract0xc012d40 | proved | 668 | |
HAL_GPIO_Init0xc019b0c | proved | 532 | |
sha256_Transform0xc0147c0 | proved constant time | 488 | |
SystemInit0xc01d4bc | proved | 488 | |
expand256_modm0xc0143c4 | proved | 484 | |
encode_basic_field0xc01885c | proved | 456 | |
USB_EPStartXfer0xc02017c | proved | 452 | |
ge25519_unpack_negative_vartime0xc0139c8 | proved | 416 | |
workflow_firmware_update0xc015f08 | proved | 404 | |
HAL_GTZC_TZSC_ConfigPeriphAttributes0xc019e3c | proved | 400 | |
mpu_reconfig0xc01ccfc | proved | 364 | |
ge25519_pnielsadd0xc0137ec | proved | 332 | |
backlight_init0xc020f30 | proved | 324 | |
tamper_init0xc01c474 | proved | 320 | |
unit_properties_init0xc01c708 | proved | 308 | |
ge25519_pnielsadd_p1p10xc013684 | proved | 288 | |
reduce256_modm0xc013d48 | proved | 288 | |
HAL_GTZC_TZSC_MPCWM_ConfigMemAttributes0xc019fcc | proved | 272 | |
display_io_init_gpio0xc020808 | proved | 268 | |
fw_check0xc017078 | proved | 260 | |
HAL_GPIO_DeInit0xc019d20 | proved | 260 | |
flash_area_write_data_padded0xc022ba0 | proved | 256 | |
usb_class_setup0xc01ec84 | proved | 244 | |
mpu_init0xc01cbfc | proved | 240 | |
touch_get_state0xc021ec0 | proved | 240 | |
chacha_drbg_reseed0xc011864 | proved | 236 | |
dma2d_rgb565_fill0xc022460 | proved | 232 | |
curve25519_sub_after_basic0xc012108 | proved | 230 | |
tamper_build_pminfo0xc01c5b4 | proved | 228 | |
USB_SetTurnaroundTime0xc01fc4c | proved | 224 | |
codec_send_msg0xc01676c | proved | 216 | |
secret_bhk_regenerate0xc01c194 | proved | 216 | |
HAL_GTZC_MPCBB_ConfigMem0xc01a0dc | proved | 212 | |
USBD_StdEPReq0xc01f984 | proved | 210 | |
bg_copy_start_const_out_80xc021164 | proved | 208 | |
ed25519_cosi_combine_publickeys0xc013430 | proved | 200 | |
dma2d_wait0xc022398 | proved | 200 | |
HAL_DMAEx_List_Start_IT0xc019628 | proved | 196 | |
HASH_GetDigest0xc01a2a8 | proved | 196 | |
FMC_NORSRAM_Init0xc01b634 | proved | 196 | |
bootloader_process_comm0xc016528 | proved | 192 | |
pb_encode_submessage0xc01879c | proved | 192 | |
touch_fsm_get_event0xc022038 | proved | 192 | |
dma2d_rgb565_blend_mono80xc0228e4 | proved | 188 | |
curve25519_swap_conditional0xc012fdc | proved | 186 | |
pb_validate_utf80xc017562 | proved | 186 | |
ge25519_double_p1p10xc0135cc | proved | 184 | |
expand_raw256_modm0xc0145a8 | proved | 184 | |
HAL_EXTI_SetConfigLine0xc0196ec | proved | 184 | |
hash_processor_init0xc01b8fc | proved | 184 | |
curve25519_sub0xc012058 | proved | 176 | |
workflow_menu0xc016218 | proved | 176 | |
backlight_set0xc020e80 | proved | 176 | |
workflow_wipe_device0xc01609c | proved | 172 | |
HAL_FLASHEx_Erase0xc019a60 | proved | 172 | |
USB_DeactivateEndpoint0xc020024 | proved | 172 | |
curve25519_add_after_basic0xc011faa | proved | 170 | |
curve25519_neg0xc0121f4 | proved | 168 | |
HASH_WriteData0xc01a3e0 | proved | 168 | |
lx154a2482_init_seq0xc020c84 | proved | 168 | |
check_vendor_header_sig0xc010efc | proved | 164 | |
pb_encode_varint0xc0185f4 | proved | 164 | |
sha256_Final0xc014a96 | proved | 160 | |
HAL_DMA2D_ConfigLayer0xc018e14 | proved | 160 | |
system_fault_message0xc01dd6c | proved | 160 | |
USBD_LL_DataInStage0xc01f5b8 | proved | 158 | |
usb_iface_init0xc016920 | proved | 156 | |
pb_read0xc017738 | proved | 152 | |
HASH_Accumulate0xc01a734 | proved | 152 | |
memregion_del_range0xc01cb00 | proved | 152 | |
syshandle_write_blocking0xc01e544 | proved | 152 | |
display_io_init_fmc0xc020914 | proved | 152 | |
usb_start0xc01ef78 | proved | 148 | |
ge25519_pack0xc013938 | proved | 144 | |
hash_processor_sha256_update0xc01ba60 | proved | 144 | |
dma2d_rgb565_copy_rgb5650xc0226b4 | proved | 144 | |
USBD_LL_SetupStage0xc01f4ca | proved | 142 | |
pb_decode_varint0xc0177d8 | proved | 140 | |
HAL_PWR_ConfigPVD0xc01b50c | proved | 140 | |
random_delays_init0xc01bdd8 | proved | 140 | |
secret_write0xc01bfb0 | proved | 140 |
Showing 100 of 638.
Raw results
- Result directory on GitHub
- summary.json, findings.json, functions.tsv
- sources.tsv: sha256 of every source file the proofs were made against
- Re-run:
bin/hww run trezor/t3t1boot 2.1.16