mbedtls ported to mbed-classic

Fork of mbedtls by Christopher Haster

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-2015, 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 #define MBEDTLS_ENTROPY_MIN_HARDWARE     32     /**< Minimum for the hardware source */
00045 
00046 #if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
00047 /**
00048  * \brief           Platform-specific entropy poll callback
00049  */
00050 int mbedtls_platform_entropy_poll( void *data,
00051                            unsigned char *output, size_t len, size_t *olen );
00052 #endif
00053 
00054 #if defined(MBEDTLS_HAVEGE_C)
00055 /**
00056  * \brief           HAVEGE based entropy poll callback
00057  *
00058  * Requires an HAVEGE state as its data pointer.
00059  */
00060 int mbedtls_havege_poll( void *data,
00061                  unsigned char *output, size_t len, size_t *olen );
00062 #endif
00063 
00064 #if defined(MBEDTLS_TIMING_C)
00065 /**
00066  * \brief           mbedtls_timing_hardclock-based entropy poll callback
00067  */
00068 int mbedtls_hardclock_poll( void *data,
00069                     unsigned char *output, size_t len, size_t *olen );
00070 #endif
00071 
00072 #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
00073 /**
00074  * \brief           Entropy poll callback for a hardware source
00075  *
00076  * \warning         This is not provided by mbed TLS!
00077  *                  See \c MBEDTLS_ENTROPY_HARDWARE_ALT in config.h.
00078  *
00079  * \note            This must accept NULL as its first argument.
00080  */
00081 int mbedtls_hardware_poll( void *data,
00082                            unsigned char *output, size_t len, size_t *olen );
00083 #endif
00084 
00085 #ifdef __cplusplus
00086 }
00087 #endif
00088 
00089 #endif /* entropy_poll.h */