Don't break windows/rand for miri

This commit is contained in:
Chris Denton 2022-09-07 13:14:27 +01:00
parent b2e4f9dcb3
commit 832c7af0ea
No known key found for this signature in database
GPG Key ID: 713472F2F45627DE

View File

@ -38,6 +38,18 @@ pub fn hashmap_random_keys() -> (u64, u64) {
struct Rng(c::BCRYPT_ALG_HANDLE);
impl Rng {
#[cfg(miri)]
fn open() -> Result<Self, c::NTSTATUS> {
const BCRYPT_RNG_ALG_HANDLE: c::BCRYPT_ALG_HANDLE = ptr::invalid_mut(0x81);
let _ = (
c::BCryptOpenAlgorithmProvider,
c::BCryptCloseAlgorithmProvider,
c::BCRYPT_RNG_ALGORITHM,
c::STATUS_NOT_SUPPORTED,
);
Ok(Self(BCRYPT_RNG_ALG_HANDLE))
}
#[cfg(not(miri))]
// Open a handle to the RNG algorithm.
fn open() -> Result<Self, c::NTSTATUS> {
use crate::sync::atomic::AtomicPtr;