hu_SeedGet()

Generates a PRNG seed in a system-dependent way.

Synopsis:

#include "huseed.h"
 
int hu_SeedGet(size_t *seedLen, unsigned char *seed, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

seedLen

The size of the buffer on being called, the size of the seed written upon return. It can be smaller than that requested.

seed

A buffer to store the seed in.

sbCtx

A global context.

Library:

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

Description:

The seeding source must be registered in the global context prior to this call.

A PRNG must be initialized with a random seed. The seed must be generated in a system-dependent way, from available sources of entropy. Since the system entropy is unlikely to change quickly, the seed should be generated only once, and used to create a long-living PRNG.

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

Returns:

SB_ERR_NULL_OUTPUT

seed is NULL.

SB_ERR_NULL_OUTPUT_BUF_LEN_PTR

seedLen is NULL.

SB_ERR_NULL_OUTPUT_BUF_LEN

*seedLen is NULL.

SB_ERR_NULL_GLOBAL_CTX

sbCtx is NULL.

SB_ERR_SEED_NOT_SUPPORTED

A seeding source is not registered in the SB global context sbCtx.