SecRandomCopyBytes

Function SecRandomCopyBytes 

Source
pub unsafe extern "C-unwind" fn SecRandomCopyBytes(
    rnd: SecRandomRef,
    count: usize,
    bytes: NonNull<c_void>,
) -> c_int
Available on crate feature SecRandom only.
Expand description

Return count random bytes in *bytes, allocated by the caller. It is critical to check the return value for error.

Parameter rnd: Only kSecRandomDefaultis supported.

Parameter count: The number of bytes to generate.

Parameter bytes: A buffer to fill with random output.

Returns: Return 0 on success, any other value on failure.

If rndis unrecognized or unsupported, kSecRandomDefaultis used.

ยงSafety

  • rnd must be a valid pointer or null.
  • bytes must be a valid pointer.