Skip to content

fix: feed full SE hash into ngu.random.reseed - #697

Open
SashaMIT wants to merge 1 commit into
Coldcard:masterfrom
SashaMIT:fix/rng-seeding-full-se-hash
Open

fix: feed full SE hash into ngu.random.reseed#697
SashaMIT wants to merge 1 commit into
Coldcard:masterfrom
SashaMIT:fix/rng-seeding-full-se-hash

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 4, 2026

Copy link
Copy Markdown

Summary

rng_seeding() hashed SE1+SE2 with sha256d, then kept only the first 4 bytes for ngu.random.reseed(int). That discarded most SE entropy, and libngu’s integer reseed only overwrote yasmarang_pad.

This change passes the full 32-byte digest to reseed.

Dependency

Requires switck/libngu#65 (reseed(bytes) absorbs into full yasmarang state). Integer reseed remains for compatibility.

Test plan

  • Build with updated libngu submodule / vendored tree
  • Boot MK4 / Q1 / simulator — init0rng_seeding no exception
  • Confirm uniform / seed paths still function

Elacity CodeRED Amber review (portal #52). Related: libngu TRNG retry + Linux getrandom in the same libngu PR (#51/#53).

rng_seeding previously truncated sha256d(SE1||SE2) to 32 bits before
reseed, which also only overwrote one yasmarang state word. Pass the
full digest bytes (needs libngu reseed(bytes) from switck/libngu#65).

Co-authored-by: Cursor <cursoragent@cursor.com>
@SashaMIT

SashaMIT commented Aug 5, 2026

Copy link
Copy Markdown
Author

Friendly bump — related entropy hardening across libngu#65 and Coldcard firmware#697 (TRNG remix on reject, Linux getrandom, full SE hash reseed). Happy to split or retarget if you want a different shape.

@doc-hex

doc-hex commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

please confirm this is superseded by #707

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants