<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Apache Portable Runtime: apr_random.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.3.9.1 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div> <div class="nav"> <a class="el" href="dir_000000.html">home</a> / <a class="el" href="dir_000001.html">oden</a> / <a class="el" href="dir_000002.html">RPM</a> / <a class="el" href="dir_000003.html">BUILD</a> / <a class="el" href="dir_000004.html">apr-1.1.1</a> / <a class="el" href="dir_000005.html">include</a></div> <h1>apr_random.h</h1><div class="fragment"><pre class="fragment">00001 <span class="comment">/* Copyright 2000-2004 The Apache Software Foundation</span> 00002 <span class="comment"> *</span> 00003 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span> 00004 <span class="comment"> * you may not use this file except in compliance with the License.</span> 00005 <span class="comment"> * You may obtain a copy of the License at</span> 00006 <span class="comment"> *</span> 00007 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span> 00008 <span class="comment"> *</span> 00009 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span> 00010 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span> 00011 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span> 00012 <span class="comment"> * See the License for the specific language governing permissions and</span> 00013 <span class="comment"> * limitations under the License.</span> 00014 <span class="comment"> */</span> 00015 00016 <span class="preprocessor">#ifndef APR_RANDOM_H</span> 00017 <span class="preprocessor"></span><span class="preprocessor">#define APR_RANDOM_H</span> 00018 <span class="preprocessor"></span> 00019 <span class="preprocessor">#include <<a class="code" href="apr__pools_8h.html">apr_pools.h</a>></span> 00020 00021 <span class="keyword">typedef</span> <span class="keyword">struct </span>apr_crypto_hash_t apr_crypto_hash_t; 00022 00023 <span class="keyword">typedef</span> <span class="keywordtype">void</span> apr_crypto_hash_init_t(apr_crypto_hash_t *hash); 00024 <span class="keyword">typedef</span> <span class="keywordtype">void</span> apr_crypto_hash_add_t(apr_crypto_hash_t *hash,<span class="keyword">const</span> <span class="keywordtype">void</span> *data, 00025 apr_size_t bytes); 00026 <span class="keyword">typedef</span> <span class="keywordtype">void</span> apr_crypto_hash_finish_t(apr_crypto_hash_t *hash, 00027 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *result); 00028 00029 <span class="comment">/* FIXME: make this opaque */</span> 00030 <span class="keyword">struct </span>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 <span class="keywordtype">void</span> *data; 00036 }; 00037 00038 <a class="code" href="group__apr__platform.html#ga123">APR_DECLARE</a>(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(<span class="keywordtype">void</span>) 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(<span class="keywordtype">void</span>) apr_random_add_entropy(apr_random_t *g, 00048 const <span class="keywordtype">void</span> *entropy_, 00049 apr_size_t bytes); 00050 APR_DECLARE(apr_status_t) apr_random_insecure_bytes(apr_random_t *g, 00051 <span class="keywordtype">void</span> *random, 00052 apr_size_t bytes); 00053 APR_DECLARE(apr_status_t) apr_random_secure_bytes(apr_random_t *g, 00054 <span class="keywordtype">void</span> *random, 00055 apr_size_t bytes); 00056 APR_DECLARE(<span class="keywordtype">void</span>) 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 <span class="comment">/* Call this in the child after forking to mix the randomness</span> 00061 <span class="comment"> pools. Note that its generally a bad idea to fork a process with a</span> 00062 <span class="comment"> real PRNG in it - better to have the PRNG externally and get the</span> 00063 <span class="comment"> randomness from there. However, if you really must do it, then you</span> 00064 <span class="comment"> should supply all your entropy to all the PRNGs - don't worry, they</span> 00065 <span class="comment"> won't produce the same output.</span> 00066 <span class="comment"></span> 00067 <span class="comment"> Note that apr_proc_fork() calls this for you, so only weird</span> 00068 <span class="comment"> applications need ever call it themselves.</span> 00069 <span class="comment">*/</span> 00070 struct <a class="code" href="structapr__proc__t.html">apr_proc_t</a>; 00071 APR_DECLARE(<span class="keywordtype">void</span>) apr_random_after_fork(struct apr_proc_t *proc); 00072 00073 #endif <span class="comment">/* ndef APR_RANDOM_H */</span> </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Mar 20 19:52:26 2005 for Apache Portable Runtime by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address> </body> </html>