Skip to content

OneKey

OneKey's published firmware, checked against its published source with cverif.

Devices

Results

DeviceVersionBuildFunctionsCode provedMismatchesDate
OneKey Pro bootloader
OneKey
2.8.4reproducible
700 of 982 proved
67.5%36
all triaged
2026-12-05

Findings about OneKey

lowClassic 1S: the published build-docker.sh fails before saving the firmware
In OneKeyHQ/firmware-classic1s, the script build-docker.sh generates for the legacy firmware ends with cp bootloader/*.bin build/bootloader/bootloader.bin and cp intermediate_fw/*.bin build/intermediate_fw/inter.bin. Both globs match two files, so cp fails after the firmware is built, and the container (--rm, building in /tmp) is discarded with the firmware in it. The script also insists on docker run -it, under which poetry install stopped without a message in our run. We build the image with build-docker.sh --skip-core --skip-legacy unmodified, then run its legacy script line for line without -it and without the two cp lines. With that, the build reproduces the published image (see each release).
reproducibility · confidence high · ../../docs/vendors/onekey-legacy.md#build · legacy-build-script-fails
lowOneKey publishes no firmware hashes or fingerprints
The GitHub release notes of OneKeyHQ/firmware-classic1s give no hash, and the fingerprint fields of the OneKey app's update channel (https://data.onekey.so/config.json) are empty. What ties a download to the release is GitHub's own sha256 digest of the asset, checked here, and the commit in the file name, which the release tag resolves to.
supply-chain · confidence high · ../../docs/vendors/onekey-legacy.md#release-channel · no-published-hashes
infoThe OneKey app installs the GitHub MCU image followed by the encrypted SE firmware
For the Classic 1S the app's update channel serves classic1s.<version>-Stable-<commit>_thd89_....signed.bin from web.onekey-asset.com. For 3.21.0 it is byte-for-byte the GitHub MCU image followed by the GitHub thd89_..._0x10.enc.signed.bin (secure-element firmware, encrypted, out of scope), and equals the combined asset of the GitHub release. So the MCU code verified here is the code the app installs.
integrity · confidence high · app-installs-combined-image
infoThe reproducible-build document is Trezor's, unedited
docs/common/reproducible-build.md in the OneKey trees still describes Trezor's tags, file names and the Trezor One legacy header; nothing documents OneKey's header (four signatures, 256 KiB chunk hashes) or how to compare a local build with a published OneKey image. The procedure used here is in the vendor document.
documentation · confidence high · ../../docs/vendors/onekey-legacy.md · reproducible-build-doc-unadapted
lowClassic and Mini (OneKeyHQ/firmware): the build date is compiled into the firmware
In OneKeyHQ/firmware (tags classic/v*, mini/v*), legacy/firmware/Makefile names the firmware classic.<version>-Stable-$(date +%m%d)-<commit> and compiles that name in (-DBUILD_ID). A rebuild on another day differs in that string unless the date is faked; the date is in the published file name. Not run here. The Classic 1S tree no longer does this.
reproducibility · confidence medium · ../../docs/vendors/onekey-legacy.md#onekey-classic-and-mini- · classic-mini-build-date
mediumOneKey's build script pulls an unpinned image from a personal Docker Hub account, made by hand
build-docker.sh in OneKeyHQ/firmware-pro starts with docker pull lyxyx/onekey-build and runs the build in it. The image is on a personal account (lyxyx), referenced by its mutable :latest tag, not by digest; Docker Hub shows one tag, digest sha256:a800c8567f999ab7efb26462ed955a495cf15d471094ef864bd5857745d5aaa0, pushed 2023-06-13, tag immutability off. It cannot be rebuilt from the repository: its lower layers match the repo's Dockerfile (Ubuntu 20.04 and packages), but the top layer (273 MB) is a docker commit of an interactive shell. That layer contains a Nix 2.16.1 install run from an ./install.sh of unknown origin through a local proxy, a libfaketime 0.9.10 built from an unverified tarball into /usr/local, and the session's own /root/.bash_history, which records these steps. Whoever controls the account can change what every user of the script runs. The Pro's release images are not built with it (see pro-build-docker-no-pro).
supply-chain · confidence high · ../../docs/vendors/onekey-core.md#4-build-environment-reprod · pro-docker-image-unpinned
lowOneKey Pro: the repository's build-docker.sh cannot build the Pro
At v4.21.0, build-docker.sh knows only -f touch|mini|classic and clones another repository (OneKeyHQ/onekey-firmware) inside the container instead of using the checkout. The Pro's images come from the GitHub Actions workflow build-pro.yml (Nix 2.23.3, ci/shell.nix with nixpkgs and the Rust toolchain pinned by hash, poetry run make -C core build_firmware). That workflow is what is reproduced here, in a container of our own (nixos/nix:2.23.3 pinned by digest).
documentation · confidence high · ../../docs/vendors/onekey-core.md#4-build-environment-reprod · pro-build-docker-no-pro
lowOneKey Pro: the CI build uses the runner's /usr/bin/cpp, outside its pinned environment
tools/version.sh, which produces the boardloader and bootloader version in their BUILD_ID string and file name, calls /usr/bin/cpp: the GitHub runner's preprocessor, not the pinned Nix one. Where there is none, the version is silently empty (BUILD_ID="bootloader.-<commit>") and the bootloader's bytes change, without the build failing. The firmware is not affected. We provide GCC's cpp from ci/shell.nix at that path.
reproducibility · confidence high · ../../docs/vendors/onekey-core.md#4-build-environment-reprod · pro-host-cpp
infoOneKey Pro: releases are signed 4-of-7 outside the public CI
build-pro.yml signs its output with two keys from GitHub Actions secrets (headertool.py -S 1:... -S 2:...). The released images carry a 4-of-7 CoSi signature (firmware 4.21.0: sigmask 0x6a, keys 2, 4, 6 and 7 of its vendor header; bootloader 2.8.4: also sigmask 0x6a, checked by the boardloader against FW_KEYS in core/embed/fw_keys), so they were re-signed after CI by a process that is not public. What the CI run produced can't be compared directly: its logs and artifacts have expired. The reproducible build shows the released bytes are the source's, signatures aside. Signatures are not checked cryptographically here.
supply-chain · confidence high · ../../docs/vendors/onekey-core.md#7-open-questions · pro-signing-outside-ci
lowOneKey Pro: a precompiled fingerprint library and a stale Trezor bootloader in the tree
core/embed/fp_sensor_wrapper/libFpalgorithm.a (the fingerprint matching algorithm, 4 objects, no source) is linked whole-archive into the firmware: 44 KB of the image that cannot be verified from source. core/embed/firmware/bootloader.bin is a Trezor-format bootloader (TRZB 2.0.3) left from the fork; it is linked as a section that --gc-sections drops, so it is not in the image.
scope · confidence high · ../../docs/vendors/onekey-core.md#4-build-environment-reprod · pro-binaries-in-tree

About OneKey's firmware ​

Repository: https://github.com/OneKeyHQ/firmware-pro (GPLv3, a fork of Trezor's trezor-firmware "core"). Facts below were checked against tag v4.21.0 (commit 251a1b76, the firmware) and tag bootloader-v2.8.4 (commit 3542e8c4, the bootloader), the published release files and OneKey's app update channel. Research date: 2026-12-04. Targets: onekey/pro (firmware) and onekey/pro-bootloader.

The OneKey Touch shares the code base (an older branch); it is not covered here. The OneKey Pro 2 (pro2 in the app channel, .okpkg packages) is a different code base and format.

Verdict. The firmware reproduces bit for bit from the tagged source with the vendor's CI recipe (signature and code hashes aside), the header's hashes cover the whole image, and the image the OneKey app installs is the GitHub release asset. Most of the image is not C: 61% of its bytes are MicroPython frozen bytecode, and there is a precompiled fingerprint library without source. The C part (about 0.84 MB of code) is what cverif verifies. The vendor's own build-docker.sh cannot build the Pro at all and pulls an unpinned image from a personal Docker Hub account; the reproducible route is the CI workflow's Nix environment, which is what the targets use.

1. Device, MCU, published images ​

itemvaluesource
MCUSTM32H747 (Cortex-M7 core used; FPv5 double precision, -mfloat-abi=hard)core/SConscript.firmware (CPU_CCFLAGS), core/Makefile (PRODUCTION_MODEL = H)
secure elementTHD89 (two applications, 0x10 and 0x13), firmware published encryptedrelease assets thd89_*.align.signed.enc.bin
otherBLE chip (own image format, FIRMWARE_IMAGE_MAGIC_BLE), fingerprint sensorcore/embed/trezorhal/image.h

Flash layout (core/Makefile, core/embed/firmware/memory_H.ld, core/embed/bootloader/memory.ld):

rangecontentpublished?
0x08000000, 128 KiBboardloaderno (built by CI, never released)
0x08020000, 256 KiBbootloader: TC2B header, code, .padding (0xDEADBEEF)yes, bootloader-v* releases
0x08060000–0x081DFFFFfirmware part 1: vendor header, TC2F header, .flash (all code), .datayes
0x90000000 (QSPI)firmware part 2, .flash2: copied to SDRAM 0xD1C00000 at boot; data only (frozen bytecode, secp256k1-zkp tables)yes (same file)

2. Release channel ​

  • GitHub releases of OneKeyHQ/firmware-pro: tag v<version> with asset pro.<version>-Stable-<MMDD>-<commit7>.signed.bin, the Bitcoin-only build under v<version>-btc, the bootloader under bootloader-v<version> (pro.bootloader.<version>-Stable-<MMDD>-<commit7>.signed.bin). GitHub gives a sha256 digest per asset; t_fetch checks it. The commit is named only by the 7 hex digits in the asset name; t_source checks that the tag resolves to a commit starting with them. <MMDD> is the build date (core/Makefile: date +%m%d; for 4.21.0 it is 0626, the date of the build-pro CI run on that commit).
  • The OneKey app reads https://data.onekey.so/config.json, key pro, firmware-v8: for 4.21.0 it serves pro.4.21.0-...-251a1b7_thd89_app_..._thd89_appfp_....bin from web.onekey-asset.com, which is the GitHub image followed by the two THD89 images (sha256 3691168e..., identical to the GitHub asset of the same name). Its fingerprint field is empty. The bootloader entry (bootloaderResource) is byte-identical to the GitHub asset; it says bootloaderVersion 2.8.3 and displayBootloaderVersion 2.8.4 (the image header says 2.8.4). t_fetch records and checks the app's file against the GitHub image.
  • Older releases (before v4.14) sometimes publish only a combined firmware+SE file, or an unsigned .bin next to the signed one; the targets match only the standalone signed asset and fail otherwise.

3. Image format ​

From the source (core/embed/firmware/header.S, core/embed/trezorhal/image.{h,c}, python/src/trezorlib/firmware.py, core/tools/headertool.py), checked against the published files. OneKey changed Trezor's magics and hash, so a Trezor core parser does not apply as is; fwimage.py onekey-core reads it.

Vendor header (OKTV, 1536 bytes for the production one): Trezor's TRZV layout with a new magic. 4.21.0's is byte-identical to core/embed/vendorheader/vendorheader_onekey_signed.bin in the tree: 7 public keys, vsig_m = 4, vendor string OneKey, signed (sigmask 0x59) by the keys built into the bootloader.

Firmware header (TC2F, 1024 bytes):

offsetfield
0x000magic TC2F (bootloader: TC2B)
0x004hdrlen = 0x400
0x008expiry = 0 (the bootloader refuses anything else)
0x00Ccodelen: everything after the header, both flash parts (_codelen in the linker script)
0x010Trezor version (firmware: 2.99.99.99; bootloader: its own version, 2.8.4)
0x014fix version
0x018OneKey version (4.21.0.0; 0 in the bootloader)
0x01Chash_block: 0 means 256 KiB chunks (512 KiB if the code is over 4 MiB)
0x02016 × 32-byte BLAKE2s chunk hashes; the chunk grid starts at the vendor header (the first chunk is shorter by the headers); unused slots zero
0x220purpose (0 general, 1 Bitcoin-only)
0x224minimum SE version (4.21.0: 1.1.7)
0x228reserved (391 bytes, zero), then build_id (16 bytes, zero)
0x3BFsigmask, 64-byte Ed25519 CoSi signature over BLAKE2s(header with sigmask and signature zeroed)

The firmware header is checked against the vendor header's keys (4 of 7; 4.21.0 is signed with sigmask 0x6a, keys 2, 4, 6, 7). The local build leaves the hashes and hash_block zero; CI fills them with headertool.py -h and signs. fwimage.py checks every chunk hash against the published code (all 16 match for firmware 4.21.0 and bootloader 2.8.4) and compares the image with the build after zeroing the signature, the hashes and hash_block. Signatures are not checked cryptographically.

The file is the objcopy of .vendorheader .header .flash .data padded with zeros to 0x081E0000, followed by .flash2 (SConscript.firmware). Sections with contents in RAM (.sram1, .sram3, .exram: LVGL buffers the source initialises) are not in the image; the transplant leaves them as built.

4. Build environment, reproducibility, and the Docker image ​

build-docker.sh does not build the Pro. At v4.21.0 it supports only -f touch|mini|classic, clones another repository (OneKeyHQ/onekey-firmware) inside the container instead of using the checkout, and starts with docker pull lyxyx/onekey-build:

  • lyxyx/onekey-build is on a personal Docker Hub account, referenced by its mutable :latest tag, not pinned by digest (Docker Hub: one tag, latest, digest sha256:a800c8567f999ab7efb26462ed955a495cf15d471094ef864bd5857745d5aaa0, pushed 2023-06-13, tag immutability off, 1052 pulls).
  • It cannot be rebuilt from the repository. Its lower layers match the repo's Dockerfile (Ubuntu 20.04 plus packages) up to ENV USER=root, but the Dockerfile's Nix install step is not there; the top layer (273 MB, created by /bin/bash) is a docker commit of an interactive session. That layer holds a Nix 2.16.1 single-user install (from an ./install.sh of unknown origin, run through a local HTTP/SOCKS proxy), a nixpkgs-unstable channel, libfaketime 0.9.10 built from an unverified tarball and installed in /usr/local, and the session's own /root/.bash_history, which records all of this.
  • Since the toolchain comes from shell.nix (pinned) at build time, the image mostly supplies Nix itself, but whoever controls that account can change what every build-docker.sh user runs.

The release images come from CI. .github/workflows/build-pro.yml (on push to main): Nix 2.23.3 installed on ubuntu-latest, nix-shell with ci/shell.nix (nixpkgs, the Rust nightly 2023-04-14 from rust-overlay, and the SDL nixpkgs pinned by tarball hash; Python packages by poetry.lock; Rust crates by Cargo.lock), poetry run make -C core build_boardloader build_bootloader build_firmware with PRODUCTION=1, then headertool.py -h -S 1:$SECRET_1 -S 2:$SECRET_2. That CI signature (two keys, from GitHub secrets) is not the release signature: the published image is signed 4 of 7, so it was re-signed outside the workflow. The CI run for 251a1b7 (2026-06-26) still exists; its logs and artifacts have expired.

What the targets do: a container of our own, nixos/nix:2.23.3 pinned by digest, with ci/shell.nix realised into it (onekey-pro-env:<hash>), the checkout mounted at CI's path (/home/runner/work/firmware-pro/firmware-pro, HOME=/home/runner), then CI's make commands unmodified. One impurity had to be supplied: tools/version.sh (which makes the boardloader and bootloader version strings that go into BUILD_ID and the file name) runs /usr/bin/cpp, the CI runner's preprocessor outside the Nix environment; the image links the GCC 11 cpp of shell.nix there. Without it the version is silently empty (BUILD_ID="bootloader.-251a1b7"), which changes the bootloader's bytes.

Result: firmware 4.21.0 and bootloader 2.8.4 reproduce. The published firmware image with the signature, sigmask, code hashes, hash_block and hdrlen zeroed is byte-identical to the local build (sha256 of both 29b836352cb7d3caccabb6a0345b52ad5e2952ae3557157df816ec9e037f42e8; the image as published is a04ab7ff...); the same holds for the bootloader, whose header.S writes hdrlen 0x3f8 where headertool.py writes 0x400. The instrumented rebuild (compiler calls logged) is identical too, and so is the relink with a map. Nothing in the build depends on the date except the output file name.

In the tree, not from source: core/embed/fp_sensor_wrapper/libFpalgorithm.a (the fingerprint algorithm, 4 objects, linked whole-archive: 44 KB of the image); core/embed/vendorheader/vendorheader_onekey_signed.bin (data, signed); core/embed/firmware/bootloader.bin, a stale Trezor-format bootloader (TRZB, version 2.0.3) that is linked as .bootloader but discarded by --gc-sections (the linker script no longer places it and bl_check.c's functions are not called): not in the image.

5. Language split ​

From the link map of 4.21.0 (lib/hww/linkmap.py; bytes of the image by origin):

originbytessharenote
MicroPython frozen bytecode (generated C arrays, frozen_mpy.o)2,355,80361.4%.flash2; the wallet logic, compiled from Python by mpy-cross: out of scope
C1,362,16335.5%842,978 code, 513,852 read-only data, 1,609 initialised data
fingerprint library (libFpalgorithm.a, no source)44,0081.1%out of scope
Rust (libtrezor_lib.a)31,7030.8%10,312 code; protobuf, MicroPython glue; out of scope
toolchain libraries (newlib nano, libm, libgcc)25,2320.7%no source in the tree
assembly (startup.S, vectortable.s, util.s, gchelper_m3.s, secp256k1's field_10x26_arm.s), headers5,0560.1%
linker fill, vendor header12,7350.3%

Out of scope for cverif, and counted as unverified: the frozen bytecode, Rust, the fingerprint library, the toolchain libraries, and everything that runs on the other chips (THD89 SE images, published encrypted; BLE firmware, not published here).

6. Results ​

With the cverif in tools/cverif.pin (0.1.4 for the bootloader). Triage of every mismatch and constant-time violation is in each result's findings.json; vendor-wide findings in results/onekey/findings.json.

Bootloader 2.8.4 (results, findings): reproduces (fields of the signing step zeroed, including hdrlen, which headertool.py rewrites from 0x3f8 to 0x400). With cverif 0.1.4: 700 functions proved, 67.5% of code bytes (58.0% of source statements and branches; 32.6% with 0.1.1, when the CMSIS units were skipped); 678 initialised objects compared, none differs. 36 mismatches, all cverif false alarms (an argument pointed at the stack guard, HAL __weak callbacks compared in place of the bootloader's, an inline atomic, a static function fitted to its callers, a struct template copied by memcpy, a DMA handle placed in peripheral space). 9 of 135 units are still skipped, six of them for defining a HAL callback the HAL defines __weak (cverif issue 24).

Constant time, 57 violations: one small timing leak: trezor-crypto's bn_cmov and bn_cnegate open with assert((int)(cond == 1) | (int)(cond == 0)), meant to be branch-free; the bootloader is built without NDEBUG and GCC compiles it into two branches on the secret cond, which point_multiply passes from the scalar's digits once per window. The secret scalar here is the ephemeral ECDH key of the MCU–SE session-key exchange (se_sync_session_key_ex), a fresh key per session, and the difference is about a cycle per call. Trezor fixed the assert upstream (assert(cond <= 1), trezor-firmware 7829d7c7, 2026-11-16); OneKey was pointed to that commit on 2026-12-06. Secret-indexed loads (pmult[digit] in point_multiply, Gladman AES's tables in aes_encrypt_key128) are in DTCM, uncached on the Cortex-M7, so they should not show in timing. The rest: rejection sampling and key-range checks (by design), branches on SE frame lengths and transfer status (on the wire), and public data cverif takes as secret in callees (curve constants in flash, the SE's public key, the ensure/__fatal_error path through display, touch and I2C).

Firmware 4.21.0: reproduces (same comparison: the published image with signature, sigmask, code hashes, hash_block and hdrlen zeroed is byte-identical to the build, sha256 29b83635...). cverif has not finished on it yet: the 529 C units are one flag group, and a run with the default budget did not complete in four hours on a shared machine. The target is set up to run with HWW_WORK_LIMIT=30000; results go to results/onekey/pro/4.21.0/ when a run completes. With cverif 0.1.4 the CMSIS units are read (issue 6 fixed); units that define a HAL __weak callback are still skipped (issue 24).

7. Open questions ​

  • Where and how are releases signed? The CI signs with two keys from GitHub secrets; the release carries a 4-of-7 signature. The process between the CI artifact and the release asset is not public.
  • The CI's build environment depends on the runner's /usr/bin/cpp; a build on a machine without one produces different bootloader bytes without failing.
  • libFpalgorithm.a has no source in the repository: what is it built from, and with what?
  • The app channel's bootloaderVersion (2.8.3) disagrees with the image (2.8.4); harmless if it is only a minimum, but undocumented.
  • Signatures are not verified cryptographically here (the vendor header's against the bootloader's keys, the firmware header's against the vendor header's 4-of-7 keys).

OneKey's button devices run a fork of the Trezor One ("legacy") firmware: C, built with arm-none-eabi-gcc for a Cortex-M4 (GigaDevice GD32F470 on the Classic 1S, soft float), with OneKey's own chains, UI and a secure element (SE, "THD89") that holds the seed.

Target: onekey/classic1s (targets/onekey/classic1s.sh, shared steps in targets/onekey/common.sh).

Release channel ​

  • Source and releases: https://github.com/OneKeyHQ/firmware-classic1s. Each version has a GitHub release vX.Y.Z (and vX.Y.Z-btc for the bitcoin-only variant) with three assets:
    • classic1s.X.Y.Z-Stable-<commit7>.signed.bin: the MCU firmware, what we verify;
    • thd89_app_PROD_<date>_<sever>_<commit>_0x10.enc.signed.bin: the SE firmware, encrypted (header magic TF89);
    • classic1s.X.Y.Z-Stable-<commit7>_thd89_....signed.bin: the two concatenated.
  • The file name holds the short source commit; the release's target_commitish holds the full one. t_source checks that the tag resolves to both.
  • OneKey publishes no hashes or fingerprints for its firmware: the release notes don't have any, and the fingerprint fields of the app's update channel (https://data.onekey.so/config.json, key classic1s) are empty. What we record instead is GitHub's own sha256 digest of the asset (checked against the download) and the release metadata (author, dates, commit).
  • The OneKey app installs the combined file from web.onekey-asset.com. t_fetch downloads it too and checks that it is byte-for-byte the GitHub MCU image followed by the GitHub SE blob (true for 3.21.0), so the image verified here is the one the app installs.

Image format ​

legacy/firmware/header.S, image_header in legacy/fw_signatures.h, signing tool legacy/bootloader/firmware_sign.py. Parsed by fwimage.py onekey-legacy.

offsetfield
0x000TRZF
0x004reset handler (Trezor's hdrlen slot, as in T1); the header is always 1024 bytes
0x00Ccode length
0x010Trezor version, always 2.99.99; 0x014 fix version (same)
0x018hardware model (C2B2), 0x01C revision
0x02016 chunk hashes (SHA-256)
0x220sig1..sig4 (64 bytes each)
0x320sigindex1..4
0x3B3purpose (0 general, 1 bitcoin-only)
0x3B7minimum SE version
0x3BBOneKey version (major, minor, patch)
0x3BFTrezor's sigmask/sig slot, unused (zero)

Differences from Trezor One: no 256-byte legacy TRZR header; four signatures (4 of 7 keys, Trezor's v3 "SignMessage" scheme: double SHA-256 of "\x18Bitcoin Signed Message:\n\x20" || SHA-256(header with sig1..4 and sigindex1..4 zeroed)); 256 KiB hash chunks instead of 64 KiB (the first covers the first 255 KiB of code, since the header shares it; the last is padded with 0xff). Zeroing 0x220..0x323 gives what a local build produces. Signatures are not checked cryptographically (see the methodology).

Flash: header at 0x08010000 (FLASH_FWHEADER_START), code at 0x08010400; linker script legacy/gd32_hard/memory_app_1.8.0_gd32.ld.

Build ​

build-docker.sh is Trezor's older script (Alpine 3.15 + Nix 2.4 image, poetry; the toolchain comes from pinned nixpkgs tarballs in shell.nix: gcc-arm-embedded 12.2.Rel1); docs/common/reproducible-build.md is Trezor's document, not adapted to OneKey (it talks about Trezor's tags and the T1 legacy header). The script clones the checkout inside the container to /tmp/trezor-firmware, updates submodules from the network (so the build depends on GitHub serving the pinned submodule commits), runs poetry install (network, from poetry.lock) and legacy/script/cibuild.

The published build script does not work as is for the legacy firmware (3.21.0):

  • the script it generates for the container ends with cp bootloader/*.bin build/bootloader/bootloader.bin and the same for intermediate_fw/*.bin; both globs match two files, so cp fails after the firmware is built, and since the container is --rm and built in /tmp, the firmware is lost;
  • it runs docker run -it; with a pseudo-terminal (script(1)), poetry install stopped without an error message in our run (without -it it works). Not investigated further.

So t_build runs build-docker.sh --skip-core --skip-legacy vX.Y.Z unmodified (with CONTAINER_NAME=onekey-classic1s-env.nix), which only builds the Docker image, then runs the generated legacy script line for line in that image, without -it and without the two failing cp lines (they copy the bootloader and intermediate firmware, not verified here). Inside the container, nix-shell prints an evaluation error for <nixpkgs> (the image's unpinned channel needs a newer Nix); it is only used to find bash, and is harmless.

The script leaves no snapshot of the built tree, so the instrumented rebuild repeats the same steps in the same image with the compiler wrappers, and must give the same firmware.bin (it does).

Reproducibility: yes, for 3.21.0. The published image with sig1..sig4 and their indices zeroed is byte-identical to the local build (sha256 in the result). The signing tool's own "fingerprint" of the build (firmware_sign.py, SHA-256 of the header with signatures zeroed) equals that of the published image, 32d6f50f999f40ff2bdd7a07b8e6202760877c2bb60058f0cea7922bc25ef68f. Note the ELF's .header section has no chunk hashes (firmware_sign.py writes them into the .bin after linking): the transplant reports those 192 bytes as differing, as expected.

Out of scope ​

  • The SE firmware (thd89_*.enc.signed.bin): encrypted, for another processor. Only its presence and hash in the combined file are recorded.
  • The bitcoin-only variant (-btc releases): same pipeline with BITCOIN_ONLY=1, not run.
  • The bootloader (not published as a separate release asset for the Classic 1S) and the Bluetooth (nRF) firmware.
  • Signature validity: not checked.

Results ​

Per release in results/onekey/classic1s/; vendor-wide findings in results/onekey/findings.json.

3.21.0: fetched, tag checked, build reproduces, header hashes check, transplant covers every published byte. 270 translation units linked, 5 flag groups. cverif skips 37 firmware files on two parse limits (cverif issues #1, config.h's STORAGE_BYTES(...);, and #13, an attribute after a function-pointer typedef in tinycbor's cbor.h): fsm.c, config.c, protect.c, se_chip.c, signing.c, ethereum.c among them, so their code is counted as unverified. Constant-time marks: ct/trezor-crypto.ct, ct/secp256k1-zkp.ct, ct/onekey-legacy.ct (the MCU-SE channel, PIN and seed transfers).

OneKey Classic and Mini (repository OneKeyHQ/firmware) ​

The older devices are built from https://github.com/OneKeyHQ/firmware, tags classic/vX.Y.Z and mini/vX.Y.Z, released on that repository's GitHub releases page (e.g. classic.3.12.0-Stable-0205-05bae9f.signed.bin). Same build-docker.sh (honours CONTAINER_NAME), same legacy tree. One difference matters for reproducibility: there legacy/firmware/Makefile puts the build date in the firmware name, NAME=classic.$(VERSION)-Stable-$(shell date +%m%d)-$(COMMIT), and compiles that name in (-DBUILD_ID='"$(NAME)"'). A rebuild on another day therefore differs in that string; the date (0205) is in the published file name, so a rebuild would have to fake the date (e.g. libfaketime) or the comparison must allow for that string. The Classic 1S tree dropped the date (# FIRMWARE_BUILD_DATE=... is commented out). Not run here; adding them means a target per device with ONEKEY_GH=OneKeyHQ/firmware, ONEKEY_TAG=classic/v%s, a date-aware asset pattern, and checking their memory layout and header format against their tree.

Open questions ​

  • Signatures: the four signatures (4 of 7 keys, pubkey_v3 in legacy/fw_signatures.c) are not checked cryptographically.
  • The bootloader is not published as a release asset, but the firmware carries one: legacy/firmware/bootloader.dat (64 KiB, a prebuilt binary committed to the tree) is compiled in as bl_data and installed by bl_check.c when the device's bootloader is an older known one (bl_check.txt). For 3.21.0 it is bootloader 2.1.3 (double SHA-256 1374f712...af8e, the last line of bl_check.txt). Whether the tree's legacy/bootloader sources build to that blob is not checked yet (the vendor build compiles a bootloader but its output is discarded); that would make it a separate target.
  • poetry install stopping under docker run -it: not diagnosed.
  • The bitcoin-only variant (-btc releases) and the Classic/Mini (OneKeyHQ/firmware) are not run.
  • The SE firmware is encrypted: nothing about it can be checked from the release.

Results are produced by scripts anyone can re-run. MIT licensed.