hu_RngReseedGetBytes()

For ANSI and FIPS140 ANSI RNGs, this function updates the RNG context object with the given seed data and generates random data of the specified length.

Synopsis:

#include "hurandom.h"
 
int hu_RngReseedGetBytes(sb_RNGCtx rngCtx, size_t seedLen, const unsigned char *seed, size_t bufSize, unsigned char *buf, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

rngCtx

An RNG context object.

seedLen

The length (in bytes) of seed.

seed

The seed value.

bufSize

The length (in bytes) of random data buffer.

buf

Random data.

sbCtx

A global context.

Library:

libhuapi (For the qcc command, use the -l huapi option to link against this library)

Description:

For cipher, hash, HMAC and EC DRBG RNGs, this function uses the given 'seed' data as an additional input into the generation of random data of the specified length. It does not gather entropy to do a full reseed of the DRBG RNG context. To do a full reseed of the DRBG RNG context use hu_RngReseed().

Reseeding the RNG context with whatever new entropy is collected is excellent practice.

Returns:

SB_ERR_NULL_CONTEXT

The RNG context object is NULL.

SB_ERR_BAD_CONTEXT

The RNG context object is invalid.

SB_ERR_NULL_OUTPUT_BUF

The output buffer is NULL.

SB_ERR_BAD_OUTPUT_BUF_LEN

The length of the output buffer is invalid.

SB_FAIL_RANDOM_GEN

A FIPS 140-1/2 condition failed.

SB_ERR_RNG_ADDITIONAL_INPUT_TOO_BIG

The seed (additional input for DRBG) is too long.

SB_SUCCESS

Success.