fix: feed full SE hash into ngu.random.reseed - #697
Open
SashaMIT wants to merge 1 commit into
Open
Conversation
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>
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. |
Contributor
|
please confirm this is superseded by #707 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rng_seeding()hashed SE1+SE2 withsha256d, then kept only the first 4 bytes forngu.random.reseed(int). That discarded most SE entropy, and libngu’s integer reseed only overwroteyasmarang_pad.This change passes the full 32-byte digest to
reseed.Dependency
Requires switck/libngu#65 (
reseed(bytes)absorbs into full yasmarang state). Integerreseedremains for compatibility.Test plan
init0→rng_seedingno exceptionuniform/ seed paths still functionElacity CodeRED Amber review (portal #52). Related: libngu TRNG retry + Linux getrandom in the same libngu PR (#51/#53).