You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -91,7 +91,7 @@ unsafe fn rdrand_exact(dest: &mut [u8]) -> Result<(), Error> {
let tail = chunks.into_remainder();
let n = tail.len();
if n > 0 {
- tail.copy_from_slice(&rdrand()?[..n]);+ unreachable!()
}
Ok(())
}
I would expect at least one test to fail with this modification, but they all pass, because every test buffer is a multiple of the word size. We should have tests for this branch.
The text was updated successfully, but these errors were encountered:
This PR adds some tests which make sure calls to getrandom (for both small and large buffers) "look" random.
While we could certainly add more complicated randomness tests, these simple tests are:
- Very easy to understand
- Don't require any external crates
- Makes sure we aren't doing something obviously stupid like
- forgetting [these lines](https://github.com/rust-random/getrandom/blob/bd0654fe70980583e51573e755bafa3b2f8342d9/src/rdrand.rs#L91-L95)
- failing to initialize every other byte
- initializing some significant fraction of bytes with a constant
As this tests all buffer sizes from 1 to 64, it also fixes#290.
Consider this change to
rdrand_exact()
:I would expect at least one test to fail with this modification, but they all pass, because every test buffer is a multiple of the word size. We should have tests for this branch.
The text was updated successfully, but these errors were encountered: