Modified mbed TLS headers for AES functionality only to reduce build size

Dependents:   BLE_Gateway_Linker_fix BLE_Gateway

Fork of mbedtls by sandbox

Committer:
electronichamsters
Date:
Mon Jul 10 04:00:25 2017 +0000
Revision:
5:f09f5ed830ca
Parent:
1:24750b9ad5ef
working gateway

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Christopher Haster 1:24750b9ad5ef 1 /**
Christopher Haster 1:24750b9ad5ef 2 * \file hmac_drbg.h
Christopher Haster 1:24750b9ad5ef 3 *
Christopher Haster 1:24750b9ad5ef 4 * \brief HMAC_DRBG (NIST SP 800-90A)
Christopher Haster 1:24750b9ad5ef 5 *
Christopher Haster 1:24750b9ad5ef 6 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
Christopher Haster 1:24750b9ad5ef 7 * SPDX-License-Identifier: Apache-2.0
Christopher Haster 1:24750b9ad5ef 8 *
Christopher Haster 1:24750b9ad5ef 9 * Licensed under the Apache License, Version 2.0 (the "License"); you may
Christopher Haster 1:24750b9ad5ef 10 * not use this file except in compliance with the License.
Christopher Haster 1:24750b9ad5ef 11 * You may obtain a copy of the License at
Christopher Haster 1:24750b9ad5ef 12 *
Christopher Haster 1:24750b9ad5ef 13 * http://www.apache.org/licenses/LICENSE-2.0
Christopher Haster 1:24750b9ad5ef 14 *
Christopher Haster 1:24750b9ad5ef 15 * Unless required by applicable law or agreed to in writing, software
Christopher Haster 1:24750b9ad5ef 16 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
Christopher Haster 1:24750b9ad5ef 17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Christopher Haster 1:24750b9ad5ef 18 * See the License for the specific language governing permissions and
Christopher Haster 1:24750b9ad5ef 19 * limitations under the License.
Christopher Haster 1:24750b9ad5ef 20 *
Christopher Haster 1:24750b9ad5ef 21 * This file is part of mbed TLS (https://tls.mbed.org)
Christopher Haster 1:24750b9ad5ef 22 */
Christopher Haster 1:24750b9ad5ef 23 #ifndef MBEDTLS_HMAC_DRBG_H
Christopher Haster 1:24750b9ad5ef 24 #define MBEDTLS_HMAC_DRBG_H
Christopher Haster 1:24750b9ad5ef 25
Christopher Haster 1:24750b9ad5ef 26 #include "md.h"
Christopher Haster 1:24750b9ad5ef 27
Christopher Haster 1:24750b9ad5ef 28 #if defined(MBEDTLS_THREADING_C)
Christopher Haster 1:24750b9ad5ef 29 #include "mbedtls/threading.h"
Christopher Haster 1:24750b9ad5ef 30 #endif
Christopher Haster 1:24750b9ad5ef 31
Christopher Haster 1:24750b9ad5ef 32 /*
Christopher Haster 1:24750b9ad5ef 33 * Error codes
Christopher Haster 1:24750b9ad5ef 34 */
Christopher Haster 1:24750b9ad5ef 35 #define MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG -0x0003 /**< Too many random requested in single call. */
Christopher Haster 1:24750b9ad5ef 36 #define MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG -0x0005 /**< Input too large (Entropy + additional). */
Christopher Haster 1:24750b9ad5ef 37 #define MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR -0x0007 /**< Read/write error in file. */
Christopher Haster 1:24750b9ad5ef 38 #define MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED -0x0009 /**< The entropy source failed. */
Christopher Haster 1:24750b9ad5ef 39
Christopher Haster 1:24750b9ad5ef 40 /**
Christopher Haster 1:24750b9ad5ef 41 * \name SECTION: Module settings
Christopher Haster 1:24750b9ad5ef 42 *
Christopher Haster 1:24750b9ad5ef 43 * The configuration options you can set for this module are in this section.
Christopher Haster 1:24750b9ad5ef 44 * Either change them in config.h or define them on the compiler command line.
Christopher Haster 1:24750b9ad5ef 45 * \{
Christopher Haster 1:24750b9ad5ef 46 */
Christopher Haster 1:24750b9ad5ef 47
Christopher Haster 1:24750b9ad5ef 48 #if !defined(MBEDTLS_HMAC_DRBG_RESEED_INTERVAL)
Christopher Haster 1:24750b9ad5ef 49 #define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */
Christopher Haster 1:24750b9ad5ef 50 #endif
Christopher Haster 1:24750b9ad5ef 51
Christopher Haster 1:24750b9ad5ef 52 #if !defined(MBEDTLS_HMAC_DRBG_MAX_INPUT)
Christopher Haster 1:24750b9ad5ef 53 #define MBEDTLS_HMAC_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */
Christopher Haster 1:24750b9ad5ef 54 #endif
Christopher Haster 1:24750b9ad5ef 55
Christopher Haster 1:24750b9ad5ef 56 #if !defined(MBEDTLS_HMAC_DRBG_MAX_REQUEST)
Christopher Haster 1:24750b9ad5ef 57 #define MBEDTLS_HMAC_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */
Christopher Haster 1:24750b9ad5ef 58 #endif
Christopher Haster 1:24750b9ad5ef 59
Christopher Haster 1:24750b9ad5ef 60 #if !defined(MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT)
Christopher Haster 1:24750b9ad5ef 61 #define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */
Christopher Haster 1:24750b9ad5ef 62 #endif
Christopher Haster 1:24750b9ad5ef 63
Christopher Haster 1:24750b9ad5ef 64 /* \} name SECTION: Module settings */
Christopher Haster 1:24750b9ad5ef 65
Christopher Haster 1:24750b9ad5ef 66 #define MBEDTLS_HMAC_DRBG_PR_OFF 0 /**< No prediction resistance */
Christopher Haster 1:24750b9ad5ef 67 #define MBEDTLS_HMAC_DRBG_PR_ON 1 /**< Prediction resistance enabled */
Christopher Haster 1:24750b9ad5ef 68
Christopher Haster 1:24750b9ad5ef 69 #ifdef __cplusplus
Christopher Haster 1:24750b9ad5ef 70 extern "C" {
Christopher Haster 1:24750b9ad5ef 71 #endif
Christopher Haster 1:24750b9ad5ef 72
Christopher Haster 1:24750b9ad5ef 73 /**
Christopher Haster 1:24750b9ad5ef 74 * HMAC_DRBG context.
Christopher Haster 1:24750b9ad5ef 75 */
Christopher Haster 1:24750b9ad5ef 76 typedef struct
Christopher Haster 1:24750b9ad5ef 77 {
Christopher Haster 1:24750b9ad5ef 78 /* Working state: the key K is not stored explicitely,
Christopher Haster 1:24750b9ad5ef 79 * but is implied by the HMAC context */
Christopher Haster 1:24750b9ad5ef 80 mbedtls_md_context_t md_ctx; /*!< HMAC context (inc. K) */
Christopher Haster 1:24750b9ad5ef 81 unsigned char V[MBEDTLS_MD_MAX_SIZE]; /*!< V in the spec */
Christopher Haster 1:24750b9ad5ef 82 int reseed_counter; /*!< reseed counter */
Christopher Haster 1:24750b9ad5ef 83
Christopher Haster 1:24750b9ad5ef 84 /* Administrative state */
Christopher Haster 1:24750b9ad5ef 85 size_t entropy_len; /*!< entropy bytes grabbed on each (re)seed */
Christopher Haster 1:24750b9ad5ef 86 int prediction_resistance; /*!< enable prediction resistance (Automatic
Christopher Haster 1:24750b9ad5ef 87 reseed before every random generation) */
Christopher Haster 1:24750b9ad5ef 88 int reseed_interval; /*!< reseed interval */
Christopher Haster 1:24750b9ad5ef 89
Christopher Haster 1:24750b9ad5ef 90 /* Callbacks */
Christopher Haster 1:24750b9ad5ef 91 int (*f_entropy)(void *, unsigned char *, size_t); /*!< entropy function */
Christopher Haster 1:24750b9ad5ef 92 void *p_entropy; /*!< context for the entropy function */
Christopher Haster 1:24750b9ad5ef 93
Christopher Haster 1:24750b9ad5ef 94 #if defined(MBEDTLS_THREADING_C)
Christopher Haster 1:24750b9ad5ef 95 mbedtls_threading_mutex_t mutex;
Christopher Haster 1:24750b9ad5ef 96 #endif
Christopher Haster 1:24750b9ad5ef 97 } mbedtls_hmac_drbg_context;
Christopher Haster 1:24750b9ad5ef 98
Christopher Haster 1:24750b9ad5ef 99 /**
Christopher Haster 1:24750b9ad5ef 100 * \brief HMAC_DRBG context initialization
Christopher Haster 1:24750b9ad5ef 101 * Makes the context ready for mbedtls_hmac_drbg_seed(),
Christopher Haster 1:24750b9ad5ef 102 * mbedtls_hmac_drbg_seed_buf() or
Christopher Haster 1:24750b9ad5ef 103 * mbedtls_hmac_drbg_free().
Christopher Haster 1:24750b9ad5ef 104 *
Christopher Haster 1:24750b9ad5ef 105 * \param ctx HMAC_DRBG context to be initialized
Christopher Haster 1:24750b9ad5ef 106 */
Christopher Haster 1:24750b9ad5ef 107 void mbedtls_hmac_drbg_init( mbedtls_hmac_drbg_context *ctx );
Christopher Haster 1:24750b9ad5ef 108
Christopher Haster 1:24750b9ad5ef 109 /**
Christopher Haster 1:24750b9ad5ef 110 * \brief HMAC_DRBG initial seeding
Christopher Haster 1:24750b9ad5ef 111 * Seed and setup entropy source for future reseeds.
Christopher Haster 1:24750b9ad5ef 112 *
Christopher Haster 1:24750b9ad5ef 113 * \param ctx HMAC_DRBG context to be seeded
Christopher Haster 1:24750b9ad5ef 114 * \param md_info MD algorithm to use for HMAC_DRBG
Christopher Haster 1:24750b9ad5ef 115 * \param f_entropy Entropy callback (p_entropy, buffer to fill, buffer
Christopher Haster 1:24750b9ad5ef 116 * length)
Christopher Haster 1:24750b9ad5ef 117 * \param p_entropy Entropy context
Christopher Haster 1:24750b9ad5ef 118 * \param custom Personalization data (Device specific identifiers)
Christopher Haster 1:24750b9ad5ef 119 * (Can be NULL)
Christopher Haster 1:24750b9ad5ef 120 * \param len Length of personalization data
Christopher Haster 1:24750b9ad5ef 121 *
Christopher Haster 1:24750b9ad5ef 122 * \note The "security strength" as defined by NIST is set to:
Christopher Haster 1:24750b9ad5ef 123 * 128 bits if md_alg is SHA-1,
Christopher Haster 1:24750b9ad5ef 124 * 192 bits if md_alg is SHA-224,
Christopher Haster 1:24750b9ad5ef 125 * 256 bits if md_alg is SHA-256 or higher.
Christopher Haster 1:24750b9ad5ef 126 * Note that SHA-256 is just as efficient as SHA-224.
Christopher Haster 1:24750b9ad5ef 127 *
Christopher Haster 1:24750b9ad5ef 128 * \return 0 if successful, or
Christopher Haster 1:24750b9ad5ef 129 * MBEDTLS_ERR_MD_BAD_INPUT_DATA, or
Christopher Haster 1:24750b9ad5ef 130 * MBEDTLS_ERR_MD_ALLOC_FAILED, or
Christopher Haster 1:24750b9ad5ef 131 * MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED.
Christopher Haster 1:24750b9ad5ef 132 */
Christopher Haster 1:24750b9ad5ef 133 int mbedtls_hmac_drbg_seed( mbedtls_hmac_drbg_context *ctx,
Christopher Haster 1:24750b9ad5ef 134 const mbedtls_md_info_t * md_info,
Christopher Haster 1:24750b9ad5ef 135 int (*f_entropy)(void *, unsigned char *, size_t),
Christopher Haster 1:24750b9ad5ef 136 void *p_entropy,
Christopher Haster 1:24750b9ad5ef 137 const unsigned char *custom,
Christopher Haster 1:24750b9ad5ef 138 size_t len );
Christopher Haster 1:24750b9ad5ef 139
Christopher Haster 1:24750b9ad5ef 140 /**
Christopher Haster 1:24750b9ad5ef 141 * \brief Initilisation of simpified HMAC_DRBG (never reseeds).
Christopher Haster 1:24750b9ad5ef 142 * (For use with deterministic ECDSA.)
Christopher Haster 1:24750b9ad5ef 143 *
Christopher Haster 1:24750b9ad5ef 144 * \param ctx HMAC_DRBG context to be initialised
Christopher Haster 1:24750b9ad5ef 145 * \param md_info MD algorithm to use for HMAC_DRBG
Christopher Haster 1:24750b9ad5ef 146 * \param data Concatenation of entropy string and additional data
Christopher Haster 1:24750b9ad5ef 147 * \param data_len Length of data in bytes
Christopher Haster 1:24750b9ad5ef 148 *
Christopher Haster 1:24750b9ad5ef 149 * \return 0 if successful, or
Christopher Haster 1:24750b9ad5ef 150 * MBEDTLS_ERR_MD_BAD_INPUT_DATA, or
Christopher Haster 1:24750b9ad5ef 151 * MBEDTLS_ERR_MD_ALLOC_FAILED.
Christopher Haster 1:24750b9ad5ef 152 */
Christopher Haster 1:24750b9ad5ef 153 int mbedtls_hmac_drbg_seed_buf( mbedtls_hmac_drbg_context *ctx,
Christopher Haster 1:24750b9ad5ef 154 const mbedtls_md_info_t * md_info,
Christopher Haster 1:24750b9ad5ef 155 const unsigned char *data, size_t data_len );
Christopher Haster 1:24750b9ad5ef 156
Christopher Haster 1:24750b9ad5ef 157 /**
Christopher Haster 1:24750b9ad5ef 158 * \brief Enable / disable prediction resistance (Default: Off)
Christopher Haster 1:24750b9ad5ef 159 *
Christopher Haster 1:24750b9ad5ef 160 * Note: If enabled, entropy is used for ctx->entropy_len before each call!
Christopher Haster 1:24750b9ad5ef 161 * Only use this if you have ample supply of good entropy!
Christopher Haster 1:24750b9ad5ef 162 *
Christopher Haster 1:24750b9ad5ef 163 * \param ctx HMAC_DRBG context
Christopher Haster 1:24750b9ad5ef 164 * \param resistance MBEDTLS_HMAC_DRBG_PR_ON or MBEDTLS_HMAC_DRBG_PR_OFF
Christopher Haster 1:24750b9ad5ef 165 */
Christopher Haster 1:24750b9ad5ef 166 void mbedtls_hmac_drbg_set_prediction_resistance( mbedtls_hmac_drbg_context *ctx,
Christopher Haster 1:24750b9ad5ef 167 int resistance );
Christopher Haster 1:24750b9ad5ef 168
Christopher Haster 1:24750b9ad5ef 169 /**
Christopher Haster 1:24750b9ad5ef 170 * \brief Set the amount of entropy grabbed on each reseed
Christopher Haster 1:24750b9ad5ef 171 * (Default: given by the security strength, which
Christopher Haster 1:24750b9ad5ef 172 * depends on the hash used, see \c mbedtls_hmac_drbg_init() )
Christopher Haster 1:24750b9ad5ef 173 *
Christopher Haster 1:24750b9ad5ef 174 * \param ctx HMAC_DRBG context
Christopher Haster 1:24750b9ad5ef 175 * \param len Amount of entropy to grab, in bytes
Christopher Haster 1:24750b9ad5ef 176 */
Christopher Haster 1:24750b9ad5ef 177 void mbedtls_hmac_drbg_set_entropy_len( mbedtls_hmac_drbg_context *ctx,
Christopher Haster 1:24750b9ad5ef 178 size_t len );
Christopher Haster 1:24750b9ad5ef 179
Christopher Haster 1:24750b9ad5ef 180 /**
Christopher Haster 1:24750b9ad5ef 181 * \brief Set the reseed interval
Christopher Haster 1:24750b9ad5ef 182 * (Default: MBEDTLS_HMAC_DRBG_RESEED_INTERVAL)
Christopher Haster 1:24750b9ad5ef 183 *
Christopher Haster 1:24750b9ad5ef 184 * \param ctx HMAC_DRBG context
Christopher Haster 1:24750b9ad5ef 185 * \param interval Reseed interval
Christopher Haster 1:24750b9ad5ef 186 */
Christopher Haster 1:24750b9ad5ef 187 void mbedtls_hmac_drbg_set_reseed_interval( mbedtls_hmac_drbg_context *ctx,
Christopher Haster 1:24750b9ad5ef 188 int interval );
Christopher Haster 1:24750b9ad5ef 189
Christopher Haster 1:24750b9ad5ef 190 /**
Christopher Haster 1:24750b9ad5ef 191 * \brief HMAC_DRBG update state
Christopher Haster 1:24750b9ad5ef 192 *
Christopher Haster 1:24750b9ad5ef 193 * \param ctx HMAC_DRBG context
Christopher Haster 1:24750b9ad5ef 194 * \param additional Additional data to update state with, or NULL
Christopher Haster 1:24750b9ad5ef 195 * \param add_len Length of additional data, or 0
Christopher Haster 1:24750b9ad5ef 196 *
Christopher Haster 1:24750b9ad5ef 197 * \note Additional data is optional, pass NULL and 0 as second
Christopher Haster 1:24750b9ad5ef 198 * third argument if no additional data is being used.
Christopher Haster 1:24750b9ad5ef 199 */
Christopher Haster 1:24750b9ad5ef 200 void mbedtls_hmac_drbg_update( mbedtls_hmac_drbg_context *ctx,
Christopher Haster 1:24750b9ad5ef 201 const unsigned char *additional, size_t add_len );
Christopher Haster 1:24750b9ad5ef 202
Christopher Haster 1:24750b9ad5ef 203 /**
Christopher Haster 1:24750b9ad5ef 204 * \brief HMAC_DRBG reseeding (extracts data from entropy source)
Christopher Haster 1:24750b9ad5ef 205 *
Christopher Haster 1:24750b9ad5ef 206 * \param ctx HMAC_DRBG context
Christopher Haster 1:24750b9ad5ef 207 * \param additional Additional data to add to state (Can be NULL)
Christopher Haster 1:24750b9ad5ef 208 * \param len Length of additional data
Christopher Haster 1:24750b9ad5ef 209 *
Christopher Haster 1:24750b9ad5ef 210 * \return 0 if successful, or
Christopher Haster 1:24750b9ad5ef 211 * MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED
Christopher Haster 1:24750b9ad5ef 212 */
Christopher Haster 1:24750b9ad5ef 213 int mbedtls_hmac_drbg_reseed( mbedtls_hmac_drbg_context *ctx,
Christopher Haster 1:24750b9ad5ef 214 const unsigned char *additional, size_t len );
Christopher Haster 1:24750b9ad5ef 215
Christopher Haster 1:24750b9ad5ef 216 /**
Christopher Haster 1:24750b9ad5ef 217 * \brief HMAC_DRBG generate random with additional update input
Christopher Haster 1:24750b9ad5ef 218 *
Christopher Haster 1:24750b9ad5ef 219 * Note: Automatically reseeds if reseed_counter is reached or PR is enabled.
Christopher Haster 1:24750b9ad5ef 220 *
Christopher Haster 1:24750b9ad5ef 221 * \param p_rng HMAC_DRBG context
Christopher Haster 1:24750b9ad5ef 222 * \param output Buffer to fill
Christopher Haster 1:24750b9ad5ef 223 * \param output_len Length of the buffer
Christopher Haster 1:24750b9ad5ef 224 * \param additional Additional data to update with (can be NULL)
Christopher Haster 1:24750b9ad5ef 225 * \param add_len Length of additional data (can be 0)
Christopher Haster 1:24750b9ad5ef 226 *
Christopher Haster 1:24750b9ad5ef 227 * \return 0 if successful, or
Christopher Haster 1:24750b9ad5ef 228 * MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED, or
Christopher Haster 1:24750b9ad5ef 229 * MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG, or
Christopher Haster 1:24750b9ad5ef 230 * MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG.
Christopher Haster 1:24750b9ad5ef 231 */
Christopher Haster 1:24750b9ad5ef 232 int mbedtls_hmac_drbg_random_with_add( void *p_rng,
Christopher Haster 1:24750b9ad5ef 233 unsigned char *output, size_t output_len,
Christopher Haster 1:24750b9ad5ef 234 const unsigned char *additional,
Christopher Haster 1:24750b9ad5ef 235 size_t add_len );
Christopher Haster 1:24750b9ad5ef 236
Christopher Haster 1:24750b9ad5ef 237 /**
Christopher Haster 1:24750b9ad5ef 238 * \brief HMAC_DRBG generate random
Christopher Haster 1:24750b9ad5ef 239 *
Christopher Haster 1:24750b9ad5ef 240 * Note: Automatically reseeds if reseed_counter is reached or PR is enabled.
Christopher Haster 1:24750b9ad5ef 241 *
Christopher Haster 1:24750b9ad5ef 242 * \param p_rng HMAC_DRBG context
Christopher Haster 1:24750b9ad5ef 243 * \param output Buffer to fill
Christopher Haster 1:24750b9ad5ef 244 * \param out_len Length of the buffer
Christopher Haster 1:24750b9ad5ef 245 *
Christopher Haster 1:24750b9ad5ef 246 * \return 0 if successful, or
Christopher Haster 1:24750b9ad5ef 247 * MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED, or
Christopher Haster 1:24750b9ad5ef 248 * MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG
Christopher Haster 1:24750b9ad5ef 249 */
Christopher Haster 1:24750b9ad5ef 250 int mbedtls_hmac_drbg_random( void *p_rng, unsigned char *output, size_t out_len );
Christopher Haster 1:24750b9ad5ef 251
Christopher Haster 1:24750b9ad5ef 252 /**
Christopher Haster 1:24750b9ad5ef 253 * \brief Free an HMAC_DRBG context
Christopher Haster 1:24750b9ad5ef 254 *
Christopher Haster 1:24750b9ad5ef 255 * \param ctx HMAC_DRBG context to free.
Christopher Haster 1:24750b9ad5ef 256 */
Christopher Haster 1:24750b9ad5ef 257 void mbedtls_hmac_drbg_free( mbedtls_hmac_drbg_context *ctx );
Christopher Haster 1:24750b9ad5ef 258
Christopher Haster 1:24750b9ad5ef 259 #if defined(MBEDTLS_FS_IO)
Christopher Haster 1:24750b9ad5ef 260 /**
Christopher Haster 1:24750b9ad5ef 261 * \brief Write a seed file
Christopher Haster 1:24750b9ad5ef 262 *
Christopher Haster 1:24750b9ad5ef 263 * \param ctx HMAC_DRBG context
Christopher Haster 1:24750b9ad5ef 264 * \param path Name of the file
Christopher Haster 1:24750b9ad5ef 265 *
Christopher Haster 1:24750b9ad5ef 266 * \return 0 if successful, 1 on file error, or
Christopher Haster 1:24750b9ad5ef 267 * MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED
Christopher Haster 1:24750b9ad5ef 268 */
Christopher Haster 1:24750b9ad5ef 269 int mbedtls_hmac_drbg_write_seed_file( mbedtls_hmac_drbg_context *ctx, const char *path );
Christopher Haster 1:24750b9ad5ef 270
Christopher Haster 1:24750b9ad5ef 271 /**
Christopher Haster 1:24750b9ad5ef 272 * \brief Read and update a seed file. Seed is added to this
Christopher Haster 1:24750b9ad5ef 273 * instance
Christopher Haster 1:24750b9ad5ef 274 *
Christopher Haster 1:24750b9ad5ef 275 * \param ctx HMAC_DRBG context
Christopher Haster 1:24750b9ad5ef 276 * \param path Name of the file
Christopher Haster 1:24750b9ad5ef 277 *
Christopher Haster 1:24750b9ad5ef 278 * \return 0 if successful, 1 on file error,
Christopher Haster 1:24750b9ad5ef 279 * MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED or
Christopher Haster 1:24750b9ad5ef 280 * MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG
Christopher Haster 1:24750b9ad5ef 281 */
Christopher Haster 1:24750b9ad5ef 282 int mbedtls_hmac_drbg_update_seed_file( mbedtls_hmac_drbg_context *ctx, const char *path );
Christopher Haster 1:24750b9ad5ef 283 #endif /* MBEDTLS_FS_IO */
Christopher Haster 1:24750b9ad5ef 284
Christopher Haster 1:24750b9ad5ef 285
Christopher Haster 1:24750b9ad5ef 286 #if defined(MBEDTLS_SELF_TEST)
Christopher Haster 1:24750b9ad5ef 287 /**
Christopher Haster 1:24750b9ad5ef 288 * \brief Checkup routine
Christopher Haster 1:24750b9ad5ef 289 *
Christopher Haster 1:24750b9ad5ef 290 * \return 0 if successful, or 1 if the test failed
Christopher Haster 1:24750b9ad5ef 291 */
Christopher Haster 1:24750b9ad5ef 292 int mbedtls_hmac_drbg_self_test( int verbose );
Christopher Haster 1:24750b9ad5ef 293 #endif
Christopher Haster 1:24750b9ad5ef 294
Christopher Haster 1:24750b9ad5ef 295 #ifdef __cplusplus
Christopher Haster 1:24750b9ad5ef 296 }
Christopher Haster 1:24750b9ad5ef 297 #endif
Christopher Haster 1:24750b9ad5ef 298
Christopher Haster 1:24750b9ad5ef 299 #endif /* hmac_drbg.h */