BB
← All projectsBitBox

BitBox02 firmware

Firmware and bootloader for BitBox02 signing devices.

BitcoinHardware walletsNormal
Repository coverage

787 commits in the local evidence base

Every captured commit receives deterministic security triage and a separate communication-quality score. Security candidates and broader second-pass signals receive full-patch Ollama analysis.

239security candidates161second-pass queue727AI analyses
72commits · 30 days
144commits · 60 days
316commits · 180 days
697commits · 365 days
Backfill bands
Aug 5 → Feb 6335 seen28 candidatesComplete
Feb 6 → Jun 6265 seen19 candidatesComplete
Jun 6 → Jul 619 seen5 candidatesComplete
Jul 6 → Aug 526 seen3 candidatesComplete
Commit communication

Does the history explain itself?

Message quality measures whether a commit identifies its scope, purpose, rationale, testing, and supporting references. It does not change the security-severity score.

58/100 average clarity
69Strong · 80–100
325Adequate · 60–79
305Thin · 40–59
88Opaque · 0–39
26security candidates with opaque commit messaging
Read the scoring rubric →
Developer activity

Who is changing the project?

Public Git author strings; identities are not independently verified.

DeveloperCommitsCandidatesAnalyzedHigh riskMessage avg.
Marko Bencun452133424357
benma's agent11240106164
Niklas Dusenlund15543134057
cedwies12512063
Tomas Vrba10410071
Cedric Wiese12312049
Yasser Aziza333070
Jad14210060
Sebastian Sutter222050
thisconnect212072
benma212074
Niklas111035
Analysis record

Published AI watches

Last scanned 8 minutes ago

Informational 15 AI analysisMessage 58 · Thin
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Merge commit 'refs/pull/2123/head' of https://github.com/BitBoxSwiss/bitbox02-firmware

This commit only adds two digital signature files for an already-released firmware version (v9.25.0). These are third-party reproducible-build assertions by a user named 'yaziza', not changes to the firmware source code. There is no code c…

b8bbbb64by Marko Bencun+0−02 files
No security note in commit
Informational 0 AI analysisMessage 58 · Thin
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Merge commit 'refs/pull/2124/head' of https://github.com/BitBoxSwiss/bitbox02-firmware

This commit only adds two digital signature files for an already-released firmware version (v9.27.1). These are release attestation signatures from a contributor named 'yaziza'. There is no code change, no firmware change, and nothing in t…

392ac2ffby Marko Bencun+0−02 files
No security note in commit
Informational 12 AI analysisMessage 45 · Thin
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Merge branch 'nickez/bb02-finalize-elf'

This commit is a build-system refactor that unifies how firmware image headers are generated for the BitBox02 and BitBox03. It replaces a device-specific Python script and a C header placeholder with a shared Python tool and JSON manifests…

New input validation in image_header.py for magic, flags, product_id, monotonic_version, marketing_version, image length, and zeroed signature slotsRust parsing now validates slot length, header length alignment, and image length bounds before deriving code lengthRemoval of prepare-stage1-unsigned path reduces attack surface in build tooling
810d3e87by Niklas Dusenlund+573−14413 files
No security note in commit
Informational 12 AI analysisMessage 78 · Adequate
BB BitBoxBitBox02 firmware BitcoinHardware wallets

bootloader: use shared stage1 header tool

This commit is a build-system refactoring for the BitBox02 bootloader. It replaces a C-language placeholder for the bootloader's stage1 header with a Python tool that generates the same header from JSON manifests during the build. The old …

5b14742fby Niklas Dusenlund+52−1105 files
No security note in commit
Low 27 AI analysisMessage 83 · Strong
BB BitBoxBitBox02 firmware BitcoinHardware wallets

scripts: unify the BitBox image format

This commit refactors the firmware image header format used by BitBox hardware wallets so that BitBox02 and BitBox03 share a single 1024-byte layout. It adds new metadata fields (product ID, version numbers, signature slots) and switches t…

Changed binary image header format and parserAdded checked integer conversions for 64-bit image lengthAdded bounds checks on slot length, header length, and image length in Rust loader
9403e6feby Niklas Dusenlund+524−376 files
No security note in commit
Informational 15 AI analysisMessage 68 · Adequate
BB BitBoxBitBox02 firmware BitcoinHardware wallets

scripts: rename image header tool

This commit simply renames a build script from bitbox03_image_header.py to image_header.py and updates all references in the Makefile and Rust build files. The script's contents and behavior are unchanged. There is no security issue here.

29d6720aby Niklas Dusenlund+7−75 files
No security note in commit
Informational 15 AI analysisMessage 70 · Adequate
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Firmware v9.27.1 verification (yaziza)

This commit adds two digital signature files for BitBox02 firmware version 9.27.1. These signatures are a third-party reproducible-build verification (called an 'assertion') created by an independent contributor named yaziza. The commit do…

6d2e6955by Yasser Aziza+0−02 files
No security note in commit
Informational 15 AI analysisMessage 70 · Adequate
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Firmware v9.25.0 verification

This commit adds two digital signature files to the repository. They are third-party reproducible-build attestations (assertions) for the already-released BitBox02 firmware version 9.25.0. The commit does not change any firmware source cod…

b454a627by Yasser Aziza+0−02 files
No security note in commit
Low 34 AI analysisMessage 50 · Thin
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Merge remote-tracking branch 'agent/benma-agent/hww-start-session'

This commit adds a new 'session reset' command to the BitBox02 hardware wallet's USB protocol. It lets the host computer cleanly reset the device connection if a previous operation was interrupted, instead of leaving the device stuck mid-t…

New USB control command added to host-wallet protocolReset path cancels async task, resets Noise state, unlocks USB processing, and clears output queueU2F UI ownership check prevents reset from interrupting an active U2F workflow
04302490by Marko Bencun+485−1713 files
No security note in commit
Informational 15 AI analysisMessage 78 · Adequate
BB BitBoxBitBox02 firmware BitcoinHardware wallets

py: make session reset an API setup helper

This is a routine Python code refactor. It moves an existing 'reset session' command from one internal class to another and adds a version check so older firmware simply skips it. There is no security bug being fixed here; it is purely org…

50a9e76aby benma's agent+28−163 files
No security note in commit
Moderate 62 AI analysisMessage 78 · Adequate
BB BitBoxBitBox02 firmware BitcoinHardware wallets

hww: reset sessions on host reconnect

This commit fixes a bug in the BitBox02 hardware wallet where unplugging the USB cable at the wrong moment could leave a half-finished operation running. If the device stayed powered and a new host reconnected, the new host's first message…

Fixes cross-session state confusion on USB reconnectAdds explicit session reset command to cancel stale async workflowsResets Noise cryptographic session to prevent old-key encrypted responses
6679936fby benma's agent+473−1712 files
Vendor flagged security relevance
Informational 17 AI analysisMessage 58 · Thin
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Merge commit 'refs/pull/2073/head' of https://github.com/BitBoxSwiss/bitbox02-firmware

This commit adds a new recovery-word entry screen for the upcoming BitBox03 hardware wallet. It is a large feature patch: it introduces a dedicated BIP39 wordlist keyboard, a new recovery-words review screen, and changes how the device han…

New UI workflow distinguishes 'back' from 'cancel' during seed restoration, reducing accidental aborts.Cancel actions still require an explicit confirmation prompt before the restore is abandoned.Wordlist keyboard disables keys that cannot lead to a valid BIP39 word, preventing invalid-word compositions at the widget level.
6b04e006by Marko Bencun+7010−24621 files
No security note in commit
Low 47 AI analysisMessage 50 · Thin
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Merge remote-tracking branch 'agent/benma-agent/show-erc20-contract'

This commit improves the BitBox02 hardware wallet's Ethereum token-approval screen. When a user signs an ERC20 token transfer, the device now also shows the token's smart-contract address if the token symbol is ambiguous (the same ticker, …

UI hardening: adds contract-address confirmation for ERC20 tokens with ambiguous or unknown symbolsRegistry validation: rejects payment requests for tokens not present in the firmware's ERC20 registryBuild-time ambiguity detection: generates a sorted list of units shared by multiple contracts
410df562by Marko Bencun+203−123 files
No security note in commit
Low 26 AI analysisMessage 50 · Thin
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Merge remote-tracking branch 'agent/benma-agent/bootloader-descriptor-compat'

This commit relaxes a version check in the BitBox02 bootloader upgrade code. Previously, the firmware installer required that a stage0 bootloader descriptor's version exactly matched the currently expected image version. Now it accepts des…

Strict version equality check removed from bootloader descriptor parsingChange located in bootloader upgrade / firmware installer verification pathNo bounds, length, or pointer validation changes observed
6dccfd24by Marko Bencun+19−72 files
No security note in commit
Moderate 53 AI analysisMessage 45 · Thin
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Merge branch 'nickez/bb02-utf8-safe'

This commit hardens the BitBox02 firmware so it stops trusting that incoming text strings are valid UTF-8 or plain ASCII. It replaces risky C string copies with length-checked, UTF-8-aware helpers, rejects non-ASCII characters at UI bounda…

Replaced snprintf-based string copies with length-bounded UTF-8-aware copiesAdded explicit length parameter to memory_set_device_name and reject embedded/invalid nullsAdded printable-ASCII enforcement at Rust UI boundary before C rendering
0bbdf6f0by Niklas Dusenlund+338−9625 files
No security note in commit
Low 41 AI analysisMessage 28 · Opaque
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Merge branch 'benma/ub'

This commit fixes a coding guideline violation in the BitBox02 factory setup code. A 32-byte buffer that receives output from a Rust function was not initialized to zeroes before use. The accompanying documentation now explicitly requires …

Uninitialized stack buffer used as output buffer for Rust/C FFI callDefensive zero-initialization added to prevent use of stale stack data on error or partial write pathsProject coding guidelines updated to mandate zero-initialization for rust_util_bytes_mut buffers
8a6fd97bby Marko Bencun+3−12 files
No security note in commit
Low 35 AI analysisMessage 68 · Adequate
BB BitBoxBitBox02 firmware BitcoinHardware wallets

oled: hold display in reset during startup

This commit fixes a display behavior issue during startup of the BitBox02 hardware wallet. Previously, when the device turned on, the screen's reset pin was left in a state that could allow leftover images or text from an earlier session t…

Information disclosure via residual display content during bootOLED reset pin sequencing hardeningDefense against stale/misleading UI state before verified firmware initializes display
cdb27835by Niklas Dusenlund+2−11 file
Vendor flagged security relevance
Informational 18 AI analysisMessage 50 · Thin
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Merge remote-tracking branch 'agent/benma-agent/factorysetup-trim-unused'

This commit trims the BitBox02 factory-setup firmware image by switching stored root attestation public keys from 65-byte uncompressed to 33-byte compressed secp256k1 keys, and by using a smaller static secp256k1 verification context inste…

Change in trusted public-key table format and derivation logicSwitch to static/no-precomp secp256k1 verification contextAddition of secp256k1 self-test at boot
554a0558by Marko Bencun+457−5647 files
No security note in commit
Low 37 AI analysisMessage 50 · Thin
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Merge remote-tracking branch 'agent/benma-agent/validate-py-antiklepto-signatures'

This commit adds extra safety checks in the BitBox02 Python library for ECDSA signatures used in Bitcoin and Ethereum signing. It now validates that signatures have the correct length, use valid numbers, and use the safer low-S form. It al…

Defensive validation added for ECDSA signature format and low-S encodingRecovery ID range validation added for recoverable signaturesAnti-Klepto verification now rejects malformed/malleable signatures before nonce verification
0d1a7997by Marko Bencun+152−65 files
Vendor flagged security relevance
Informational 19 AI analysisMessage 50 · Thin
BB BitBoxBitBox02 firmware BitcoinHardware wallets

Merge remote-tracking branch 'agent/benma-agent/scroll-payment-request-memo-name'

This commit tweaks how the BitBox02 hardware wallet displays a payment-request memo on screen. It changes the label from 'Memo from\n\nMerchant' to 'Memo from: Merchant' and makes the screen scrollable so long merchant names don't get cut …

No security-relevant signal in commit message or diffUI/UX change only: text formatting and scrollabilityNo memory-safety, cryptographic, or authorization changes observed
be375664by Marko Bencun+115−66 files
No security note in commit
Repository ledger

Explore captured commits

Expand any commit for its author, full message, clarity score, changed files, triage signals, analysis, and source link.

AI review queuedAdd bitbox03-boot1by Niklas Dusenlund · 473da108 · May 7, 2026 · 11 filesMessage 28 · OpaqueInformational 15Details
Commit message · Niklas Dusenlund

Add bitbox03-boot1

28/100 · OpaqueMessage clarity
✓ Subject identifies a change! No meaningful explanatory body
Why it was queued
second-pass: opaque commit message
AI analysis · Informational 15/100

This commit adds a new first-stage bootloader component called bitbox03-boot1 for the BitBox03 hardware wallet. It is purely additive: it wires a new Rust binary into the build system, adds a flashing script, and provides a small program that validates a firmware image header and then jumps to the main firmware. Nothing in the commit changes existing security behavior or fixes a known vulnerability.

AI review queuedAdd bitbox03-boot0by Niklas Dusenlund · 524aaa30 · May 7, 2026 · 14 filesMessage 28 · OpaqueInformational 15Details
Commit message · Niklas Dusenlund

Add bitbox03-boot0

28/100 · OpaqueMessage clarity
✓ Subject identifies a change! No meaningful explanatory body
Why it was queued
second-pass: opaque commit message
AI analysis · Informational 15/100

This commit adds a new first-stage bootloader component called bitbox03-boot0 for an upcoming BitBox03 hardware wallet. It is purely additive development code: it introduces build targets, a linker script, flashing scripts, and a small Rust program that validates and then launches the next-stage bootloader (boot1). There is no indication of a bug fix or security patch, and no disclosed vulnerability.

Lower-priorityAdd bitbox-platform-stm32u5 and stm32u5-sysby Niklas Dusenlund · e7c7b741 · May 7, 2026 · 12 filesMessage 45 · ThinTriage 0Details
Commit message · Niklas Dusenlund

Add bitbox-platform-stm32u5 and stm32u5-sys

45/100 · ThinMessage clarity
✓ Descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
AI review queuedcleanup: remove unused crateby Niklas Dusenlund · c60f1cbd · May 7, 2026 · 14 filesMessage 35 · OpaqueInformational 15Details
Commit message · Niklas Dusenlund

cleanup: remove unused crate

35/100 · OpaqueMessage clarity
✓ Descriptive subject! No meaningful explanatory body
Why it was queued
second-pass: opaque commit message
AI analysis · Informational 15/100

This commit simply deletes an unused third-party Rust crate (cmake) from the project's vendored dependencies. It is a cleanup change with no functional code modifications and no apparent security relevance.

AI review queuedlvgl-sys: remove cmake buildby Niklas Dusenlund · 6a279a9b · May 6, 2026 · 7 filesMessage 68 · AdequateInformational 17Details
Commit message · Niklas Dusenlund

lvgl-sys: remove cmake build

Build LVGL directly with cc from an explicit source list and drop the
cmake crate dependency. Use the shared bitbox-lvgl-sys lv_conf.h for the
BB03 graphical simulator and remove the simulator-specific duplicate
config.

Remove cross compilation support in lvgl-sys for now.

68/100 · AdequateMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
Why it was queued
second-pass: broader security terminology
AI analysis · Informational 17/100

This commit changes how a graphics library (LVGL) is compiled into the BitBox02 firmware build. It removes the CMake-based build and instead compiles the library's C source files directly using Rust's cc crate. It also merges a separate simulator-specific configuration file into a shared one. The visible configuration changes are: color depth increased from 16 to 32 bits, refresh period shortened from 33 ms to 17 ms, and log level changed from warnings to informational messages. These are build-system and configuration cleanups; there is no direct evidence in the commit of a security vulnerability being fixed.

Lower-prioritytooling: Move rust tools out of dockerfileby Niklas Dusenlund · b47b3145 · May 4, 2026 · 3 filesMessage 60 · AdequateInformational 15Details
Commit message · Niklas Dusenlund

tooling: Move rust tools out of dockerfile

It is easier to install the right tools if you aren't using docker.

60/100 · AdequateMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body
AI analysis · Informational 15/100

This commit is a routine developer tooling change. It moves the installation of Rust compiler components (such as code formatting, linting, and target platform support) out of the Docker build script and into a standard Rust toolchain configuration file. There is no indication this change fixes or introduces a security issue.

Lower-prioritybuild: run vendoring script from src/rustby Niklas Dusenlund · bd3d0f14 · May 4, 2026 · 2 filesMessage 84 · StrongInformational 15Details
Commit message · Niklas Dusenlund

build: run vendoring script from src/rust

Run rust vendorings script from src/rust so that the correct rust
toolchain is picked up.

84/100 · StrongMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides an explanatory body✓ Explains rationale or failure mode
AI analysis · Informational 15/100

This commit is a build-script maintenance change. It changes how a Rust dependency-vendoring script is invoked so that the correct Rust compiler version is automatically selected. There is no user-facing feature change and no indication of a security problem being fixed.

AI review queuedpayment_request: derive validation addresses onceby Marko Bencun · 54f09391 · Apr 30, 2026 · 5 filesMessage 45 · ThinInformational 18Details
Commit message · Marko Bencun

payment_request: derive validation addresses once

45/100 · ThinMessage clarity
✓ Descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
Why it was queued
signing or wallet pathsecond-pass: security-sensitive path
AI analysis · Informational 18/100

This commit is a small optimization in the BitBox02 hardware wallet firmware. It changes how many times the device derives a cryptocurrency address when validating a payment request. Previously, addresses were derived twice (a safety check called 'compute twice'); now they are derived once during payment-request validation, while other operations still derive them twice. This is a performance/counter fix, not a security vulnerability fix. There is no evidence in the commit that it addresses an exploitable bug.

Lower-prioritytest: assert payment request securechip countsby Marko Bencun · 1b5181ed · Apr 30, 2026 · 1 fileMessage 67 · AdequateInformational 14Details
Commit message · Marko Bencun

test: assert payment request securechip counts

67/100 · AdequateMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Mentions testing or verification! No meaningful explanatory body
AI analysis · Informational 14/100

This commit only adds test assertions to check that a secure chip event counter is incremented correctly during payment request validation. It does not change any production code, so it cannot introduce a security vulnerability or fix one directly.

AI review queuedkeystore: consolidate xpub compute modeby Marko Bencun · c312ba93 · Apr 30, 2026 · 11 filesMessage 45 · ThinInformational 15Details
Commit message · Marko Bencun

keystore: consolidate xpub compute mode

45/100 · ThinMessage clarity
✓ Descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
Why it was queued
signing or wallet pathsecond-pass: security-sensitive path
AI analysis · Informational 15/100

This commit is a straightforward internal code cleanup. It merges two similar functions for computing extended public keys (xpubs) into one function that accepts a mode flag, and moves the mode definition to a more central location. There is no change to security behavior: operations that previously computed xpubs twice still do so, and operations that computed them once still do so. It is a refactoring, not a security fix.

Security candidateda14531: restore BLE UART backpressureby Marko Bencun · 3201c5d2 · Apr 28, 2026 · 7 filesMessage 95 · StrongModerate 60Details
Commit message · Marko Bencun

da14531: restore BLE UART backpressure

ListBackups returns one protobuf containing all SD card backups. With many backups, the response spans many 64-byte HWW/U2FHID reports. USB sends those reports directly over HID, but BLE first serial-frames each report for the DA14531 and queues the escaped bytes in the fixed-size UART ByteQueue.

The Rust ByteQueue port kept the panicking single-byte put() API and the BLE poller used it for every framed byte. That removed the previous v9.25 backpressure behavior: da14531_protocol_poll() consumed the pending HWW report before knowing whether the whole framed BLE packet fit in the 2048-byte UART queue. If ListBackups produced data faster than UART drained it, put() eventually hit capacity and panicked with bytequeue overflow. USB does not use this UART queue, which is why the same request worked there.

Add ByteQueue::try_put_slice() plus an extern C wrapper that takes util::Bytes and performs an all-or-nothing enqueue. The BLE HWW path now formats the 64-byte report into a temporary serial frame and only clears hww_data after try_put_slice() succeeds. If the queue is full, it returns without writing any bytes, preserving frame boundaries and leaving the same report pending for the next poll after UART has drained.

Keep the existing panicking put() behavior for the other bytequeue callers so the change stays scoped to the actual backpressure boundary. The separate Rust and extern-wrapper tests cover successful writes and failed overflow attempts being atomic.

95/100 · StrongMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
Why it was queued
memory safetyparser or protocol path
AI analysis · Moderate 60/100

This update fixes a crash in the BitBox02 hardware wallet when a user lists many backups over a Bluetooth connection. Previously, the device could run out of temporary buffer space while sending a large response, causing it to panic and stop working. The fix makes the Bluetooth sender check whether the whole next chunk fits before writing it, and if not, wait until space becomes available. USB connections were not affected because they use a different path.

Lower-priorityAGENTS: run make commands seriallyby Marko Bencun · 8730c1c6 · Apr 28, 2026 · 1 fileMessage 72 · AdequateInformational 15Details
Commit message · Marko Bencun

AGENTS: run make commands serially

Otherwise the dev-machine can easily lock up.

72/100 · AdequateMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body✓ Explains rationale or failure mode
Why it was queued
documentation-only discount
AI analysis · Informational 15/100

This commit only updates developer documentation (AGENTS.md). It adds a warning that running multiple make commands in parallel can lock up a development machine, and instructs developers to run them one at a time. There is no code change and no security relevance.

AI review queuedoptiga: fix detached buffer reuseby Marko Bencun · b5a2fcc2 · Apr 26, 2026 · 1 fileMessage 68 · AdequateModerate 69Details
Commit message · Marko Bencun

optiga: fix detached buffer reuse

The Optiga C API keeps raw pointers to the Rust wrapper's static
buffers until the asynchronous callback completes. The Rust wrapper
has a Detached state for futures that were dropped after launching a
command, but the individual wrappers initialized their per-operation
static buffers before calling begin_async_op().

That meant a repeated call to the same wrapper could clear or
overwrite the exact static storage still owned by the detached C
command before begin_async_op() noticed the Detached state and waited
for the old callback.

Move begin_async_op().await before every static buffer or length-cell
mutation. Detached operations are now reclaimed before any static
storage is reused, and live concurrent operations still panic before
their buffers can be corrupted.

68/100 · AdequateMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
Why it was queued
second-pass: broader security terminology
AI analysis · Moderate 69/100

This patch fixes a timing bug in how the BitBox02 hardware wallet talks to its secure chip (Optiga). Previously, the code could overwrite memory buffers that were still being used by an unfinished, dropped secure-chip operation. That could corrupt data or cause the device to behave unpredictably when secure-chip commands were started and then abandoned. The fix simply makes sure the code checks for and reclaims any leftover detached operation before touching the shared buffers.

Lower-prioritybitbox-lvgl-sys/build.rs: remove warningby Marko Bencun · a79ea6b8 · Apr 23, 2026 · 1 fileMessage 45 · ThinInformational 15Details
Commit message · Marko Bencun

bitbox-lvgl-sys/build.rs: remove warning

Agents feel the urge to fix it.

45/100 · ThinMessage clarity
✓ Descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
AI analysis · Informational 15/100

This commit simply removes a printed warning message during the build process. When a certain environment variable (LV_CONF_PATH) is missing, the build script used to warn the developer; now it silently uses a default configuration file instead. There is no change to security logic, runtime behavior, or how the firmware works.

Lower-priorityclippy: warn for large futuresby Niklas Dusenlund · c9c522f0 · Apr 23, 2026 · 2 filesMessage 76 · AdequateInformational 18Details
Commit message · Niklas Dusenlund

clippy: warn for large futures

Large async state machines keep their captured data alive across await
points. That can silently bloat task allocations and stack usage, which
is especially risky on memory-constrained embedded targets and makes
regressions harder to spot in review.

Add the Clippy lint so oversized futures are flagged early instead of
only showing up later as memory pressure or failures.

Reference: https://rust-lang.github.io/rust-clippy/master/index.html#large_futures

76/100 · AdequateMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
AI analysis · Informational 18/100

This change adds a Rust code-quality warning (Clippy lint) that flags async functions whose internal state machines get too large. It is a preventive development tool, not a fix for an existing security bug. The commit does not change any runtime firmware behavior or patch a known vulnerability.

Lower-priorityDisable Rust Debug formattingby Marko Bencun · 831453fa · Apr 23, 2026 · 9 filesMessage 66 · AdequateLow 25Details
Commit message · Marko Bencun

Disable Rust Debug formatting

Pass `-Zfmt-debug=none` in the firmware Rust build.

According to
clippy::no_debug (https://rust-lang.github.io/rust-clippy/master/index.html?search=use_debug):

> It should not be used in user-facing output

This tells rustc not to emit normal `Debug` formatter implementations into
the cross-compiled firmware image. The option also makes `{:?}` print
nothing, so app-visible error status messages must not rely on derived
`Debug`.

Keep the live keystore and backup error status screens explicit by formatting
those errors through small match-based helpers instead of `Debug`. This
preserves the visible diagnostic strings while still allowing derived Debug
formatting to be compiled out of the firmware.

There are still live library `Debug` formatting paths in a no-flag build even
when our callers map those errors to `InvalidInput`. Protobuf and Miniscript
parsers construct detailed errors internally before the caller discards them,
for example `WireType` decode errors and Miniscript `NonTopLevel(format!("{:?}",
...))` errors. `fmt-debug=none` prevents those detailed `Debug` formatters and
their generic formatting helpers from being linked.

Savings: 6464 bytes

66/100 · AdequateMessage clarity
✓ Descriptive subject✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
AI analysis · Low 25/100

This commit strips out Rust's automatic 'Debug' text-formatting code from the hardware wallet firmware to save space. It replaces a few user-facing error messages that previously relied on Debug formatting with small, hand-written formatters so users still see useful text. The change is primarily a size optimization and code-hardening step, not a fix for an active security bug.

AI review queuedEnable blake2 size_optby Marko Bencun · 7c20eb38 · Apr 22, 2026 · 1 fileMessage 61 · AdequateInformational 15Details
Commit message · Marko Bencun

Enable blake2 size_opt

The blake2 crate exposes a size_opt feature that trades aggressive
inlining for a smaller implementation. In this firmware build the
Blake2b compression path was still one of the largest Rust code
contributors, so this is a direct ROM for speed trade that matches the
current goal.

Enable size_opt for the existing optional dependency. The algorithm,
test vectors, and call sites stay the same; only the crate internal
code generation strategy changes.

In the resulting image, the large Blake2b compression routine is split
into much smaller outlined helpers instead of one heavily inlined
body. That is where the ROM reduction comes from.

Saves 11576 bytes in firmware.bin.

61/100 · AdequateMessage clarity
✓ Subject identifies a change✓ Provides detailed explanatory context✓ Mentions testing or verification
Why it was queued
fuzzing or regression evidencesecond-pass: broader security terminology
AI analysis · Informational 15/100

This commit flips a build-time option in the blake2 Rust library from 'fast and large' to 'smaller and less inlined.' It is a pure code-size optimization that does not change the hashing algorithm, inputs, outputs, or how the firmware calls it. There is no security-relevant change visible in the diff.

Lower-prioritymbedtls: use RAM instead of ROM to shrink sizeby Marko Bencun · 9cee2da4 · Apr 22, 2026 · 1 fileMessage 45 · ThinInformational 15Details
Commit message · Marko Bencun

mbedtls: use RAM instead of ROM to shrink size

Saves 2104 bytes.

45/100 · ThinMessage clarity
✓ Descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
AI analysis · Informational 15/100

This commit changes a build-time configuration option for the mbedTLS cryptography library. It disables AES lookup tables stored in read-only flash memory (ROM) and instead uses tables computed at runtime in regular working memory (RAM). The stated purpose is to reduce the overall firmware size by 2,104 bytes. This is a size-optimization change, not a security fix.

Lower-priorityShrink mbedtls SHA256 coreby Marko Bencun · 75e7982a · Apr 22, 2026 · 1 fileMessage 58 · ThinInformational 15Details
Commit message · Marko Bencun

Shrink mbedtls SHA256 core

Enable MBEDTLS_SHA256_SMALLER in the Optiga Trust M mbedTLS
user config.

This keeps the same SHA256 and HMAC-SHA256 behavior, but switches
mbedTLS to its smaller SHA256 implementation for the live Optiga
crypto path.

Savings: 1392 bytes.

The main win is that mbedtls_internal_sha256_process shrinks by
1396 bytes in the final image. The surrounding PAL, HMAC, and CCM
entry points remain live, so this is a pure ROM-for-speed tradeoff
rather than a functionality change.

58/100 · ThinMessage clarity
✓ Descriptive subject✓ Provides detailed explanatory context
AI analysis · Informational 15/100

This commit changes a single compiler setting in the firmware's cryptography library (mbedTLS) to use a smaller, slower implementation of the SHA-256 hashing routine. The commit message explicitly states this is a size-versus-speed tradeoff and does not change functionality. There is no indication of a security bug or vulnerability fix.

Lower-priorityShrink mbedtls AES tablesby Marko Bencun · c435b22c · Apr 22, 2026 · 1 fileMessage 58 · ThinInformational 15Details
Commit message · Marko Bencun

Shrink mbedtls AES tables

Enable MBEDTLS_AES_FEWER_TABLES in the Optiga Trust M mbedTLS
user config.

This keeps the same AES/CCM functionality, but trades a small
amount of AES speed for smaller ROM usage by deriving the extra
AES lookup tables from FT0/RT0 instead of keeping all eight
tables in flash.

- savings: 6208 bytes

The main win is that six live 1024-byte AES tables drop out of
the final image: FT1, FT2, FT3, RT1, RT2, and RT3. FT0 and RT0
remain, and the AES encrypt/decrypt functions shrink slightly as
well.

No functionality changes are intended; this is a ROM-for-speed
tradeoff in the mbedTLS AES implementation used by the Optiga
Trust M integration.

58/100 · ThinMessage clarity
✓ Descriptive subject✓ Provides detailed explanatory context
AI analysis · Informational 15/100

This commit changes a single configuration line in the firmware's cryptography library setup. It tells the AES encryption code to use smaller lookup tables, saving about 6 KB of storage space at the cost of a small speed reduction. The commit explicitly states there are no intended functionality changes, and the diff shows only the addition of one configuration macro.

Security candidateShrink secp256k1 callbacksby Marko Bencun · 51964811 · Apr 22, 2026 · 2 filesMessage 58 · ThinInformational 14Details
Commit message · Marko Bencun

Shrink secp256k1 callbacks

Override libsecp256k1's default callbacks with tiny local stubs.

The vendored callbacks print an error and then call abort(). In the
firmware image those failure-only paths pull in a large chunk of newlib
stdio and signal handling even though the callbacks are only used for
fatal illegal-argument and internal-consistency failures and must never
return.

Saved: 2672 bytes

The final linked image drops the abort/stdio path retained only by those
callbacks, including the public symbols abort, raise, _raise_r,
_kill_r, _getpid_r, fprintf, printf, and _vfprintf_r. It also drops the
private stdio helpers behind them, such as __sfputc_r, __sfputs_r,
__swsetup_r, __swbuf_r, _fflush_r, _fwalk_sglue, __swhatbuf_r,
__swrite, __sread, __sseek, __sclose, __sinit, and __smakebuf_r.
Meanwhile secp256k1_default_illegal_callback_fn and
secp256k1_default_error_callback_fn shrink from 28 bytes each to 2
bytes each.

This keeps the relevant behavior intact: both callbacks still trap the
firmware in a non-returning fatal path, but without dragging in unused
diagnostic formatting code.

58/100 · ThinMessage clarity
✓ Descriptive subject✓ Provides detailed explanatory context
Why it was queued
cryptography-sensitive path
AI analysis · Informational 14/100

This commit is a size-optimization cleanup, not a security fix. It replaces libsecp256k1's default fatal-error callbacks with smaller stubs so the firmware binary no longer pulls in unused standard-library printing and abort code. The behavior stays the same: on an internal or illegal-argument failure, the device still hangs forever instead of returning.

Lower-prioritydrop unneeded -mlong-callsby Marko Bencun · 973c4dc8 · Apr 22, 2026 · 1 fileMessage 58 · ThinInformational 15Details
Commit message · Marko Bencun

drop unneeded -mlong-calls

Firmware builds for Cortex-M4 in Thumb mode, where direct BL calls
reach roughly +/-16 MiB. The firmware image is well within that range,
so forcing -mlong-calls only bloats call sites and C code built
through Rust build scripts.

Remove -mlong-calls from the cross-compilation C flags and from
CARGO_C_FLAGS so the compiler can emit direct calls again.

This saves 11432 bytes in firmware.bin.

58/100 · ThinMessage clarity
✓ Descriptive subject✓ Provides detailed explanatory context
Why it was queued
documentation-only discount
AI analysis · Informational 15/100

This commit removes a compiler flag called -mlong-calls from the firmware build settings. The flag was forcing the compiler to use a larger, longer-range calling convention for function calls, even though the firmware is small enough that the normal direct calling convention works fine. Removing it only reduces code size (saves about 11 KB) and has no security relevance.

Lower-priorityoptiga: inline async launchesby Marko Bencun · 2efa3adc · Apr 22, 2026 · 1 fileMessage 70 · AdequateInformational 12Details
Commit message · Marko Bencun

optiga: inline async launches

Each Optiga async wrapper currently goes through a generic async
helper that accepts a per-call launch closure. That shape is expensive
in firmware builds: every distinct closure type causes another
monomorphized async state machine, along with duplicate drop glue and
wrapper-specific launch/wait/cleanup control flow.

Inline the Optiga C launch in each wrapper instead and keep only a
non-generic shared wait/cleanup helper. The async behavior does not
change: begin_async_op()/AsyncOpGuard still owns the shared static
buffers, Detached recovery still prevents buffer reuse after
cancellation, and all zeroization and length checks remain in place.

This saves about 1400 bytes in the firmware binary because the
compiler no longer needs to materialize a separate future for each
Optiga operation wrapper just to carry a different launch closure. The
launch step becomes plain local code in each wrapper, while the common
polling and cleanup path stays shared in one non-generic async helper.

70/100 · AdequateMessage clarity
✓ Descriptive subject✓ Provides detailed explanatory context✓ Explains rationale or failure mode
AI analysis · Informational 12/100

This commit is a code-size optimization for the BitBox02 hardware wallet's secure chip driver. It rewrites how asynchronous Optiga chip operations are started so the compiler produces less duplicate code, saving about 1,400 bytes of firmware space. The commit message and diff show no functional change to security behavior such as buffer zeroization, length checks, or cancellation recovery.

Lower-priorityoptiga: remove unused interface bitsby Marko Bencun · c9da585f · Apr 22, 2026 · 3 filesMessage 45 · ThinInformational 12Details
Commit message · Marko Bencun

optiga: remove unused interface bits

45/100 · ThinMessage clarity
✓ Descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
AI analysis · Informational 12/100

This commit is a small internal cleanup in the BitBox02 firmware's code for talking to the Optiga secure chip. It removes an unused callback pointer and simplifies how some factory-only data is written. There is no indication this fixes a security bug or introduces a vulnerability; it appears to be ordinary maintenance.

Lower-prioritysecurechip: port U2F counter opsby Marko Bencun · 34b061c1 · Apr 22, 2026 · 17 filesMessage 45 · ThinLow 27Details
Commit message · Marko Bencun

securechip: port U2F counter ops

45/100 · ThinMessage clarity
✓ Descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
AI analysis · Low 27/100

This commit moves the U2F counter read/write logic out of C code and into Rust code for the BitBox02 firmware. It is a refactoring/porting change: the same secure-chip storage object is still used, and the same operations (set counter, increment counter) are preserved. There is no obvious new security vulnerability in the diff, but the change touches sensitive secure-chip code and is only a partial port (some platforms still have placeholder 'todo!' implementations).