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

secp256k1: randomize the context once per boot

Public commit record

What the developer wrote

Authored by benma's agent

83/100 · Strong
secp256k1: randomize the context once per boot

The global secp256k1 context starts with deterministic blinding values.
Randomize it once per boot to add protection against power and
electromagnetic side channels during secret-key operations.

After secure-chip setup and before entering the main loop, obtain a
32-byte seed through the existing HAL randomness helper. It combines
MCU and secure-chip randomness with factory randomness. Randomize the
context before publishing it in the OnceCell, then drop the zeroizing
seed buffer. Failure to obtain randomness stops startup.

Require initialization before production access to the shared context.
Repeated initialization keeps the existing context, without changing
blinding state while callers may hold references. Keep lazy initialization
for test configurations that do not run firmware startup, and initialize
both graphical simulators explicitly. Forward testing and c-unit-testing
independently to preserve the separation of Rust and C test builds.

Keep the OnceCell inside GlobalContext so initialization and access
operate on the state it owns. Preserve the shared-reference API and
the existing single-threaded, non-interrupt usage requirement.

Public keys and deterministic signatures stay unchanged. This uses the
existing seeded_randomize API without new dependencies or changes to the
secp256k1 library.

Co-authored-by: NickeZ Agent <niklas+agent@bitbox.swiss>
✓ 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 hardens the BitBox02 hardware wallet against advanced physical attacks. It randomizes the internal math context used for Bitcoin private-key operations once each time the device boots, using a mix of randomness from the microcontroller, secure chip, and factory-stored randomness. Public keys and signatures remain unchanged; the change only makes it harder for an attacker with physical access to extract secrets through power or electromagnetic side-channel analysis.

Recommended action

No immediate user action required. This is a defensive hardening patch. Ensure firmware builds and tests pass, and verify that production startup cannot reach the main loop if secp256k1 context initialization fails. Review that the random_32_bytes_from_hal helper and secure-chip randomness path remain robust, since startup now depends on them.

Security signals we found

01

Side-channel countermeasure: secp256k1 context blinding/randomization

02

Source of randomness combines MCU, secure chip, and factory randomness

03

Initialization is required before production access; panics if uninitialized

04

Idempotent init prevents re-randomization while references may be held

05

No change to public keys or deterministic signatures

06

No new dependencies or secp256k1 library modifications

Risk score

Why this scored 37/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 6/15
Affected reach 7/15
Confidence 7/10
Evidence quality 4/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.