Skip to content

Commit 4cf4f2d

Browse files
committed
Add ProcessPrng shim to Miri
This is essentially the same as SystemFunction036 (aka RtlGenRandom) except that the given length is a usize instead of a u32
1 parent c315461 commit 4cf4f2d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/tools/miri/src/shims/windows/foreign_items.rs

+8
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
427427
this.gen_random(ptr, len.into())?;
428428
this.write_scalar(Scalar::from_bool(true), dest)?;
429429
}
430+
"ProcessPrng" => {
431+
let [ptr, len] =
432+
this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?;
433+
let ptr = this.read_pointer(ptr)?;
434+
let len = this.read_scalar(len)?.to_target_usize(this)?;
435+
this.gen_random(ptr, len.into())?;
436+
this.write_scalar(Scalar::from_i32(1), dest)?;
437+
}
430438
"BCryptGenRandom" => {
431439
let [algorithm, ptr, len, flags] =
432440
this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?;

0 commit comments

Comments
 (0)