#ifndef _SECRNG_H_
#define _SECRNG_H_
/*
* secrng.h - public data structures and prototypes for the secure random
* number generator
*
* $Id: secrng.h,v 1.5 1997/02/24 03:01:42 tomw Exp $
*/
#include "seccomon.h"
#include "secrngt.h"
/******************************************/
/******************************************/
/*
** Random number generation. A cryptographically strong random number
** generator.
*/
SEC_BEGIN_PROTOS
/*
** Create a new random-number-generator (RNG) context
*/
extern RNGContext *RNG_CreateContext(void);
/*
** Destroy an RNG context.
** "cx" the context
** "freeit" if PR_TRUE then free the object as well as its sub-objects
*/
extern void RNG_DestroyContext(RNGContext *cx, PRBool freeit);
/*
** Reset the random number generator to its initial state. The seed data
** is not reset. This causes the random number generator to output the
** exact same sequence of random numbers as it originally output.
** "cx" the context
*/
extern void RNG_Init(RNGContext *cx);
/*
** Update the random number generator with more seeding material.
** "cx" the context
** "input" the input data to seed the generator with
** "inputLen" the amount of input data
*/
extern SECStatus RNG_Update(RNGContext *cx, void *input, size_t inputLen);
/*
** Generate some random bytes using the random number generator.
** "cx" the context
** "result" where the generated bytes are stored
** "numBytes" the amount of random bytes to generate
*/
extern SECStatus RNG_GenerateRandomBytes(RNGContext *cx, void *result,
size_t numBytes);
/*
** Reseed the random number generator, randomly. This uses machine specific
** random information to seed the random number generator. The random number
** generator is not reset before the reseed is done, so the eventual
** state will be a function of the initial seed, plus the amount of data
** previously generated plus the new data added in.
** "cx" the context
*/
extern SECStatus RNG_Reseed(RNGContext *cx);
extern SECStatus RNG_RNGInit(void);
/*
** Reset the global random number generator. Next time a random number
** is needed, a new generator will be constructed and it will be
** "randomly" seeded.
*/
extern SECStatus RNG_ResetRandom(void);
/*
** Generate some random bytes, using the global random number generator
** object.
*/
extern SECStatus RNG_GenerateGlobalRandomBytes(void *dest, size_t len);
/*
** Update the global random number generator with more seeding
** material
*/
extern SECStatus RNG_RandomUpdate(void *data, size_t bytes);
/*
** The following 3 functions are provided by the security library
** but are differently implemented for the UNIX, Mac and Win
** versions
*/
/*
** Get the "noisiest" information available on the system.
*/
extern size_t RNG_GetNoise(void *buf, size_t maxbytes);
/*
** RNG_SystemInfoForRNG should be called before any use of SSL. It
** gathers up the system specific information to help seed the
** state of the global random number generator.
*/
extern void RNG_SystemInfoForRNG(void);
/*
** Use the contents (and stat) of a file to help seed the
** global random number generator.
*/
extern void RNG_FileForRNG(char *filename);
SEC_END_PROTOS
#endif /* _SECUTIL_H_ */