miri: shim CCRandomGenerateBytes
This commit is contained in:
parent
b9d47cfa9b
commit
a21ff017f4
@ -78,6 +78,16 @@ fn emulate_foreign_item_inner(
|
|||||||
this.write_pointer(environ, dest)?;
|
this.write_pointer(environ, dest)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Random data generation
|
||||||
|
"CCRandomGenerateBytes" => {
|
||||||
|
let [bytes, count] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
|
||||||
|
let bytes = this.read_pointer(bytes)?;
|
||||||
|
let count = this.read_target_usize(count)?;
|
||||||
|
let success = this.eval_libc_i32("kCCSuccess");
|
||||||
|
this.gen_random(bytes, count)?;
|
||||||
|
this.write_int(success, dest)?;
|
||||||
|
}
|
||||||
|
|
||||||
// Time related shims
|
// Time related shims
|
||||||
"mach_absolute_time" => {
|
"mach_absolute_time" => {
|
||||||
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
|
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
//@only-target-apple: this directly tests apple-only functions
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut bytes = [0u8; 24];
|
||||||
|
let ret = unsafe { libc::CCRandomGenerateBytes(bytes.as_mut_ptr().cast(), bytes.len()) };
|
||||||
|
assert_eq!(ret, libc::kCCSuccess);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user