ensure current getrandom works with strict provenance

This commit is contained in:
Ralf Jung 2022-11-22 11:52:35 +01:00
parent 105dba7968
commit 859310a370
5 changed files with 12 additions and 6 deletions

View File

@ -15,7 +15,7 @@ page_size = "0.4.1"
num_cpus = "1.10.1"
getrandom_1 = { package = "getrandom", version = "0.1" }
getrandom_2 = { package = "getrandom", version = "0.2" }
getrandom = { version = "0.2" }
rand = { version = "0.8", features = ["small_rng"] }
[workspace]

View File

@ -0,0 +1,8 @@
// mac-os `getrandom_1` does some pointer shenanigans
//@compile-flags: -Zmiri-permissive-provenance
/// Test old version of `getrandom`.
fn main() {
let mut data = vec![0; 16];
getrandom_1::getrandom(&mut data).unwrap();
}

View File

@ -1,12 +1,10 @@
// mac-os `getrandom_1` does some pointer shenanigans
//@compile-flags: -Zmiri-permissive-provenance
//@compile-flags: -Zmiri-strict-provenance
use rand::{rngs::SmallRng, Rng, SeedableRng};
fn main() {
// Test `getrandom` directly (in multiple different versions).
// Test `getrandom` directly.
let mut data = vec![0; 16];
getrandom_1::getrandom(&mut data).unwrap();
getrandom_2::getrandom(&mut data).unwrap();
getrandom::getrandom(&mut data).unwrap();
// Try seeding with "real" entropy.
let mut rng = SmallRng::from_entropy();