Skip to content

Commit f07827b

Browse files
committed
miri: shim CCRandomGenerateBytes
1 parent c3ca962 commit f07827b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/tools/miri/src/shims/unix/macos/foreign_items.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7878
this.write_pointer(environ, dest)?;
7979
}
8080

81+
// Random data generation
82+
"CCRandomGenerateBytes" => {
83+
let [bytes, count] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
84+
let bytes = this.read_pointer(bytes)?;
85+
let count = this.read_target_usize(count)?;
86+
let success = this.eval_libc_i32("kCCSuccess");
87+
this.gen_random(bytes, count)?;
88+
this.write_int(success, dest)?;
89+
}
90+
8191
// Time related shims
8292
"mach_absolute_time" => {
8393
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;

0 commit comments

Comments
 (0)