RAND_bytes_ex

Fill a buffer with public CSPRNG bytes using a library context and strength.

Synopsis

Declared in <openssl/rand.h>

int
RAND_bytes_ex(
    OSSL_LIB_CTX* ctx,
    unsigned char* buf,
    size_t num,
    unsigned int strength);

Return Value

1 on success, -1 if not supported by the current RAND method, or 0 on other failure.

Parameters

NameDescription
ctxLibrary context whose public DRBG is used, or NULL for the default.
bufBuffer that receives num random bytes.
numNumber of bytes to generate.
strengthRequested security strength in bits for the generated bytes.