Skip to content

Add CSPRNG to LVBS platform#825

Open
sangho2 wants to merge 5 commits into
mainfrom
sanghle/lvbs/crng
Open

Add CSPRNG to LVBS platform#825
sangho2 wants to merge 5 commits into
mainfrom
sanghle/lvbs/crng

Conversation

@sangho2
Copy link
Copy Markdown
Contributor

@sangho2 sangho2 commented May 2, 2026

This PR adds Cryptographically Secure Pseudo-Random Number Generator (CSPRNG) to the LVBS platform. Userland applications (e.g., TAs) can use this CSPRNG using fill_bytes_crng though the shim. For now, it uses ChaCha20, so this is not for applications/scenarios demanding FIPS certification.

@sangho2 sangho2 force-pushed the sanghle/lvbs/crng branch from e000954 to 7840e75 Compare May 2, 2026 04:59
@sangho2 sangho2 changed the title LVBS: use RDRAND for CSPRNG Add CSPRNG to LVBS platform May 2, 2026
@sangho2 sangho2 force-pushed the sanghle/lvbs/crng branch 3 times, most recently from 30e46bc to 6cec07a Compare May 5, 2026 18:27
@sangho2 sangho2 marked this pull request as ready for review May 7, 2026 23:20
@sangho2 sangho2 added discussion Open questions and removed discussion Open questions labels May 7, 2026
@sangho2 sangho2 added the discussion Open questions label May 15, 2026
let mut word = 0;
loop {
// Safety: `RDRAND` is available on the LVBS target CPUs. A false
// carry flag means random data is temporarily unavailable.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when it's unavailable? Would we get a bad seed in this case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, RDRAND returns zero if there is not enough HW entropy.

@sangho2 sangho2 force-pushed the sanghle/lvbs/crng branch from 45bc674 to ee071f9 Compare May 20, 2026 01:42
@sangho2 sangho2 removed the discussion Open questions label May 20, 2026
@github-actions
Copy link
Copy Markdown

🤖 SemverChecks 🤖 No breaking API changes detected

Note: this does not mean API is unchanged, or even that there are no breaking changes; simply, none of the detections triggered.

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