Brandon Fictorie / Mbed 2 deprecated BF_Websocket

Dependencies:   mbed

Committer:
bfictorie
Date:
Sun Mar 25 17:26:30 2012 +0000
Revision:
0:8cdad1c73e8e

        

Who changed what in which revision?

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