KeepKey
KeepKey's published firmware, checked against its published source with cverif.
Devices
KeepKey
STM32F205 Cortex-M3, multi-coin firmware (C only)
Not verified yet
KeepKey
STM32F205 Cortex-M3, Bitcoin-only firmware (C only; from v7.14.3)
Not verified yet
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
| item | value | source |
|---|---|---|
| device | KeepKey (one model) | |
| MCU | STM32F205, 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 element | none |
Flash layout (include/keepkey/board/memory.h):
| range | content | published? |
|---|---|---|
0x08000000–0x08003FFF | bootstrap (tools/bootstrap/) | no (factory only) |
0x08004000–0x0800FFFF | storage | — |
0x08020000–0x0805FFFF | bootloader (tools/bootloader/) | only inside blupdater.bin (below) |
0x08060000–0x080FFFFF | firmware: 256-byte metadata header, code from 0x08060100 | yes, every release |
Published images:
- Firmware:
firmware.keepkey.binon 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 releasev7.3.2(tagsv7.3.2andbl_v2.1.4are the same commit0591b1ce, 2022-04-19). Its sha2566bb7cfd2…78e620is the one the KeepKey Vault manifest lists forbl_v2.1.4(keepkey/keepkey-vault,firmware/releases.json).CMakeLists.txtatv7.16.0already 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.jsonstill 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_releasescan list releases through the GitHub API and keep those with afirmware.keepkey*.binasset. Tags without a release exist (v7.16.0as 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, andExpected hash:of the payload (tail -c +257 file | sha256); - from v7.14.1, an attached
HASHES.txtwith 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 onmaster; 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.
- the release body states
- 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:
| offset | size | field | in a local build | in the release |
|---|---|---|---|---|
0x00 | 4 | magic KPKY | same | same |
0x04 | 4 | codelen = file size − 256 (linker symbol _codelen) | same | same |
0x08 | 3 | signature key indices (1..5) | 0 0 0 | e.g. 1 2 3 |
0x0B | 1 | sig_flag (preserve storage) | 1 | 1 |
0x0C | 4 | meta_flags | 0 | 0 |
0x10 | 48 | reserved | zero | zero |
0x40 | 3×64 | signatures (r‖s) | zero | signatures |
0x100 | codelen | code: vector table at 0x08060100 |
- The image is loaded at
0x08060000(FLASH_META_START); the header is part of the ELF (section.headerfromheader.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 withecdsa_verify_digestagainstpubkey[index-1]. The header itself is not signed. - To get the local build from the release: zero bytes
0x08–0x0Aand0x40–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, oversha256(code), the digest taken as is, as trezor-crypto'secdsa_verify_digest) against the keys in the tag'spubkeys.h.unsigned.binzeroes the indices and signatures;code.binis the payload, at0x08060100. (memory.h's comment onFLASH_APP_STARTsays0x0806_0200; it is0x08060100.)
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=ONfor the Bitcoin-only image), thentail -c +257 bin/firmware.keepkey.bin | sha256sum. - Environment:
release.shrunskktech/firmware@sha256:7438e539…7fa2(pinned by digest at v7.14.2 and later; v7.10.0 and earlier used the mutable tagkktech/firmware:v15). The image (Dockerfile) has GNU Arm10-2020-q4-major, protoc 3.5.1, nanopb 0.3.9.8, andlibopencm3prebuilt at image build time (branchdocker-v9ofkeepkey/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-sectionsagainstlibopencm3_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.mdhas 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
sourceavailablewith no new build result, so 7.14.x has no independent reproduction on record there. Not rebuilt here.
- claimed by the vendor (release bodies give an expected payload hash;
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 itscrypto/is used): trezor-crypto, largely shared with Trezor One.- generated nanopb
.pb.cfromdeps/device-protocol. deps/qrenc/QR-Code-generator.deps/sca-hardening/SecAESSTM32: ANSSI's masked AES,aes.cplusaffine_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.
| step | what it does |
|---|---|
t_releases | GitHub releases API: the releases with the target's asset |
t_fetch | the 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_source | shallow 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_build | multi-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_extract | fwimage.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-coin | 7.14.3 Bitcoin-only | |
|---|---|---|
| published sha256 | caa53bd4…19d68df | 74b6b2d0…5ecbec |
| payload sha256 (= vendor build) | 45fe90c1…f533e9fa | 4cf84bfe…87488f64 |
| codelen | 593876 | 362140 |
| key indices; signatures | 1, 2, 3; all three verify | 1, 2, 3; all three verify |
unsigned.bin = vendor build, transplant | identical, 0 bytes differ, nothing uncovered | identical, 0 bytes differ, nothing uncovered |
| units in the bundle | 166: 145 from the KeepKey tree (14 of them generated .pb.c, 5 assembly), 21 libopencm3 | 129 |
| functions (distinct FUNC addresses in flash, newlib/libgcc included) | 1348 | 1085 |
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.cfiles 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-allwith a plain global__stack_chk_guard(lib/board/keepkey_board.c, set fromrandom32()inkeepkey_main.c): expect cverif issue 16 (falseMISMATCHon 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 at0x2001f7f8, 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.husesu"..."literals: expect issue 17 onwinusb.c.affine_aes.S(SecAESSTM32, ANSSI's masked AES) andmemcmp_cst.S(lib/board) are hand-written assembly.CT_SPECS:trezor-crypto. KeepKey's storage is its own (lib/firmware/storage.c), sotrezor-storagedoesn'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).