00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef APR_RANDOM_H
00017 #define APR_RANDOM_H
00018
00019 #include <apr_pools.h>
00020
00021 typedef struct apr_crypto_hash_t apr_crypto_hash_t;
00022
00023 typedef void apr_crypto_hash_init_t(apr_crypto_hash_t *hash);
00024 typedef void apr_crypto_hash_add_t(apr_crypto_hash_t *hash,const void *data,
00025 apr_size_t bytes);
00026 typedef void apr_crypto_hash_finish_t(apr_crypto_hash_t *hash,
00027 unsigned char *result);
00028
00029
00030 struct apr_crypto_hash_t {
00031 apr_crypto_hash_init_t *init;
00032 apr_crypto_hash_add_t *add;
00033 apr_crypto_hash_finish_t *finish;
00034 apr_size_t size;
00035 void *data;
00036 };
00037
00038 APR_DECLARE(apr_crypto_hash_t *) apr_crypto_sha256_new(apr_pool_t *p);
00039
00040 typedef struct apr_random_t apr_random_t;
00041
00042 APR_DECLARE(void) apr_random_init(apr_random_t *g,apr_pool_t *p,
00043 apr_crypto_hash_t *pool_hash,
00044 apr_crypto_hash_t *key_hash,
00045 apr_crypto_hash_t *prng_hash);
00046 APR_DECLARE(apr_random_t *) apr_random_standard_new(apr_pool_t *p);
00047 APR_DECLARE(void) apr_random_add_entropy(apr_random_t *g,
00048 const void *entropy_,
00049 apr_size_t bytes);
00050 APR_DECLARE(apr_status_t) apr_random_insecure_bytes(apr_random_t *g,
00051 void *random,
00052 apr_size_t bytes);
00053 APR_DECLARE(apr_status_t) apr_random_secure_bytes(apr_random_t *g,
00054 void *random,
00055 apr_size_t bytes);
00056 APR_DECLARE(void) apr_random_barrier(apr_random_t *g);
00057 APR_DECLARE(apr_status_t) apr_random_secure_ready(apr_random_t *r);
00058 APR_DECLARE(apr_status_t) apr_random_insecure_ready(apr_random_t *r);
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 struct apr_proc_t;
00071 APR_DECLARE(void) apr_random_after_fork(struct apr_proc_t *proc);
00072
00073 #endif