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