Skip to content

KeepKey

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

Devices

Results

No release verified yet.

About KeepKey's firmware ​

Repository: https://github.com/keepkey/keepkey-firmware (LGPLv3). Facts below were checked against the repository at tag v7.16.0 (commit 4f94a63b, 2026-10-15, the head of master when this was written), the tags v7.14.2 and v7.14.3, and the published release files. Research date: 2026-12-04; targets written and run (to extract) 2026-12-05, section 6.

Verdict: the most feasible of the four, and close to the Trezor One pipeline. The firmware is C only, for a Cortex-M3, built in a Docker image pinned by digest, and the vendor publishes the source commit and the expected payload hash with each recent release. The main extra work is a 256-byte header parser and getting libopencm3, which is prebuilt inside the build image, into the source bundle.

1. Device, MCU, published images ​

itemvaluesource
deviceKeepKey (one model)
MCUSTM32F205, 1 MiB flash (Cortex-M3, no FPU)include/keepkey/board/memory.h (flash map, FLASH_TOTAL_SIZE 1 MiB); cmake/caches/device.cmake (-mcpu=cortex-m3 -msoft-float)
secure elementnone

Flash layout (include/keepkey/board/memory.h):

rangecontentpublished?
0x08000000–0x08003FFFbootstrap (tools/bootstrap/)no (factory only)
0x08004000–0x0800FFFFstorage—
0x08020000–0x0805FFFFbootloader (tools/bootloader/)only inside blupdater.bin (below)
0x08060000–0x080FFFFFfirmware: 256-byte metadata header, code from 0x08060100yes, every release

Published images:

  • Firmware: firmware.keepkey.bin on each GitHub release (multi-coin). From v7.14.3 there is also a Bitcoin-only build, firmware.keepkey.bitcoin-only.bin (v7.14.3 is a Bitcoin-only release; multi-coin devices stay on v7.14.2, per its release notes).
  • Bootloader: never published on its own. It is shipped as the payload of blupdater.bin, a firmware-format image (tools/blupdater/) that writes the bootloader it carries. The last one is bootloader 2.1.4, attached to release v7.3.2 (tags v7.3.2 and bl_v2.1.4 are the same commit 0591b1ce, 2022-04-19). Its sha256 6bb7cfd2…78e620 is the one the KeepKey Vault manifest lists for bl_v2.1.4 (keepkey/keepkey-vault, firmware/releases.json). CMakeLists.txt at v7.16.0 already says bootloader 2.1.5, which has not been released.
  • Older releases (5.x–6.x) also carried binaries.tar.bz2 + .sig, and variant images (firmware.salt.bin, variant.fox.bin); not relevant now.

2. Release channel ​

  • Download: GitHub releases, https://github.com/keepkey/keepkey-firmware/releases/download/<tag>/<file>. KeepKey's docs (https://docs.keepkey.com/docs/firmware) point there for "installable firmware". The desktop apps carry their own copies: keepkey/keepkey-vaultfirmware/releases.json / manifest.json still list v7.10.0 as latest and mirror the binaries in that repository, so the GitHub release is the authoritative channel to fetch.
  • Versioning: tags vX.Y.Z (signed annotated tags since at least v7.14.2; tagger "highlander"). t_releases can list releases through the GitHub API and keep those with a firmware.keepkey*.bin asset. Tags without a release exist (v7.16.0 as of this writing), and so do releases without firmware (v7.1.5, v6.2.0-hotfix.0, emulator-dylib-latest).
  • Metadata, from v7.14.0 on (bodies read for v7.14.1 to v7.14.3; v7.14.0 only for its commit):
    • the release body states Source commit: <40 hex> and the tag, the exact build command, and Expected hash: of the payload (tail -c +257 file | sha256);
    • from v7.14.1, an attached HASHES.txt with the full-file sha256, the payload sha256 and the commit;
    • v7.14.0 names its source commit 810f0d3f (which the tag resolves to) and, separately, the merge commit on master; the pipeline should check the tag against the first;
    • GitHub's own asset digests (sha256: in the API). Releases up to v7.10.0 have only the binary and a short body, so the commit can only come from the tag.
  • Signatures: three secp256k1 ECDSA signatures inside the image (3-of-5 keys, slots given in the header; public keys in include/keepkey/board/pubkeys.h). No detached signature or PGP.

Checked: v7.14.3 firmware.keepkey.bitcoin-only.bin is 362396 bytes, sha256 74b6b2d0…5ecbec, both as in HASHES.txt; the release names commit f58ba5d4…, which is what tag v7.14.3 resolves to.

3. Image format ​

From include/keepkey/board/memory.h (comment and app_meta_td), tools/firmware/header.s and lib/board/signatures.c:

offsetsizefieldin a local buildin the release
0x004magic KPKYsamesame
0x044codelen = file size − 256 (linker symbol _codelen)samesame
0x083signature key indices (1..5)0 0 0e.g. 1 2 3
0x0B1sig_flag (preserve storage)11
0x0C4meta_flags00
0x1048reservedzerozero
0x403×64signatures (r‖s)zerosignatures
0x100codelencode: vector table at 0x08060100
  • The image is loaded at 0x08060000 (FLASH_META_START); the header is part of the ELF (section .header from header.s), so the transplant covers it like Trezor One's.
  • What is signed (signatures_ok()): sha256(code[0:codelen]), each of the three signatures checked with ecdsa_verify_digest against pubkey[index-1]. The header itself is not signed.
  • To get the local build from the release: zero bytes 0x08–0x0A and 0x40–0xFF. The vendor's own check skips the whole header (tail -c +257), which is the same thing plus the unsigned header fields.
  • Header checks (fwimage.py keepkey): magic, codelen == len − 256, indices distinct in 1..5, and the three ECDSA signatures (secp256k1, over sha256(code), the digest taken as is, as trezor-crypto's ecdsa_verify_digest) against the keys in the tag's pubkeys.h. unsigned.bin zeroes the indices and signatures; code.bin is the payload, at 0x08060100. (memory.h's comment on FLASH_APP_START says 0x0806_0200; it is 0x08060100.)

Checked on v7.14.3: magic KPKY, codelen 0x0005869c = 362396 − 256, indices 1/2/3, sig_flag 1; the vector table at file offset 0x100 has reset handler 0x0806049f.

4. Build ​

  • Documented procedure (README.md, and each recent release body): git checkout <tag> && git submodule update --init --recursive && ./scripts/build/docker/device/release.sh (add -DKK_BITCOIN_ONLY=ON for the Bitcoin-only image), then tail -c +257 bin/firmware.keepkey.bin | sha256sum.
  • Environment: release.sh runs kktech/firmware@sha256:7438e539…7fa2 (pinned by digest at v7.14.2 and later; v7.10.0 and earlier used the mutable tag kktech/firmware:v15). The image (Dockerfile) has GNU Arm 10-2020-q4-major, protoc 3.5.1, nanopb 0.3.9.8, and libopencm3 prebuilt at image build time (branch docker-v9 of keepkey/libopencm3).
  • Build system: CMake with cmake/caches/device.cmake; flags -mthumb -mcpu=cortex-m3 -msoft-float -ffunction-sections -fdata-sections -fno-common -fstack-protector-all -Os -std=gnu99, linked with --gc-sections against libopencm3_stm32f2, newlib (-lc -lm). The build embeds the git commit (GIT_SHA1), so it must be built from the tag checkout.
  • Reproducibility:
    • claimed by the vendor (release bodies give an expected payload hash; docs/Release.md has the maintainers build on several machines and compare);
    • known exceptions: v6.2.2 and v6.3.0 did not reproduce (issue #212, cited in README.md); releases before v6.1.0 have no header slot in the local build;
    • WalletScrutiny (https://old.walletscrutiny.com/hardware/keepKey): "reproducible" for 7.1.7 (2021-07-31, after maintainer instructions to drop one token JSON file) and for 7.10.0 (2025-02-28). The current page (https://walletscrutiny.com/hardware/keepKey, dated 2026-10-30, version 7.14.3) shows verdict sourceavailable with no new build result, so 7.14.x has no independent reproduction on record there. Not rebuilt here.

5. Language split ​

All firmware code is C, plus a little assembly:

  • lib/ (board, firmware, transport, variant, rand): KeepKey's own C. C++ in the tree is only tests, fuzzers and the emulator.
  • deps/crypto/trezor-firmware (KeepKey's fork of trezor-firmware, submodule; only its crypto/ is used): trezor-crypto, largely shared with Trezor One.
  • generated nanopb .pb.c from deps/device-protocol.
  • deps/qrenc/QR-Code-generator.
  • deps/sca-hardening/SecAESSTM32: ANSSI's masked AES, aes.c plus affine_aes.S (hand-written assembly).
  • libopencm3 (C, outside the tree, in the build image).
  • newlib/libgcc from the toolchain.

So in principle the whole image is a cverif target. The best parts are the same as Trezor One's: trezor-crypto, the protobuf handling and the signing flows. Results on trezor-crypto functions can be compared with Trezor One's directly.

The bootloader (tools/bootloader/, plus lib/board, trezor-crypto, libopencm3) is also C only and a good second target, but its image is published only as the payload of blupdater.bin (see the plan).

6. Targets: keepkey/keepkey and keepkey/keepkey-btconly ​

targets/keepkey/common.sh holds the steps; keepkey.sh (multi-coin, firmware.keepkey.bin) and keepkey-btconly.sh (firmware.keepkey.bitcoin-only.bin, from v7.14.3) set the asset and the extra cmake option. Run on 2026-12-05: keepkey/keepkey 7.14.2 and keepkey/keepkey-btconly 7.14.3, steps fetch, source, build, extract. Both reproduce.

stepwhat it does
t_releasesGitHub releases API: the releases with the target's asset
t_fetchthe asset (checked against GitHub's digest) and HASHES.txt; Source commit: and Expected hash: from the release body; fails unless the file's full and payload (tail -c +257) sha256 agree with HASHES.txt and the body, and the two name the same commit
t_sourceshallow clone of the tag, which must resolve to that commit; git submodule update --init --recursive as the vendor says (it pulls the whole trezor-firmware fork with micropython and its submodules, ~1.5 GB, though only crypto/ is built); submodule commits in source.json
t_buildmulti-coin: scripts/build/docker/device/release.sh unmodified; Bitcoin-only: the release notes' command (release.sh's docker run with -DKK_BITCOIN_ONLY=ON). The payload must equal the published one (official.json). The container release.sh leaves (no --rm) is removed. Then the instrumented rebuild (below)
t_extractfwimage.py keepkey, with the keys from the tag's pubkeys.h; transplant at 0x08060000 (the header is the ELF's .header section)

The instrumented rebuild runs in the same pinned image, at the same paths (/root/keepkey-firmware, read-only, and /root/build), with wrappers for arm-none-eabi-{gcc,g++,cc,c++,ar} first on PATH before cmake runs, so that cmake records the wrapper as the compiler (no compile database is needed), and make -j. Before that it rebuilds the image's prebuilt libopencm3 (/root/libopencm3: make clean && make, as the Dockerfile did) with the wrappers on. The rebuilt libopencm3_stm32f2.a has the same members, byte for byte, as the image's (the archive file differs: ar timestamps), and the firmware linked from it is identical, so libopencm3's 21 linked units come with their sources. The image's libopencm3 is a clean checkout of keepkey/libopencm3 branch docker-v9 at bcfdcc09 (the branch's current head). .s files are assembled with -x assembler-with-cpp (cmake's CMAKE_ASM_FLAGS; isr.s has #ifdefs), so the target adds their preprocessed text to the bundle as export_bundle.py does for .S.

Two fixes outside the target came with it: export_bundle.py now maps the members of archives made with ar q (CMake's ar qc; before, every CMake archive member was "without source"), and linkmap.py finds an archive member's object outside the archive's directory (CMake keeps the archives in build/lib, the objects under each target's CMakeFiles/).

Results of the run:

7.14.2 multi-coin7.14.3 Bitcoin-only
published sha256caa53bd4…19d68df74b6b2d0…5ecbec
payload sha256 (= vendor build)45fe90c1…f533e9fa4cf84bfe…87488f64
codelen593876362140
key indices; signatures1, 2, 3; all three verify1, 2, 3; all three verify
unsigned.bin = vendor build, transplantidentical, 0 bytes differ, nothing uncoveredidentical, 0 bytes differ, nothing uncovered
units in the bundle166: 145 from the KeepKey tree (14 of them generated .pb.c, 5 assembly), 21 libopencm3129
functions (distinct FUNC addresses in flash, newlib/libgcc included)13481085
image by origin (composition.txt)C 92.5 %, toolchain libraries 6.3 %, assembly 1.1 %C 88.8 %, toolchain 9.2 %, assembly 1.9 %

Every linked input from the build tree has its source in the bundle; only newlib, libnosys and libgcc members have none (toolchain libraries, as for the other targets).

Notes for the verify step and the findings:

  • Prebuilt code: libopencm3 is built inside the vendor's image, not from the release's source tree (see above: rebuilt and identical). The .pb.c files are generated by the image's nanopb 0.3.9.8 generator; the generated sources are in the bundle. The trezor-firmware submodule also vendors libopencm3 and secp256k1-zkp, which are not built.
  • -fstack-protector-all with a plain global __stack_chk_guard (lib/board/keepkey_board.c, set from random32() in keepkey_main.c): expect cverif issue 16 (false MISMATCH on every function with a canary), as on Trezor One. The firmware's linker script also defines __stack_chk_guard = _ram_end - 8, which overrides the C variable's address: the canary lives at 0x2001f7f8, the same address as _stack, the initial process stack pointer (the stack grows down from there, so the word is just above the stack, not in it).
  • include/keepkey/board/winusb_defs.h uses u"..." literals: expect issue 17 on winusb.c.
  • affine_aes.S (SecAESSTM32, ANSSI's masked AES) and memcmp_cst.S (lib/board) are hand-written assembly.
  • CT_SPECS: trezor-crypto. KeepKey's storage is its own (lib/firmware/storage.c), so trezor-storage doesn't apply, and secp256k1-zkp isn't linked.

Not done: verify and report (days of CPU, to be scheduled); releases before v7.14.0 (no source commit in the metadata, mutable kktech/firmware:v15 image); the bootloader (only inside blupdater.bin, see section 4 and below).

Bootloader as a separate target, still to do: build blupdater.elf and bootloader.elf at v7.3.2, check the release's blupdater.bin (a KPKY image) against the build, locate the payload (payload.bin = objcopy -O binary bootloader.elf) inside it, and verify the payload at 0x08020000 against the bootloader's bundle. Building a 2022 tag with the v15 image may or may not still reproduce; not tried.

Priority: high. First of the four to implement (done up to extract).

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