OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [lwip_tcpip/] [current/] [src/] [netif/] [ppp/] [randm.h] - Blame information for rev 865

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.