Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: WncControllerK64F
Fork of WNCInterface by
mbedtls/mbedtls/havege.h@33:f41d199375f0, 2018-04-05 (annotated)
- Committer:
- korycanjan
- Date:
- Thu Apr 05 03:17:03 2018 +0000
- Revision:
- 33:f41d199375f0
- Parent:
- 12:0071cb144c7a
Better stability
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JMF | 12:0071cb144c7a | 1 | /** |
JMF | 12:0071cb144c7a | 2 | * \file havege.h |
JMF | 12:0071cb144c7a | 3 | * |
JMF | 12:0071cb144c7a | 4 | * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion |
JMF | 12:0071cb144c7a | 5 | * |
JMF | 12:0071cb144c7a | 6 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved |
JMF | 12:0071cb144c7a | 7 | * SPDX-License-Identifier: Apache-2.0 |
JMF | 12:0071cb144c7a | 8 | * |
JMF | 12:0071cb144c7a | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
JMF | 12:0071cb144c7a | 10 | * not use this file except in compliance with the License. |
JMF | 12:0071cb144c7a | 11 | * You may obtain a copy of the License at |
JMF | 12:0071cb144c7a | 12 | * |
JMF | 12:0071cb144c7a | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
JMF | 12:0071cb144c7a | 14 | * |
JMF | 12:0071cb144c7a | 15 | * Unless required by applicable law or agreed to in writing, software |
JMF | 12:0071cb144c7a | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
JMF | 12:0071cb144c7a | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
JMF | 12:0071cb144c7a | 18 | * See the License for the specific language governing permissions and |
JMF | 12:0071cb144c7a | 19 | * limitations under the License. |
JMF | 12:0071cb144c7a | 20 | * |
JMF | 12:0071cb144c7a | 21 | * This file is part of mbed TLS (https://tls.mbed.org) |
JMF | 12:0071cb144c7a | 22 | */ |
JMF | 12:0071cb144c7a | 23 | #ifndef MBEDTLS_HAVEGE_H |
JMF | 12:0071cb144c7a | 24 | #define MBEDTLS_HAVEGE_H |
JMF | 12:0071cb144c7a | 25 | |
JMF | 12:0071cb144c7a | 26 | #include <stddef.h> |
JMF | 12:0071cb144c7a | 27 | |
JMF | 12:0071cb144c7a | 28 | #define MBEDTLS_HAVEGE_COLLECT_SIZE 1024 |
JMF | 12:0071cb144c7a | 29 | |
JMF | 12:0071cb144c7a | 30 | #ifdef __cplusplus |
JMF | 12:0071cb144c7a | 31 | extern "C" { |
JMF | 12:0071cb144c7a | 32 | #endif |
JMF | 12:0071cb144c7a | 33 | |
JMF | 12:0071cb144c7a | 34 | /** |
JMF | 12:0071cb144c7a | 35 | * \brief HAVEGE state structure |
JMF | 12:0071cb144c7a | 36 | */ |
JMF | 12:0071cb144c7a | 37 | typedef struct |
JMF | 12:0071cb144c7a | 38 | { |
JMF | 12:0071cb144c7a | 39 | int PT1, PT2, offset[2]; |
JMF | 12:0071cb144c7a | 40 | int pool[MBEDTLS_HAVEGE_COLLECT_SIZE]; |
JMF | 12:0071cb144c7a | 41 | int WALK[8192]; |
JMF | 12:0071cb144c7a | 42 | } |
JMF | 12:0071cb144c7a | 43 | mbedtls_havege_state; |
JMF | 12:0071cb144c7a | 44 | |
JMF | 12:0071cb144c7a | 45 | /** |
JMF | 12:0071cb144c7a | 46 | * \brief HAVEGE initialization |
JMF | 12:0071cb144c7a | 47 | * |
JMF | 12:0071cb144c7a | 48 | * \param hs HAVEGE state to be initialized |
JMF | 12:0071cb144c7a | 49 | */ |
JMF | 12:0071cb144c7a | 50 | void mbedtls_havege_init( mbedtls_havege_state *hs ); |
JMF | 12:0071cb144c7a | 51 | |
JMF | 12:0071cb144c7a | 52 | /** |
JMF | 12:0071cb144c7a | 53 | * \brief Clear HAVEGE state |
JMF | 12:0071cb144c7a | 54 | * |
JMF | 12:0071cb144c7a | 55 | * \param hs HAVEGE state to be cleared |
JMF | 12:0071cb144c7a | 56 | */ |
JMF | 12:0071cb144c7a | 57 | void mbedtls_havege_free( mbedtls_havege_state *hs ); |
JMF | 12:0071cb144c7a | 58 | |
JMF | 12:0071cb144c7a | 59 | /** |
JMF | 12:0071cb144c7a | 60 | * \brief HAVEGE rand function |
JMF | 12:0071cb144c7a | 61 | * |
JMF | 12:0071cb144c7a | 62 | * \param p_rng A HAVEGE state |
JMF | 12:0071cb144c7a | 63 | * \param output Buffer to fill |
JMF | 12:0071cb144c7a | 64 | * \param len Length of buffer |
JMF | 12:0071cb144c7a | 65 | * |
JMF | 12:0071cb144c7a | 66 | * \return 0 |
JMF | 12:0071cb144c7a | 67 | */ |
JMF | 12:0071cb144c7a | 68 | int mbedtls_havege_random( void *p_rng, unsigned char *output, size_t len ); |
JMF | 12:0071cb144c7a | 69 | |
JMF | 12:0071cb144c7a | 70 | #ifdef __cplusplus |
JMF | 12:0071cb144c7a | 71 | } |
JMF | 12:0071cb144c7a | 72 | #endif |
JMF | 12:0071cb144c7a | 73 | |
JMF | 12:0071cb144c7a | 74 | #endif /* havege.h */ |