Chapter 2 Algorithm Info Types 243
AI_X962Random_V0
AI_X962Random_V0
Purpose:
This AI allows you to generate a stream of pseudo-random numbers which are
guaranteed to have a very high degree of randomness. Random numbers are used in
deriving public and private keys, initialization vectors, etc. This AI uses SHA1 as an
underlying hashing function. The details of this algorithm are specified in X9.62, and
it is similar to the algorithm in section A.2.1 of X9.31.
This algorithm can produce numbers between zero and the value of a given prime
minus one. Such numbers are useful for the U.S. Government Digital Signature
Standard (DSS).
Other algorithms that can be used to generate pseudo-random numbers are
AI_MD2Random, AI_SHA1Random, and AI_MD5Random.
Type of information this allows you to use:
the SHA1 pseudo-random generator as defined in X9.62.
Format of info supplied to B_SetAlgorithmInfo:
NULL_PTR, if it is desired to use the AI_X962Random_V0 object in the same fashion as
AI_MD5Random.
a pointer to an
A_SHA_RANDOM_PARAMS structure:.
typedef struct {
ITEM prime; /* Optional input for X-9.62 mode only. Used to */
/* generate a pseudo-random number (but not uniform) */
/* in [1, prime - 1]. Set prime.len to zero otherwise */
ITEM seed; /* Special additional seeding of 20 to 128 bytes long.*/
/* May be used in place of usual B_UpdateRandom seeding calls, */
/* but requires the availability of nearly perfectly random bytes. */
/* If B_UpdateRandom seeding calls are used, then */
/* this additional seeding material is used to augment the */
/* randomness of the pseudo-random numbers generated.*/
} A_SHA_RANDOM_PARAMS;