Function psa_crypto::operations::other::generate_random
source · pub fn generate_random(output: &mut [u8]) -> Result<()>
Expand description
Generate a buffer of random bytes.
The random bytes are written into output
. The function returns a result based on whether the
operation succeeded or failed.
Example:
use psa_crypto::operations::other::generate_random;
psa_crypto::init().unwrap();
const BUFFER_SIZE: usize = 16;
let mut buffer = vec![0u8; BUFFER_SIZE];
let result = generate_random(&mut buffer);