Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
magic.h
00001 /* 00002 * magic.h - PPP Magic Number definitions. 00003 * 00004 * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 00010 * 1. Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 00013 * 2. Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in 00015 * the documentation and/or other materials provided with the 00016 * distribution. 00017 * 00018 * 3. The name "Carnegie Mellon University" must not be used to 00019 * endorse or promote products derived from this software without 00020 * prior written permission. For permission or any legal 00021 * details, please contact 00022 * Office of Technology Transfer 00023 * Carnegie Mellon University 00024 * 5000 Forbes Avenue 00025 * Pittsburgh, PA 15213-3890 00026 * (412) 268-4387, fax: (412) 268-7395 00027 * tech-transfer@andrew.cmu.edu 00028 * 00029 * 4. Redistributions of any form whatsoever must retain the following 00030 * acknowledgment: 00031 * "This product includes software developed by Computing Services 00032 * at Carnegie Mellon University (http://www.cmu.edu/computing/)." 00033 * 00034 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO 00035 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00036 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE 00037 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 00038 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 00039 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 00040 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00041 * 00042 * $Id: magic.h,v 1.5 2003/06/11 23:56:26 paulus Exp $ 00043 */ 00044 /***************************************************************************** 00045 * /@code 00046 * 00047 * randm.h - Random number generator header file. 00048 * 00049 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. 00050 * Copyright (c) 1998 Global Election Systems Inc. 00051 * 00052 * The authors hereby grant permission to use, copy, modify, distribute, 00053 * and license this software and its documentation for any purpose, provided 00054 * that existing copyright notices are retained in all copies and that this 00055 * notice and the following disclaimer are included verbatim in any 00056 * distributions. No written agreement, license, or royalty fee is required 00057 * for any of the authorized uses. 00058 * 00059 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR 00060 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00061 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00062 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00063 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00064 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00065 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00066 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00067 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00068 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00069 * 00070 ****************************************************************************** 00071 * REVISION HISTORY 00072 * 00073 * 03-01-01 Marc Boucher <marc@mbsi.ca> 00074 * Ported to lwIP. 00075 * 98-05-29 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc. 00076 * Extracted from avos. 00077 * 00078 * /@endcode 00079 *****************************************************************************/ 00080 00081 #include "ppp_opts.h" 00082 #if PPP_SUPPORT /* don't build if not configured for use in ppp_opts.h */ 00083 00084 #ifndef MAGIC_H 00085 #define MAGIC_H 00086 00087 #ifdef __cplusplus 00088 extern "C" { 00089 #endif 00090 00091 /*********************** 00092 *** PUBLIC FUNCTIONS *** 00093 ***********************/ 00094 00095 /* 00096 * Initialize the random number generator. 00097 */ 00098 void magic_init(void); 00099 00100 /* 00101 * Randomize our random seed value. To be called for truely random events 00102 * such as user operations and network traffic. 00103 */ 00104 void magic_randomize(void); 00105 00106 /* 00107 * Return a new random number. 00108 */ 00109 u32_t magic(void); /* Returns the next magic number */ 00110 00111 /* 00112 * Fill buffer with random bytes 00113 * 00114 * Use the random pool to generate random data. This degrades to pseudo 00115 * random when used faster than randomness is supplied using magic_churnrand(). 00116 * Thus it's important to make sure that the results of this are not 00117 * published directly because one could predict the next result to at 00118 * least some degree. Also, it's important to get a good seed before 00119 * the first use. 00120 */ 00121 void magic_random_bytes(unsigned char *buf, u32_t buf_len); 00122 00123 /* 00124 * Return a new random number between 0 and (2^pow)-1 included. 00125 */ 00126 u32_t magic_pow(u8_t pow); 00127 00128 #ifdef __cplusplus 00129 } 00130 #endif 00131 00132 #endif /* MAGIC_H */ 00133 00134 #endif /* PPP_SUPPORT */
Generated on Tue Jul 12 2022 13:54:31 by
