BN_rand

Generate a cryptographically strong public random BIGNUM of bits bits.

Synopsis

Declared in <openssl/bn.h>

int
BN_rand(
    BIGNUM* rnd,
    int bits,
    int top,
    int bottom);

Return Value

1 on success, or 0 on failure.

Parameters

NameDescription
rndDestination BIGNUM (allocated/resized as needed).
bitsDesired bit length of the result.
topBN_RAND_TOP_* controlling the most-significant bits.
bottomBN_RAND_BOTTOM_* controlling whether the least-significant bit must be set.