Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers havege.h Source File

havege.h

Go to the documentation of this file.
00001 /**
00002  * \file havege.h
00003  *
00004  * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion
00005  */
00006 /*
00007  *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
00008  *  SPDX-License-Identifier: Apache-2.0
00009  *
00010  *  Licensed under the Apache License, Version 2.0 (the "License"); you may
00011  *  not use this file except in compliance with the License.
00012  *  You may obtain a copy of the License at
00013  *
00014  *  http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  *  Unless required by applicable law or agreed to in writing, software
00017  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00018  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00019  *  See the License for the specific language governing permissions and
00020  *  limitations under the License.
00021  *
00022  *  This file is part of mbed TLS (https://tls.mbed.org)
00023  */
00024 #ifndef MBEDTLS_HAVEGE_H
00025 #define MBEDTLS_HAVEGE_H
00026 
00027 #include <stddef.h>
00028 
00029 #define MBEDTLS_HAVEGE_COLLECT_SIZE 1024
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 /**
00036  * \brief          HAVEGE state structure
00037  */
00038 typedef struct
00039 {
00040     int PT1, PT2, offset[2];
00041     int pool[MBEDTLS_HAVEGE_COLLECT_SIZE];
00042     int WALK[8192];
00043 }
00044 mbedtls_havege_state;
00045 
00046 /**
00047  * \brief          HAVEGE initialization
00048  *
00049  * \param hs       HAVEGE state to be initialized
00050  */
00051 void mbedtls_havege_init( mbedtls_havege_state *hs );
00052 
00053 /**
00054  * \brief          Clear HAVEGE state
00055  *
00056  * \param hs       HAVEGE state to be cleared
00057  */
00058 void mbedtls_havege_free( mbedtls_havege_state *hs );
00059 
00060 /**
00061  * \brief          HAVEGE rand function
00062  *
00063  * \param p_rng    A HAVEGE state
00064  * \param output   Buffer to fill
00065  * \param len      Length of buffer
00066  *
00067  * \return         0
00068  */
00069 int mbedtls_havege_random( void *p_rng, unsigned char *output, size_t len );
00070 
00071 #ifdef __cplusplus
00072 }
00073 #endif
00074 
00075 #endif /* havege.h */