Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posix: add getentropy() based RNG #1880

Merged
merged 1 commit into from
Oct 6, 2024
Merged

posix: add getentropy() based RNG #1880

merged 1 commit into from
Oct 6, 2024

Conversation

gdamore
Copy link
Contributor

@gdamore gdamore commented Oct 6, 2024

XPG8 defines getentropy() as the only good source for random numbers. However, real world use a bit more nuanced. On BSD systems, we would prefer to use arc4random as it avoids unnecessary system calls. On Linux however, getentropy is implemented in terms of getrandom, and should be used directly when available.

fixes #

Note that the above format should be used in your git commit comments.
You agree that by submitting a PR, you have read and agreed to our
contributing guidelines.

@gdamore gdamore force-pushed the gdamore/getentropy branch from c7609df to 3c2512a Compare October 6, 2024 18:13
Copy link

codecov bot commented Oct 6, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.66%. Comparing base (4ae376e) to head (773950e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/platform/posix/posix_rand_getentropy.c 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1880      +/-   ##
==========================================
+ Coverage   78.30%   79.66%   +1.35%     
==========================================
  Files          93       95       +2     
  Lines       20691    21636     +945     
==========================================
+ Hits        16203    17237    +1034     
+ Misses       4488     4399      -89     

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

XPG8 defines getentropy() as the only good source for random numbers.
However, real world use a bit more nuanced.  On BSD systems, we would
prefer to use arc4random as it avoids unnecessary system calls.  On
Linux however, getentropy is implemented in terms of getrandom, and should
be used directly when available.
@gdamore gdamore force-pushed the gdamore/getentropy branch from 3c2512a to 773950e Compare October 6, 2024 18:18
@gdamore gdamore merged commit 773950e into main Oct 6, 2024
14 of 16 checks passed
@gdamore gdamore deleted the gdamore/getentropy branch November 8, 2024 07:31
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.

1 participant