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

Address noise_rand_bytes silent failure on Windows: #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nbougalis
Copy link

Per its documentation, noise_rand_bytes returns "cryptographically-strong random bytes from the operating system."

On Windows, the existing implementation of the function does not check that the CryptGenRandom API succeeds. While failure is unlikely, it is prudent to actually check.

If merged this commit will cause the process to exit if the function is not able to generate the requested number of random bytes; the code also checks that the provided buffer is non-null and that the number of bytes requested is non-zero.

Per its documentation, `noise_rand_bytes` returns "cryptographically-strong
random bytes from the operating system."

On Windows, the existing implementation of the function does not check that
the `CryptGenRandom` API succeeds. While failure is unlikely, it is prudent
to actually check.

If merged this commit will cause the process to exit if the function is not
able to generate the requested number of random bytes; the code also checks
that the provided buffer is non-null and that the number of bytes requested
is non-zero.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant