security/nss/lib/freebl/secrng.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     5 #ifndef _SECRNG_H_
     6 #define _SECRNG_H_
     7 /*
     8  * secrng.h - public data structures and prototypes for the secure random
     9  *	      number generator
    10  */
    12 /******************************************/
    13 /*
    14 ** Random number generation. A cryptographically strong random number
    15 ** generator.
    16 */
    18 #include "blapi.h"
    20 /* the number of bytes to read from the system random number generator */
    21 #define SYSTEM_RNG_SEED_COUNT 1024
    23 SEC_BEGIN_PROTOS
    25 /*
    26 ** The following functions are provided by the security library
    27 ** but are differently implemented for the UNIX, Win, and OS/2
    28 ** versions
    29 */
    31 /*
    32 ** Get the "noisiest" information available on the system.
    33 ** The amount of data returned depends on the system implementation.
    34 ** It will not exceed maxbytes, but may be (much) less.
    35 ** Returns number of noise bytes copied into buf, or zero if error.
    36 */
    37 extern size_t RNG_GetNoise(void *buf, size_t maxbytes);
    39 /*
    40 ** RNG_SystemInfoForRNG should be called before any use of SSL. It
    41 ** gathers up the system specific information to help seed the
    42 ** state of the global random number generator.
    43 */
    44 extern void RNG_SystemInfoForRNG(void);
    46 /* 
    47 ** Use the contents (and stat) of a file to help seed the
    48 ** global random number generator.
    49 */
    50 extern void RNG_FileForRNG(const char *filename);
    52 /*
    53 ** Get maxbytes bytes of random data from the system random number
    54 ** generator.
    55 ** Returns the number of bytes copied into buf -- maxbytes if success
    56 ** or zero if error.
    57 ** Errors:
    58 **   PR_NOT_IMPLEMENTED_ERROR   There is no system RNG on the platform.
    59 **   SEC_ERROR_NEED_RANDOM      The system RNG failed.
    60 */
    61 extern size_t RNG_SystemRNG(void *buf, size_t maxbytes);
    63 SEC_END_PROTOS
    65 #endif /* _SECRNG_H_ */

mercurial