GME  13
Classes | Typedefs | Functions | Variables
Random Functions

Classes

struct  apr_crypto_hash_t

Typedefs

typedef struct apr_crypto_hash_t apr_crypto_hash_t
typedef void apr_crypto_hash_init_t (apr_crypto_hash_t *hash)
typedef void apr_crypto_hash_add_t (apr_crypto_hash_t *hash, const void *data, apr_size_t bytes)
typedef void apr_crypto_hash_finish_t (apr_crypto_hash_t *hash, unsigned char *result)
typedef struct apr_random_t apr_random_t

Functions

 APR_DECLARE (apr_crypto_hash_t *) apr_crypto_sha256_new(apr_pool_t *p)
 APR_DECLARE (void) apr_random_init(apr_random_t *g
 APR_DECLARE (apr_random_t *) apr_random_standard_new(apr_pool_t *p)
 APR_DECLARE (apr_status_t) apr_random_insecure_bytes(apr_random_t *g

Variables

apr_pool_tp
apr_pool_t apr_crypto_hash_tpool_hash
apr_pool_t apr_crypto_hash_t
apr_crypto_hash_t
key_hash
apr_pool_t apr_crypto_hash_t
apr_crypto_hash_t
apr_crypto_hash_t
prng_hash
const void * entropy_
const void apr_size_t bytes
void * random

Typedef Documentation

typedef void apr_crypto_hash_add_t(apr_crypto_hash_t *hash, const void *data, apr_size_t bytes)

Definition at line 41 of file apr_random.h.

typedef void apr_crypto_hash_finish_t(apr_crypto_hash_t *hash, unsigned char *result)

Definition at line 43 of file apr_random.h.

Definition at line 40 of file apr_random.h.

Definition at line 38 of file apr_random.h.

typedef struct apr_random_t apr_random_t

Opaque PRNG structure.

Definition at line 63 of file apr_random.h.


Function Documentation

Allocate and initialize the SHA-256 context

Parameters:
pThe pool to allocate from
APR_DECLARE ( void  )

Initialize a PRNG state

Parameters:
gThe PRNG state
pThe pool to allocate from
pool_hashPool hash functions
key_hashKey hash functions
prng_hashPRNG hash functions

Mix the randomness pools.

Parameters:
gThe PRNG state
entropy_Entropy buffer
bytesLength of entropy_ in bytes

Ensures that E bits of conditional entropy are mixed into the PRNG before any further randomness is extracted.

Parameters:
gThe RNG state

Mix the randomness pools after forking.

Parameters:
procThe resulting process handle from apr_proc_fork()
Remarks:
Call this in the child after forking to mix the randomness pools. Note that its generally a bad idea to fork a process with a real PRNG in it - better to have the PRNG externally and get the randomness from there. However, if you really must do it, then you should supply all your entropy to all the PRNGs - don't worry, they won't produce the same output.
Note that apr_proc_fork() calls this for you, so only weird applications need ever call it themselves.

Allocate and initialize (apr_crypto_sha256_new) a new PRNG state.

Parameters:
pThe pool to allocate from

Generate cryptographically insecure random bytes.

Parameters:
gThe RNG state
randomBuffer to fill with random bytes
bytesLength of buffer in bytes

Generate cryptographically secure random bytes.

Parameters:
gThe RNG state
randomBuffer to fill with random bytes
bytesLength of buffer in bytes

Return APR_SUCCESS if the cryptographic PRNG has been seeded with enough data, APR_ENOTENOUGHENTROPY otherwise.

Parameters:
rThe RNG state

Return APR_SUCCESS if the PRNG has been seeded with enough data, APR_ENOTENOUGHENTROPY otherwise.

Parameters:
rThe PRNG state

Variable Documentation

void apr_size_t bytes

Definition at line 90 of file apr_random.h.

const void* entropy_

Definition at line 90 of file apr_random.h.

Definition at line 73 of file apr_random.h.

Definition at line 73 of file apr_random.h.

Definition at line 73 of file apr_random.h.

Definition at line 73 of file apr_random.h.

Definition at line 99 of file apr_random.h.