1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8
* secrng.h - public data structures and prototypes for the secure random
11
* $Id: secrng.h,v 1.7 2012/04/25 14:49:43 gerv%gerv.net Exp $
14
/******************************************/
16
** Random number generation. A cryptographically strong random number
22
/* the number of bytes to read from the system random number generator */
23
#define SYSTEM_RNG_SEED_COUNT 1024
28
** The following functions are provided by the security library
29
** but are differently implemented for the UNIX, Win, and OS/2
34
** Get the "noisiest" information available on the system.
35
** The amount of data returned depends on the system implementation.
36
** It will not exceed maxbytes, but may be (much) less.
37
** Returns number of noise bytes copied into buf, or zero if error.
39
extern size_t RNG_GetNoise(void *buf, size_t maxbytes);
42
** RNG_SystemInfoForRNG should be called before any use of SSL. It
43
** gathers up the system specific information to help seed the
44
** state of the global random number generator.
46
extern void RNG_SystemInfoForRNG(void);
49
** Use the contents (and stat) of a file to help seed the
50
** global random number generator.
52
extern void RNG_FileForRNG(const char *filename);
55
** Get maxbytes bytes of random data from the system random number
57
** Returns the number of bytes copied into buf -- maxbytes if success
60
** PR_NOT_IMPLEMENTED_ERROR There is no system RNG on the platform.
61
** SEC_ERROR_NEED_RANDOM The system RNG failed.
63
extern size_t RNG_SystemRNG(void *buf, size_t maxbytes);
67
#endif /* _SECRNG_H_ */