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