]> git.sur5r.net Git - freertos/blob - FreeRTOS-Labs/Source/mbedtls/include/mbedtls/entropy_poll.h
Add the Labs projects provided in the V10.2.1_191129 zip file.
[freertos] / FreeRTOS-Labs / Source / mbedtls / include / mbedtls / entropy_poll.h
1 /**\r
2  * \file entropy_poll.h\r
3  *\r
4  * \brief Platform-specific and custom entropy polling functions\r
5  */\r
6 /*\r
7  *  Copyright (C) 2006-2016, ARM Limited, All Rights Reserved\r
8  *  SPDX-License-Identifier: Apache-2.0\r
9  *\r
10  *  Licensed under the Apache License, Version 2.0 (the "License"); you may\r
11  *  not use this file except in compliance with the License.\r
12  *  You may obtain a copy of the License at\r
13  *\r
14  *  http://www.apache.org/licenses/LICENSE-2.0\r
15  *\r
16  *  Unless required by applicable law or agreed to in writing, software\r
17  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
18  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
19  *  See the License for the specific language governing permissions and\r
20  *  limitations under the License.\r
21  *\r
22  *  This file is part of mbed TLS (https://tls.mbed.org)\r
23  */\r
24 #ifndef MBEDTLS_ENTROPY_POLL_H\r
25 #define MBEDTLS_ENTROPY_POLL_H\r
26 \r
27 #if !defined(MBEDTLS_CONFIG_FILE)\r
28 #include "config.h"\r
29 #else\r
30 #include MBEDTLS_CONFIG_FILE\r
31 #endif\r
32 \r
33 #include <stddef.h>\r
34 \r
35 #ifdef __cplusplus\r
36 extern "C" {\r
37 #endif\r
38 \r
39 /*\r
40  * Default thresholds for built-in sources, in bytes\r
41  */\r
42 #define MBEDTLS_ENTROPY_MIN_PLATFORM     32     /**< Minimum for platform source    */\r
43 #define MBEDTLS_ENTROPY_MIN_HAVEGE       32     /**< Minimum for HAVEGE             */\r
44 #define MBEDTLS_ENTROPY_MIN_HARDCLOCK     4     /**< Minimum for mbedtls_timing_hardclock()        */\r
45 #if !defined(MBEDTLS_ENTROPY_MIN_HARDWARE)\r
46 #define MBEDTLS_ENTROPY_MIN_HARDWARE     32     /**< Minimum for the hardware source */\r
47 #endif\r
48 \r
49 /**\r
50  * \brief           Entropy poll callback that provides 0 entropy.\r
51  */\r
52 #if defined(MBEDTLS_TEST_NULL_ENTROPY)\r
53     int mbedtls_null_entropy_poll( void *data,\r
54                                 unsigned char *output, size_t len, size_t *olen );\r
55 #endif\r
56 \r
57 #if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)\r
58 /**\r
59  * \brief           Platform-specific entropy poll callback\r
60  */\r
61 int mbedtls_platform_entropy_poll( void *data,\r
62                            unsigned char *output, size_t len, size_t *olen );\r
63 #endif\r
64 \r
65 #if defined(MBEDTLS_HAVEGE_C)\r
66 /**\r
67  * \brief           HAVEGE based entropy poll callback\r
68  *\r
69  * Requires an HAVEGE state as its data pointer.\r
70  */\r
71 int mbedtls_havege_poll( void *data,\r
72                  unsigned char *output, size_t len, size_t *olen );\r
73 #endif\r
74 \r
75 #if defined(MBEDTLS_TIMING_C)\r
76 /**\r
77  * \brief           mbedtls_timing_hardclock-based entropy poll callback\r
78  */\r
79 int mbedtls_hardclock_poll( void *data,\r
80                     unsigned char *output, size_t len, size_t *olen );\r
81 #endif\r
82 \r
83 #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT)\r
84 /**\r
85  * \brief           Entropy poll callback for a hardware source\r
86  *\r
87  * \warning         This is not provided by mbed TLS!\r
88  *                  See \c MBEDTLS_ENTROPY_HARDWARE_ALT in config.h.\r
89  *\r
90  * \note            This must accept NULL as its first argument.\r
91  */\r
92 int mbedtls_hardware_poll( void *data,\r
93                            unsigned char *output, size_t len, size_t *olen );\r
94 #endif\r
95 \r
96 #if defined(MBEDTLS_ENTROPY_NV_SEED)\r
97 /**\r
98  * \brief           Entropy poll callback for a non-volatile seed file\r
99  *\r
100  * \note            This must accept NULL as its first argument.\r
101  */\r
102 int mbedtls_nv_seed_poll( void *data,\r
103                           unsigned char *output, size_t len, size_t *olen );\r
104 #endif\r
105 \r
106 #ifdef __cplusplus\r
107 }\r
108 #endif\r
109 \r
110 #endif /* entropy_poll.h */\r