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

syscall to set the seed of the random number generator #98

Merged
merged 13 commits into from
Sep 12, 2020
Merged

syscall to set the seed of the random number generator #98

merged 13 commits into from
Sep 12, 2020

Conversation

stlankes
Copy link
Contributor

  • using the core library to create a random number
  • removing inline assembly

Copy link
Contributor

@jbreitbart jbreitbart left a comment

Choose a reason for hiding this comment

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

unsafe {
llvm_asm!("rdrand $0" : "=r"(value) ::: "volatile");
unsafe {
if SUPPORTS_RDRAND {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a log message in case we have fall back to pseudo random values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a debug message in src/syscalls/random.rs

Copy link
Contributor

Choose a reason for hiding this comment

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

Are these printed every time a random number is generated? Can we print an info message at startup saying we are using either the hardware random generator or park miller lehmer software random generator?

src/arch/x86_64/kernel/processor.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@jbreitbart jbreitbart left a comment

Choose a reason for hiding this comment

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

Feel free to merge after you have removed the superfluous debug!

value
} else {
debug!("Fallback to a software-based random number generator");
Copy link
Contributor

Choose a reason for hiding this comment

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

You have missed this one 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I fixed it

@stlankes stlankes merged commit d26d995 into hermit-os:master Sep 12, 2020
@stlankes stlankes deleted the rand branch September 12, 2020 18:09
simonschoening pushed a commit to simonschoening/libhermit-rs that referenced this pull request Aug 26, 2021
…os#98)

* add syscall to set the seed of the pseudo random number generator
* use function to create cryptographicly secure random numbers
* remove obsolete GitHub Action workflow "build"
* add comments to explain the functions
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