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

keystore: port bip39 unlock/retain to Rust

Public commit record

What the developer wrote

Authored by Marko Bencun

80/100 · Strong
keystore: port bip39 unlock/retain to Rust

retain_bip39_seed encrypted the seed, copy_bip39_seed decrypted
it. This is ported to a helper struct `RetainedEncryptedBuffer` that
does the same. The helper struct is made because the other
seed (_retained_seed_encrypted) does the exact same operation, just
with a different purpose string when hashing, so we can reuse that
later when porting retain_seed/copy_seed.

_is_unlocked_bip39 is not ported, as it is redundant and equivaent with
RETAINED_BIP39_SEED being Some().
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit rewrites the code that keeps the BIP-39 seed temporarily encrypted in memory, moving it from C to Rust. It is a refactoring/porting change, not a fix for a known bug or attack. The same encryption approach is preserved, but the change touches sensitive seed-handling code, so it deserves careful review.

Recommended action

Treat as a high-risk refactoring: perform a security-focused code review of the new Rust `RetainedEncryptedBuffer` implementation, verify that lock/zeroization semantics match the C version, confirm the static is not copied or leaked, and run the updated regression tests. No immediate patch deployment is required unless review finds a defect.

Security signals we found

01

Refactor of seed-at-rest encryption code

02

Removal of C static buffers for retained BIP-39 seed

03

Introduction of Rust static `SyncCell<Option<RetainedEncryptedBuffer>>` for retained BIP-39 seed

04

Key-stretching purpose strings unchanged

05

AES-256-CBC + HMAC retained for encrypted seed storage

06

Lock path now clears `RETAINED_BIP39_SEED`

07

Test-only mock RNG added to keep regression tests deterministic

Risk score

Why this scored 26/100

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