sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
magic.h
Go to the documentation of this file.
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* randm.h - Random number generator header file.
46*
47* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
48* Copyright (c) 1998 Global Election Systems Inc.
49*
50* The authors hereby grant permission to use, copy, modify, distribute,
51* and license this software and its documentation for any purpose, provided
52* that existing copyright notices are retained in all copies and that this
53* notice and the following disclaimer are included verbatim in any
54* distributions. No written agreement, license, or royalty fee is required
55* for any of the authorized uses.
56*
57* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
58* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
59* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
60* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
61* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
62* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
63* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
64* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
65* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
66* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67*
68******************************************************************************
69* REVISION HISTORY
70*
71* 03-01-01 Marc Boucher <marc@mbsi.ca>
72* Ported to lwIP.
73* 98-05-29 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
74* Extracted from avos.
75*****************************************************************************/
76
81#include "netif/ppp/ppp_opts.h"
82#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
83
84#ifndef MAGIC_H
85#define MAGIC_H
86
87#ifdef __cplusplus
88extern "C" {
89#endif
90
91/***********************
92*** PUBLIC FUNCTIONS ***
93***********************/
94
95/*
96 * Initialize the random number generator.
97 */
98void magic_init(void);
99
100/*
101 * Randomize our random seed value. To be called for truly random events
102 * such as user operations and network traffic.
103 */
104void magic_randomize(void);
105
106/*
107 * Return a new random number.
108 */
109u32_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 */
121void 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 */
126u32_t magic_pow(u8_t pow);
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif /* MAGIC_H */
133
134#endif /* PPP_SUPPORT */