AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 17 Bitcoin

secp256k1: update C library to bitbox02-2026-10-12

Public commit record

What the developer wrote

Authored by benma's agent

88/100 · Strong
secp256k1: update C library to bitbox02-2026-10-12

Upgrade the C library and select its 2 KiB signing table to reduce
firmware.bin from 694,548 to 665,176 bytes, saving 29,372 bytes (28.68 KiB)
without the temporary boot benchmark. The new implementation also takes
36-38% less signing time than the old 32 KiB implementation in host
measurements.

Pin the submodule to e54d68ea on the BitBoxSwiss fork's
bitbox02-20261012 branch. It is based on upstream 10366dbb (2026-08-19),
the last master revision before the deprecated context pointer and
Schnorr signing alias were removed. This preserves compatibility with
the existing bitcoin, miniscript, and Rust secp256k1 dependencies.

Keep the existing anti-exfil recovery-ID and DLEQ patches. Their public
interfaces stay unchanged; the DLEQ wrapper adapts to the internal
argument order and hash-context API.

Replace ECMULT_GEN_PREC_BITS=2 with COMB_BLOCKS=2 and COMB_TEETH=5 to
select the smallest upstream-supported signing table. Keep
ECMULT_WINDOW_SIZE=2 for verification. Signature formats stay unchanged.

With the new 2 KiB table, device measurements show 30.4% fewer cycles for
ECDSA signing and 33.4% fewer cycles for Schnorr signing than with the old
32 KiB implementation. This speedup comes from the updated library's
generator multiplication, which replaces fixed two-bit windows with a
signed-digit multi-comb algorithm. It reuses precomputed point combinations
across bit positions:
this configuration needs 52 point additions and 25 doublings instead of
128 additions. The reduction in expensive additions lets the new library
use a much smaller table while still outperforming the old implementation.

Host median times with the old 32 KiB table and the new 2 KiB table:
- ECDSA signing: 68.230 -> 43.776 us (35.8% less time).
- Schnorr signing: 60.566 -> 37.779 us (37.6% less time).
- Anti-exfil commitment plus signing: 192.709 -> 123.176 us (36.1% less time).

These compare edc3c3e0 with d9d4ccd4 using GCC -Os on x86_64 with the
32-bit limb backend. Revision e54d68ea differs from d9d4ccd4 only in the
CI symbol checker. The timings exclude context and keypair setup; they
are not device or whole-transaction timings.

Live device runs of the boot benchmark before and after this upgrade
compare the old 32 KiB implementation with the new 2 KiB implementation.
The following values are mean CPU cycles per operation over 16 measured
calls after one warm-up call. Negative changes mean fewer cycles.

Operation Before After Change
Context initialization 14,337 112,573 +685.2%
Public-key creation 1,775,431 1,167,625 -34.2%
Public-key encoding 2,555 2,451 -4.1%
Public-key parsing 182,577 184,605 +1.1%
Secret-key add tweak 3,324 4,288 +29.0%
Secret-key mul tweak 4,769 5,775 +21.1%
Public-key add tweak 1,738,066 1,759,125 +1.2%
Public-key mul tweak 1,489,530 1,482,017 -0.5%
Public-key combine 96,269 94,781 -1.5%
X-only public tweak 1,740,247 1,761,258 +1.2%
Keypair creation 1,776,999 1,169,171 -34.2%
Keypair tweak 1,741,094 1,763,131 +1.3%
ECDSA signing 1,996,136 1,389,395 -30.4%
ECDSA verification 2,417,780 2,447,168 +1.2%
Anti-exfil commitment 1,935,342 1,323,431 -31.6%
Anti-exfil signing 3,796,601 2,581,140 -32.0%
Schnorr signing 1,810,803 1,206,321 -33.4%
Schnorr verification 2,491,463 2,522,637 +1.3%
DLEQ proof creation 3,712,662 3,072,532 -17.2%
DLEQ verification 5,349,679 5,316,498 -0.6%

Signing uses 30-33% fewer cycles on-device, slightly less of a gain than
on the host. Signing and key creation benefit from the new generator
multiplication; verification and public-key tweaks use a different
multiplication path and remain close to their previous performance.

Context initialization adds 98,236 cycles, about 0.819 ms at the configured
120 MHz. The new initialization includes a loop to compute the comb
algorithm's scalar offset. Firmware initializes and caches its global
context once, so this cost is small compared with the roughly 600,000
cycles saved by one ECDSA or Schnorr signature.

Secret-key addition and multiplication tweaks add 964 and 1,006 cycles,
respectively, or about 8 us each. Upstream's explicit wiping of temporary
scalars is a plausible contributor, but these runs do not isolate its
cost. Public-key addition, x-only and keypair tweaks, and ECDSA/Schnorr
verification take 1.2-1.3% more cycles. Interrupts remain enabled during
the benchmark; repeated runs would help establish how much of these small
differences is systematic. Time equivalents use cycles / 120,000 for ms;
the device screen reports cycles.

Summing the relevant measured components gives these estimates:

Components Before After Change
Anti-exfil commitment + signing 5,731,943 3,904,571 -31.9%
Schnorr keypair + tweak + signing 5,328,896 4,138,623 -22.3%
DLEQ creation + verification 9,062,341 8,389,030 -7.4%

These sums exclude key derivation, randomness generation, communication,
UI, and other surrounding work, so they are not whole-transaction timings.
DLEQ verification dominates its pair, limiting the combined improvement.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit updates the secp256k1 cryptographic library inside the BitBox02 firmware and switches to a smaller, faster signing table. The change reduces firmware size by about 29 KB and makes ECDSA and Schnorr signing roughly 30-37% faster. There is no indication in the commit that this fixes a known security vulnerability; it appears to be a routine performance and size optimization while preserving existing behavior and patches.

Recommended action

Treat as a normal dependency update. Review the upstream changelog between upstream 10366dbb and the previous submodule base for any security-relevant fixes, and verify that the retained anti-exfil, recovery-ID, and DLEQ patches still apply cleanly and behave correctly. Run the existing cryptographic test suite and, if available, side-channel/constant-time tests on the new 2 KiB comb implementation before release.

Security signals we found

01

Cryptographic library update with submodule bump

02

Change to elliptic-curve generator precomputation table size and algorithm

03

Preservation of existing anti-exfil, recovery-ID, and DLEQ patches

04

No explicit security bug fix or CVE mentioned in commit message

05

Context initialization cost increased significantly; firmware caches global context once

Risk score

Why this scored 17/100

Our methodology →
Potential impact 2/30
Exploitability 1/25
Stealth signal 1/15
Affected reach 3/15
Confidence 7/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.