]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/lwIP_MCF5235_GCC/lwip/src/netif/ppp/randm.h
Add FreeRTOS-Plus directory.
[freertos] / FreeRTOS / Demo / lwIP_MCF5235_GCC / lwip / src / netif / ppp / randm.h
1 /*****************************************************************************\r
2 * randm.h - Random number generator header file.\r
3 *\r
4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.\r
5 * Copyright (c) 1998 Global Election Systems Inc.\r
6 *\r
7 * The authors hereby grant permission to use, copy, modify, distribute,\r
8 * and license this software and its documentation for any purpose, provided\r
9 * that existing copyright notices are retained in all copies and that this\r
10 * notice and the following disclaimer are included verbatim in any \r
11 * distributions. No written agreement, license, or royalty fee is required\r
12 * for any of the authorized uses.\r
13 *\r
14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR\r
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\r
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \r
17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\r
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
24 *\r
25 ******************************************************************************\r
26 * REVISION HISTORY\r
27 *\r
28 * 03-01-01 Marc Boucher <marc@mbsi.ca>\r
29 *   Ported to lwIP.\r
30 * 98-05-29 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.\r
31 *       Extracted from avos.\r
32 *****************************************************************************/\r
33 \r
34 #ifndef RANDM_H\r
35 #define RANDM_H\r
36 \r
37 /***********************\r
38 *** PUBLIC FUNCTIONS ***\r
39 ***********************/\r
40 /*\r
41  * Initialize the random number generator.\r
42  */\r
43 void avRandomInit(void);\r
44 \r
45 /*\r
46  * Churn the randomness pool on a random event.  Call this early and often\r
47  *      on random and semi-random system events to build randomness in time for\r
48  *      usage.  For randomly timed events, pass a null pointer and a zero length\r
49  *      and this will use the system timer and other sources to add randomness.\r
50  *      If new random data is available, pass a pointer to that and it will be\r
51  *      included.\r
52  */\r
53 void avChurnRand(char *randData, u32_t randLen);\r
54 \r
55 /*\r
56  * Randomize our random seed value.  To be called for truely random events\r
57  * such as user operations and network traffic.\r
58  */\r
59 #if MD5_SUPPORT\r
60 #define avRandomize()   avChurnRand(NULL, 0)\r
61 #else\r
62 void avRandomize(void);\r
63 #endif\r
64 \r
65 /*\r
66  * Use the random pool to generate random data.  This degrades to pseudo\r
67  *      random when used faster than randomness is supplied using churnRand().\r
68  *      Thus it's important to make sure that the results of this are not\r
69  *      published directly because one could predict the next result to at\r
70  *      least some degree.  Also, it's important to get a good seed before\r
71  *      the first use.\r
72  */\r
73 void avGenRand(char *buf, u32_t bufLen);\r
74 \r
75 /*\r
76  * Return a new random number.\r
77  */\r
78 u32_t avRandom(void);\r
79 \r
80 \r
81 #endif /* RANDM_H */\r