Function sgx_trts::trts::rsgx_read_rand[][src]

pub fn rsgx_read_rand(rand: &mut [u8]) -> SgxError

rsgx_read_rand function is used to generate a random number inside the enclave.

Description

The rsgx_read_rand function is provided to replace the standard pseudo-random sequence generation functions inside the enclave, since these standard functions are not supported in the enclave, such as rand, srand, etc. For HW mode, the function generates a real-random sequence; while in simulation mode, the function generates a pseudo-random sequence.

Parameters

rand

A pointer to the buffer that stores the generated random number. The rand buffer can be either within or outside the enclave, but it is not allowed to be across the enclave boundary or wrapped around.

Requirements

Library: libsgx_trts.a

Errors

SGX_ERROR_INVALID_PARAMETER

Invalid input parameters detected.

SGX_ERROR_UNEXPECTED

Indicates an unexpected error occurs during the valid random number generation process.