An RNG (Random Number Generator) context contains state parameters and other associated information of a pseudo-random number generator. A number of operations such as key creation and signature generation require an RNG.
To specify a particular RNG, call the appropriate RNG registration function from the adapter. For example, in the SB software adapter, the ANSI X9.62 RNG can be registered using hu_RegisterANSIRng().
To create an RNG context, call hu_RngCreate(). This function accepts a user-defined seed. It is very important that you seed the RNG periodically with truly random data1. The function hu_RngReseed() updates the RNG context with seed data. The function hu_RngGetBytes() generates random data. Both of these operations can be combined by calling hu_RngReseedGetBytes().
You can also provide a callback function that generates additional seeding data. The library will call this function periodically to obtain seed data. The type definition for this callback function is defined in the header file hurng.h.
To destroy an RNG context, call hu_RngDestroy().
Note that the same RNG context can be shared between Security Builder Crypto functions within a global context.