mbed TLS Build
include/mbedtls/havege.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 havege.h |
markrad | 0:cdf462088d13 | 3 | * |
markrad | 0:cdf462088d13 | 4 | * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion |
markrad | 0:cdf462088d13 | 5 | * |
markrad | 0:cdf462088d13 | 6 | * Copyright (C) 2006-2015, 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_HAVEGE_H |
markrad | 0:cdf462088d13 | 24 | #define MBEDTLS_HAVEGE_H |
markrad | 0:cdf462088d13 | 25 | |
markrad | 0:cdf462088d13 | 26 | #include <stddef.h> |
markrad | 0:cdf462088d13 | 27 | |
markrad | 0:cdf462088d13 | 28 | #define MBEDTLS_HAVEGE_COLLECT_SIZE 1024 |
markrad | 0:cdf462088d13 | 29 | |
markrad | 0:cdf462088d13 | 30 | #ifdef __cplusplus |
markrad | 0:cdf462088d13 | 31 | extern "C" { |
markrad | 0:cdf462088d13 | 32 | #endif |
markrad | 0:cdf462088d13 | 33 | |
markrad | 0:cdf462088d13 | 34 | /** |
markrad | 0:cdf462088d13 | 35 | * \brief HAVEGE state structure |
markrad | 0:cdf462088d13 | 36 | */ |
markrad | 0:cdf462088d13 | 37 | typedef struct |
markrad | 0:cdf462088d13 | 38 | { |
markrad | 0:cdf462088d13 | 39 | int PT1, PT2, offset[2]; |
markrad | 0:cdf462088d13 | 40 | int pool[MBEDTLS_HAVEGE_COLLECT_SIZE]; |
markrad | 0:cdf462088d13 | 41 | int WALK[8192]; |
markrad | 0:cdf462088d13 | 42 | } |
markrad | 0:cdf462088d13 | 43 | mbedtls_havege_state; |
markrad | 0:cdf462088d13 | 44 | |
markrad | 0:cdf462088d13 | 45 | /** |
markrad | 0:cdf462088d13 | 46 | * \brief HAVEGE initialization |
markrad | 0:cdf462088d13 | 47 | * |
markrad | 0:cdf462088d13 | 48 | * \param hs HAVEGE state to be initialized |
markrad | 0:cdf462088d13 | 49 | */ |
markrad | 0:cdf462088d13 | 50 | void mbedtls_havege_init( mbedtls_havege_state *hs ); |
markrad | 0:cdf462088d13 | 51 | |
markrad | 0:cdf462088d13 | 52 | /** |
markrad | 0:cdf462088d13 | 53 | * \brief Clear HAVEGE state |
markrad | 0:cdf462088d13 | 54 | * |
markrad | 0:cdf462088d13 | 55 | * \param hs HAVEGE state to be cleared |
markrad | 0:cdf462088d13 | 56 | */ |
markrad | 0:cdf462088d13 | 57 | void mbedtls_havege_free( mbedtls_havege_state *hs ); |
markrad | 0:cdf462088d13 | 58 | |
markrad | 0:cdf462088d13 | 59 | /** |
markrad | 0:cdf462088d13 | 60 | * \brief HAVEGE rand function |
markrad | 0:cdf462088d13 | 61 | * |
markrad | 0:cdf462088d13 | 62 | * \param p_rng A HAVEGE state |
markrad | 0:cdf462088d13 | 63 | * \param output Buffer to fill |
markrad | 0:cdf462088d13 | 64 | * \param len Length of buffer |
markrad | 0:cdf462088d13 | 65 | * |
markrad | 0:cdf462088d13 | 66 | * \return 0 |
markrad | 0:cdf462088d13 | 67 | */ |
markrad | 0:cdf462088d13 | 68 | int mbedtls_havege_random( void *p_rng, unsigned char *output, size_t len ); |
markrad | 0:cdf462088d13 | 69 | |
markrad | 0:cdf462088d13 | 70 | #ifdef __cplusplus |
markrad | 0:cdf462088d13 | 71 | } |
markrad | 0:cdf462088d13 | 72 | #endif |
markrad | 0:cdf462088d13 | 73 | |
markrad | 0:cdf462088d13 | 74 | #endif /* havege.h */ |