Mbed OS Reference
Loading...
Searching...
No Matches
magic.h
1
/*
2
* magic.h - PPP Magic Number definitions.
3
*
4
* Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
8
* are met:
9
*
10
* 1. Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
*
13
* 2. Redistributions in binary form must reproduce the above copyright
14
* notice, this list of conditions and the following disclaimer in
15
* the documentation and/or other materials provided with the
16
* distribution.
17
*
18
* 3. The name "Carnegie Mellon University" must not be used to
19
* endorse or promote products derived from this software without
20
* prior written permission. For permission or any legal
21
* details, please contact
22
* Office of Technology Transfer
23
* Carnegie Mellon University
24
* 5000 Forbes Avenue
25
* Pittsburgh, PA 15213-3890
26
* (412) 268-4387, fax: (412) 268-7395
27
* tech-transfer@andrew.cmu.edu
28
*
29
* 4. Redistributions of any form whatsoever must retain the following
30
* acknowledgment:
31
* "This product includes software developed by Computing Services
32
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
33
*
34
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
35
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
36
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
37
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
38
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
39
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
40
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
41
*
42
* $Id: magic.h,v 1.5 2003/06/11 23:56:26 paulus Exp $
43
*/
44
/*****************************************************************************
45
* /@code
46
*
47
* randm.h - Random number generator header file.
48
*
49
* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
50
* Copyright (c) 1998 Global Election Systems Inc.
51
*
52
* The authors hereby grant permission to use, copy, modify, distribute,
53
* and license this software and its documentation for any purpose, provided
54
* that existing copyright notices are retained in all copies and that this
55
* notice and the following disclaimer are included verbatim in any
56
* distributions. No written agreement, license, or royalty fee is required
57
* for any of the authorized uses.
58
*
59
* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
60
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
61
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
62
* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
63
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
64
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
65
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
66
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
67
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
68
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
69
*
70
******************************************************************************
71
* REVISION HISTORY
72
*
73
* 03-01-01 Marc Boucher <marc@mbsi.ca>
74
* Ported to lwIP.
75
* 98-05-29 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
76
* Extracted from avos.
77
*
78
* /@endcode
79
*****************************************************************************/
80
81
#include "ppp_opts.h"
82
#if PPP_SUPPORT
/* don't build if not configured for use in ppp_opts.h */
83
84
#ifndef MAGIC_H
85
#define MAGIC_H
86
87
#ifdef __cplusplus
88
extern
"C"
{
89
#endif
90
91
/***********************
92
*** PUBLIC FUNCTIONS ***
93
***********************/
94
95
/*
96
* Initialize the random number generator.
97
*/
98
void
magic_init(
void
);
99
100
/*
101
* Randomize our random seed value. To be called for truely random events
102
* such as user operations and network traffic.
103
*/
104
void
magic_randomize(
void
);
105
106
/*
107
* Return a new random number.
108
*/
109
u32_t magic(
void
);
/* Returns the next magic number */
110
111
/*
112
* Fill buffer with random bytes
113
*
114
* Use the random pool to generate random data. This degrades to pseudo
115
* random when used faster than randomness is supplied using magic_churnrand().
116
* Thus it's important to make sure that the results of this are not
117
* published directly because one could predict the next result to at
118
* least some degree. Also, it's important to get a good seed before
119
* the first use.
120
*/
121
void
magic_random_bytes(
unsigned
char
*buf, u32_t buf_len);
122
123
/*
124
* Return a new random number between 0 and (2^pow)-1 included.
125
*/
126
u32_t magic_pow(u8_t pow);
127
128
#ifdef __cplusplus
129
}
130
#endif
131
132
#endif
/* MAGIC_H */
133
134
#endif
/* PPP_SUPPORT */
connectivity
libraries
ppp
include
ppp
magic.h
Generated by
1.9.5