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

common: add unified HSM secret handling module

Public commit record

What the developer wrote

Authored by Sangbida Chaudhuri

68/100 · Adequate
common: add unified HSM secret handling module

This is a newer API to replace hsm_encryption.c and hsm_encryption.c, this tidies up the API to be used and also cleans things up to support our new formats. Our hsm_secret formats now include:
- Legacy 32-byte plain format
- Legacy 73-byte encrypted format
- New mnemonic format without passphrase (32 zero bytes + mnemonic)
- New mnemonic format with passphrase (32-byte hash + mnemonic)

This commit includes support to detect the format based on the file size and content structure. The hsm will store mnemonics in the hsm_secret file as:

`passphraseHash`mnemonic`
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit adds a new internal module for handling the secret key file used by Core Lightning's hardware security module (HSM). It introduces support for reading the existing plain and encrypted formats, plus new formats based on BIP39 word lists (mnemonics) with optional passphrases. The code uses modern password hashing (Argon2) and authenticated encryption (libsodium secretstream). There is no direct evidence in the commit that this fixes a known security vulnerability; it appears to be a feature/refactoring change to support new wallet backup formats.

Recommended action

No immediate security action is required. Treat this as a normal feature/refactoring commit. Reviewers should verify that downstream commits using this module correctly validate passphrases, handle memory locking failures, and do not introduce side-channel or format-confusion issues when the new mnemonic formats are enabled.

Security signals we found

01

Adds new cryptographic secret-handling module

02

Uses Argon2id and libsodium secretstream for encryption

03

Introduces BIP39 mnemonic parsing and seed derivation

04

Memory-locks secrets and clears them after use

05

No explicit security fix or CVE reference in commit message

Risk score

Why this scored 11/100

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