Skip to content

Add feature to directly use the OS-provided RNG instead of rand - #403

Closed
MatMaul wants to merge 1 commit into
matrix-org:mainfrom
tchapgouv:os-rng
Closed

Add feature to directly use the OS-provided RNG instead of rand#403
MatMaul wants to merge 1 commit into
matrix-org:mainfrom
tchapgouv:os-rng

Conversation

@MatMaul

@MatMaul MatMaul commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

The os-rng feature enables the use of the operating system's RNG instead of the default random number generator provided by the rand crate, which is not backtracking resistant.

This is usually not necessary, but can be enabled for security-critical applications or compliance purposes.

Please note that OS RNG is not guaranteed to be backtracking resistant either since it will depend on the underlying OS implementation, but the RNG state will be available in kernel space instead of user space so harder to extract.

@MatMaul
MatMaul requested review from dkasak and poljar as code owners August 19, 2026 17:26
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.72%. Comparing base (cfc4eee) to head (3f6ea70).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #403   +/-   ##
=======================================
  Coverage   91.72%   91.72%           
=======================================
  Files          40       40           
  Lines        5533     5536    +3     
  Branches     5533     5536    +3     
=======================================
+ Hits         5075     5078    +3     
  Misses        287      287           
  Partials      171      171           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@codspeed-hq

codspeed-hq Bot commented Aug 27, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing tchapgouv:os-rng (3f6ea70) with main (cfc4eee)

Open in CodSpeed

@poljar

poljar commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Isn't this more generally solved by #379?

@MatMaul

MatMaul commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Indeed thanks!

@MatMaul MatMaul closed this Aug 27, 2026
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.

3 participants