Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers entropy_poll.h Source File

entropy_poll.h

Go to the documentation of this file.
00001 /**
00002  * \file entropy_poll.h
00003  *
00004  * \brief Platform-specific and custom entropy polling functions
00005  *
00006  *  Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
00007  *  SPDX-License-Identifier: Apache-2.0
00008  *
00009  *  Licensed under the Apache License, Version 2.0 (the "License"); you may
00010  *  not use this file except in compliance with the License.
00011  *  You may obtain a copy of the License at
00012  *
00013  *  http://www.apache.org/licenses/LICENSE-2.0
00014  *
00015  *  Unless required by applicable law or agreed to in writing, software
00016  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00017  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018  *  See the License for the specific language governing permissions and
00019  *  limitations under the License.
00020  *
00021  *  This file is part of mbed TLS (https://tls.mbed.org)
00022  */
00023 #ifndef MBEDTLS_ENTROPY_POLL_H
00024 #define MBEDTLS_ENTROPY_POLL_H
00025 
00026 #if !defined(MBEDTLS_CONFIG_FILE)
00027 #include "config.h"
00028 #else
00029 #include MBEDTLS_CONFIG_FILE
00030 #endif
00031 
00032 #include <stddef.h>
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038 /*
00039  * Default thresholds for built-in sources, in bytes
00040  */
00041 #define MBEDTLS_ENTROPY_MIN_PLATFORM     32     /**< Minimum for platform source    */
00042 #define MBEDTLS_ENTROPY_MIN_HAVEGE       32     /**< Minimum for HAVEGE             */
00043 #define MBEDTLS_ENTROPY_MIN_HARDCLOCK     4     /**< Minimum for mbedtls_timing_hardclock()        */
00044 #if !defined(MBEDTLS_ENTROPY_MIN_HARDWARE)
00045 #define MBEDTLS_ENTROPY_MIN_HARDWARE     32     /**< Minimum for the hardware source */
00046 #endif
00047 
00048 /**
00049  * \brief           Entropy poll callback that provides 0 entropy.
00050  */
00051 #if defined(MBEDTLS_TEST_NULL_ENTROPY)
00052     int mbedtls_null_entropy_poll( void *data,
00053                                 unsigned char *output, size_t len, size_t *olen );
00054 #endif
00055 
00056 #if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
00057 /**
00058  * \brief           Platform-specific entropy poll callback
00059  */
00060 int mbedtls_platform_entropy_poll( void *data,
00061                            unsigned char *output, size_t len, size_t *olen );
00062 #endif
00063 
00064 #if defined(MBEDTLS_HAVEGE_C)
00065 /**
00066  * \brief           HAVEGE based entropy poll callback
00067  *
00068  * Requires an HAVEGE state as its data pointer.
00069  */
00070 int mbedtls_havege_poll( void *data,
00071                  unsigned char *output, size_t len, size_t *olen );
00072 #endif
00073 
00074 #if defined(MBEDTLS_TIMING_C)
00075 /**
00076  * \brief           mbedtls_timing_hardclock-based entropy poll callback
00077  */
00078 int mbedtls_hardclock_poll( void *data,
00079                     unsigned char *output, size_t len, size_t *olen );
00080 #endif
00081 
00082 #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
00083 /**
00084  * \brief           Entropy poll callback for a hardware source
00085  *
00086  * \warning         This is not provided by mbed TLS!
00087  *                  See \c MBEDTLS_ENTROPY_HARDWARE_ALT in config.h.
00088  *
00089  * \note            This must accept NULL as its first argument.
00090  */
00091 int mbedtls_hardware_poll( void *data,
00092                            unsigned char *output, size_t len, size_t *olen );
00093 #endif
00094 
00095 #if defined(MBEDTLS_ENTROPY_NV_SEED)
00096 /**
00097  * \brief           Entropy poll callback for a non-volatile seed file
00098  *
00099  * \note            This must accept NULL as its first argument.
00100  */
00101 int mbedtls_nv_seed_poll( void *data,
00102                           unsigned char *output, size_t len, size_t *olen );
00103 #endif
00104 
00105 #ifdef __cplusplus
00106 }
00107 #endif
00108 
00109 #endif /* entropy_poll.h */