1 | // We only test the RDRAND-based RNG source on supported architectures. |
2 | #![cfg (any(target_arch = "x86_64" , target_arch = "x86" ))] |
3 | |
4 | // rdrand.rs expects to be part of the getrandom main crate, so we need these |
5 | // additional imports to get rdrand.rs to compile. |
6 | use getrandom::Error; |
7 | #[macro_use ] |
8 | extern crate cfg_if; |
9 | #[path = "../src/rdrand.rs" ] |
10 | mod rdrand; |
11 | #[path = "../src/util.rs" ] |
12 | mod util; |
13 | |
14 | // The rdrand implementation has the signature of getrandom_uninit(), but our |
15 | // tests expect getrandom_impl() to have the signature of getrandom(). |
16 | fn getrandom_impl(dest: &mut [u8]) -> Result<(), Error> { |
17 | rdrand::getrandom_inner(unsafe { util::slice_as_uninit_mut(dest) })?; |
18 | Ok(()) |
19 | } |
20 | mod common; |
21 | |