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.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
ctr_drbg.h
00001 /** 00002 * \file ctr_drbg.h 00003 * 00004 * \brief This file contains definitions and functions for the 00005 * CTR_DRBG pseudorandom generator. 00006 * 00007 * CTR_DRBG is a standardized way of building a PRNG from a block-cipher 00008 * in counter mode operation, as defined in <em>NIST SP 800-90A: 00009 * Recommendation for Random Number Generation Using Deterministic Random 00010 * Bit Generators</em>. 00011 * 00012 * The Mbed TLS implementation of CTR_DRBG uses AES-256 (default) or AES-128 00013 * (if \c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY is enabled at compile time) 00014 * as the underlying block cipher, with a derivation function. 00015 * The initial seeding grabs #MBEDTLS_CTR_DRBG_ENTROPY_LEN bytes of entropy. 00016 * See the documentation of mbedtls_ctr_drbg_seed() for more details. 00017 * 00018 * Based on NIST SP 800-90A §10.2.1 table 3 and NIST SP 800-57 part 1 table 2, 00019 * here are the security strengths achieved in typical configuration: 00020 * - 256 bits under the default configuration of the library, with AES-256 00021 * and with #MBEDTLS_CTR_DRBG_ENTROPY_LEN set to 48 or more. 00022 * - 256 bits if AES-256 is used, #MBEDTLS_CTR_DRBG_ENTROPY_LEN is set 00023 * to 32 or more, and the DRBG is initialized with an explicit 00024 * nonce in the \c custom parameter to mbedtls_ctr_drbg_seed(). 00025 * - 128 bits if AES-256 is used but #MBEDTLS_CTR_DRBG_ENTROPY_LEN is 00026 * between 24 and 47 and the DRBG is not initialized with an explicit 00027 * nonce (see mbedtls_ctr_drbg_seed()). 00028 * - 128 bits if AES-128 is used (\c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY enabled) 00029 * and #MBEDTLS_CTR_DRBG_ENTROPY_LEN is set to 24 or more (which is 00030 * always the case unless it is explicitly set to a different value 00031 * in config.h). 00032 * 00033 * Note that the value of #MBEDTLS_CTR_DRBG_ENTROPY_LEN defaults to: 00034 * - \c 48 if the module \c MBEDTLS_SHA512_C is enabled and the symbol 00035 * \c MBEDTLS_ENTROPY_FORCE_SHA256 is disabled at compile time. 00036 * This is the default configuration of the library. 00037 * - \c 32 if the module \c MBEDTLS_SHA512_C is disabled at compile time. 00038 * - \c 32 if \c MBEDTLS_ENTROPY_FORCE_SHA256 is enabled at compile time. 00039 */ 00040 /* 00041 * Copyright (C) 2006-2019, Arm Limited (or its affiliates), All Rights Reserved 00042 * SPDX-License-Identifier: Apache-2.0 00043 * 00044 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00045 * not use this file except in compliance with the License. 00046 * You may obtain a copy of the License at 00047 * 00048 * http://www.apache.org/licenses/LICENSE-2.0 00049 * 00050 * Unless required by applicable law or agreed to in writing, software 00051 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00052 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00053 * See the License for the specific language governing permissions and 00054 * limitations under the License. 00055 * 00056 * This file is part of Mbed TLS (https://tls.mbed.org) 00057 */ 00058 00059 #ifndef MBEDTLS_CTR_DRBG_H 00060 #define MBEDTLS_CTR_DRBG_H 00061 00062 #if !defined(MBEDTLS_CONFIG_FILE) 00063 #include "mbedtls/config.h" 00064 #else 00065 #include MBEDTLS_CONFIG_FILE 00066 #endif 00067 00068 #include "mbedtls/aes.h" 00069 00070 #if defined(MBEDTLS_THREADING_C) 00071 #include "mbedtls/threading.h" 00072 #endif 00073 00074 #define MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED -0x0034 /**< The entropy source failed. */ 00075 #define MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG -0x0036 /**< The requested random buffer length is too big. */ 00076 #define MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG -0x0038 /**< The input (entropy + additional data) is too large. */ 00077 #define MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR -0x003A /**< Read or write error in file. */ 00078 00079 #define MBEDTLS_CTR_DRBG_BLOCKSIZE 16 /**< The block size used by the cipher. */ 00080 00081 #if defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY) 00082 #define MBEDTLS_CTR_DRBG_KEYSIZE 16 00083 /**< The key size in bytes used by the cipher. 00084 * 00085 * Compile-time choice: 16 bytes (128 bits) 00086 * because #MBEDTLS_CTR_DRBG_USE_128_BIT_KEY is enabled. 00087 */ 00088 #else 00089 #define MBEDTLS_CTR_DRBG_KEYSIZE 32 00090 /**< The key size in bytes used by the cipher. 00091 * 00092 * Compile-time choice: 32 bytes (256 bits) 00093 * because \c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY is disabled. 00094 */ 00095 #endif 00096 00097 #define MBEDTLS_CTR_DRBG_KEYBITS ( MBEDTLS_CTR_DRBG_KEYSIZE * 8 ) /**< The key size for the DRBG operation, in bits. */ 00098 #define MBEDTLS_CTR_DRBG_SEEDLEN ( MBEDTLS_CTR_DRBG_KEYSIZE + MBEDTLS_CTR_DRBG_BLOCKSIZE ) /**< The seed length, calculated as (counter + AES key). */ 00099 00100 /** 00101 * \name SECTION: Module settings 00102 * 00103 * The configuration options you can set for this module are in this section. 00104 * Either change them in config.h or define them using the compiler command 00105 * line. 00106 * \{ 00107 */ 00108 00109 /** \def MBEDTLS_CTR_DRBG_ENTROPY_LEN 00110 * 00111 * \brief The amount of entropy used per seed by default, in bytes. 00112 */ 00113 #if !defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) 00114 #if defined(MBEDTLS_SHA512_C) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256) 00115 /** This is 48 bytes because the entropy module uses SHA-512 00116 * (\c MBEDTLS_ENTROPY_FORCE_SHA256 is disabled). 00117 */ 00118 #define MBEDTLS_CTR_DRBG_ENTROPY_LEN 48 00119 00120 #else /* defined(MBEDTLS_SHA512_C) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256) */ 00121 00122 /** This is 32 bytes because the entropy module uses SHA-256 00123 * (the SHA512 module is disabled or 00124 * \c MBEDTLS_ENTROPY_FORCE_SHA256 is enabled). 00125 */ 00126 #if !defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY) 00127 /** \warning To achieve a 256-bit security strength, you must pass a nonce 00128 * to mbedtls_ctr_drbg_seed(). 00129 */ 00130 #endif /* !defined(MBEDTLS_CTR_DRBG_USE_128_BIT_KEY) */ 00131 #define MBEDTLS_CTR_DRBG_ENTROPY_LEN 32 00132 #endif /* defined(MBEDTLS_SHA512_C) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256) */ 00133 #endif /* !defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN) */ 00134 00135 #if !defined(MBEDTLS_CTR_DRBG_RESEED_INTERVAL) 00136 #define MBEDTLS_CTR_DRBG_RESEED_INTERVAL 10000 00137 /**< The interval before reseed is performed by default. */ 00138 #endif 00139 00140 #if !defined(MBEDTLS_CTR_DRBG_MAX_INPUT) 00141 #define MBEDTLS_CTR_DRBG_MAX_INPUT 256 00142 /**< The maximum number of additional input Bytes. */ 00143 #endif 00144 00145 #if !defined(MBEDTLS_CTR_DRBG_MAX_REQUEST) 00146 #define MBEDTLS_CTR_DRBG_MAX_REQUEST 1024 00147 /**< The maximum number of requested Bytes per call. */ 00148 #endif 00149 00150 #if !defined(MBEDTLS_CTR_DRBG_MAX_SEED_INPUT) 00151 #define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 384 00152 /**< The maximum size of seed or reseed buffer in bytes. */ 00153 #endif 00154 00155 /* \} name SECTION: Module settings */ 00156 00157 #define MBEDTLS_CTR_DRBG_PR_OFF 0 00158 /**< Prediction resistance is disabled. */ 00159 #define MBEDTLS_CTR_DRBG_PR_ON 1 00160 /**< Prediction resistance is enabled. */ 00161 00162 #ifdef __cplusplus 00163 extern "C" { 00164 #endif 00165 00166 /** 00167 * \brief The CTR_DRBG context structure. 00168 */ 00169 typedef struct mbedtls_ctr_drbg_context 00170 { 00171 unsigned char counter [16]; /*!< The counter (V). */ 00172 int reseed_counter ; /*!< The reseed counter. */ 00173 int prediction_resistance ; /*!< This determines whether prediction 00174 resistance is enabled, that is 00175 whether to systematically reseed before 00176 each random generation. */ 00177 size_t entropy_len ; /*!< The amount of entropy grabbed on each 00178 seed or reseed operation. */ 00179 int reseed_interval ; /*!< The reseed interval. */ 00180 00181 mbedtls_aes_context aes_ctx ; /*!< The AES context. */ 00182 00183 /* 00184 * Callbacks (Entropy) 00185 */ 00186 int (*f_entropy )(void *, unsigned char *, size_t); 00187 /*!< The entropy callback function. */ 00188 00189 void *p_entropy ; /*!< The context for the entropy function. */ 00190 00191 #if defined(MBEDTLS_THREADING_C) 00192 mbedtls_threading_mutex_t mutex; 00193 #endif 00194 } 00195 mbedtls_ctr_drbg_context; 00196 00197 /** 00198 * \brief This function initializes the CTR_DRBG context, 00199 * and prepares it for mbedtls_ctr_drbg_seed() 00200 * or mbedtls_ctr_drbg_free(). 00201 * 00202 * \param ctx The CTR_DRBG context to initialize. 00203 */ 00204 void mbedtls_ctr_drbg_init( mbedtls_ctr_drbg_context *ctx ); 00205 00206 /** 00207 * \brief This function seeds and sets up the CTR_DRBG 00208 * entropy source for future reseeds. 00209 * 00210 * A typical choice for the \p f_entropy and \p p_entropy parameters is 00211 * to use the entropy module: 00212 * - \p f_entropy is mbedtls_entropy_func(); 00213 * - \p p_entropy is an instance of ::mbedtls_entropy_context initialized 00214 * with mbedtls_entropy_init() (which registers the platform's default 00215 * entropy sources). 00216 * 00217 * \p f_entropy is always called with a buffer size equal to the entropy 00218 * length. The entropy length is initially #MBEDTLS_CTR_DRBG_ENTROPY_LEN 00219 * and this value is always used for the initial seeding. You can change 00220 * the entropy length for subsequent seeding by calling 00221 * mbedtls_ctr_drbg_set_entropy_len() after this function. 00222 * 00223 * You can provide a personalization string in addition to the 00224 * entropy source, to make this instantiation as unique as possible. 00225 * 00226 * \note The _seed_material_ value passed to the derivation 00227 * function in the CTR_DRBG Instantiate Process 00228 * described in NIST SP 800-90A §10.2.1.3.2 00229 * is the concatenation of the string obtained from 00230 * calling \p f_entropy and the \p custom string. 00231 * The origin of the nonce depends on the value of 00232 * the entropy length relative to the security strength. 00233 * - If the entropy length is at least 1.5 times the 00234 * security strength then the nonce is taken from the 00235 * string obtained with \p f_entropy. 00236 * - If the entropy length is less than the security 00237 * strength, then the nonce is taken from \p custom. 00238 * In this case, for compliance with SP 800-90A, 00239 * you must pass a unique value of \p custom at 00240 * each invocation. See SP 800-90A §8.6.7 for more 00241 * details. 00242 */ 00243 #if MBEDTLS_CTR_DRBG_ENTROPY_LEN < MBEDTLS_CTR_DRBG_KEYSIZE * 3 / 2 00244 /** \warning When #MBEDTLS_CTR_DRBG_ENTROPY_LEN is less than 00245 * #MBEDTLS_CTR_DRBG_KEYSIZE * 3 / 2, to achieve the 00246 * maximum security strength permitted by CTR_DRBG, 00247 * you must pass a value of \p custom that is a nonce: 00248 * this value must never be repeated in subsequent 00249 * runs of the same application or on a different 00250 * device. 00251 */ 00252 #endif 00253 /** 00254 * \param ctx The CTR_DRBG context to seed. 00255 * \param f_entropy The entropy callback, taking as arguments the 00256 * \p p_entropy context, the buffer to fill, and the 00257 * length of the buffer. 00258 * \param p_entropy The entropy context to pass to \p f_entropy. 00259 * \param custom The personalization string. 00260 * This can be \c NULL, in which case the personalization 00261 * string is empty regardless of the value of \p len. 00262 * \param len The length of the personalization string. 00263 * This must be at most 00264 * #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 00265 * - #MBEDTLS_CTR_DRBG_ENTROPY_LEN. 00266 * 00267 * \return \c 0 on success. 00268 * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on failure. 00269 */ 00270 int mbedtls_ctr_drbg_seed( mbedtls_ctr_drbg_context *ctx, 00271 int (*f_entropy)(void *, unsigned char *, size_t), 00272 void *p_entropy, 00273 const unsigned char *custom, 00274 size_t len ); 00275 00276 /** 00277 * \brief This function clears CTR_CRBG context data. 00278 * 00279 * \param ctx The CTR_DRBG context to clear. 00280 */ 00281 void mbedtls_ctr_drbg_free( mbedtls_ctr_drbg_context *ctx ); 00282 00283 /** 00284 * \brief This function turns prediction resistance on or off. 00285 * The default value is off. 00286 * 00287 * \note If enabled, entropy is gathered at the beginning of 00288 * every call to mbedtls_ctr_drbg_random_with_add() 00289 * or mbedtls_ctr_drbg_random(). 00290 * Only use this if your entropy source has sufficient 00291 * throughput. 00292 * 00293 * \param ctx The CTR_DRBG context. 00294 * \param resistance #MBEDTLS_CTR_DRBG_PR_ON or #MBEDTLS_CTR_DRBG_PR_OFF. 00295 */ 00296 void mbedtls_ctr_drbg_set_prediction_resistance( mbedtls_ctr_drbg_context *ctx, 00297 int resistance ); 00298 00299 /** 00300 * \brief This function sets the amount of entropy grabbed on each 00301 * subsequent reseed. 00302 * 00303 * The default value is #MBEDTLS_CTR_DRBG_ENTROPY_LEN. 00304 * 00305 * \note mbedtls_ctr_drbg_seed() always sets the entropy length 00306 * to #MBEDTLS_CTR_DRBG_ENTROPY_LEN, so this function 00307 * only has an effect when it is called after 00308 * mbedtls_ctr_drbg_seed(). 00309 * 00310 * \note The security strength of CTR_DRBG is bounded by the 00311 * entropy length. Thus: 00312 * - When using AES-256 00313 * (\c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY is disabled, 00314 * which is the default), 00315 * \p len must be at least 32 (in bytes) 00316 * to achieve a 256-bit strength. 00317 * - When using AES-128 00318 * (\c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY is enabled) 00319 * \p len must be at least 16 (in bytes) 00320 * to achieve a 128-bit strength. 00321 * 00322 * \param ctx The CTR_DRBG context. 00323 * \param len The amount of entropy to grab, in bytes. 00324 * This must be at most #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT. 00325 */ 00326 void mbedtls_ctr_drbg_set_entropy_len( mbedtls_ctr_drbg_context *ctx, 00327 size_t len ); 00328 00329 /** 00330 * \brief This function sets the reseed interval. 00331 * 00332 * The reseed interval is the number of calls to mbedtls_ctr_drbg_random() 00333 * or mbedtls_ctr_drbg_random_with_add() after which the entropy function 00334 * is called again. 00335 * 00336 * The default value is #MBEDTLS_CTR_DRBG_RESEED_INTERVAL. 00337 * 00338 * \param ctx The CTR_DRBG context. 00339 * \param interval The reseed interval. 00340 */ 00341 void mbedtls_ctr_drbg_set_reseed_interval( mbedtls_ctr_drbg_context *ctx, 00342 int interval ); 00343 00344 /** 00345 * \brief This function reseeds the CTR_DRBG context, that is 00346 * extracts data from the entropy source. 00347 * 00348 * \param ctx The CTR_DRBG context. 00349 * \param additional Additional data to add to the state. Can be \c NULL. 00350 * \param len The length of the additional data. 00351 * This must be less than 00352 * #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT - \c entropy_len 00353 * where \c entropy_len is the entropy length 00354 * configured for the context. 00355 * 00356 * \return \c 0 on success. 00357 * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on failure. 00358 */ 00359 int mbedtls_ctr_drbg_reseed( mbedtls_ctr_drbg_context *ctx, 00360 const unsigned char *additional, size_t len ); 00361 00362 /** 00363 * \brief This function updates the state of the CTR_DRBG context. 00364 * 00365 * \param ctx The CTR_DRBG context. 00366 * \param additional The data to update the state with. This must not be 00367 * \c NULL unless \p add_len is \c 0. 00368 * \param add_len Length of \p additional in bytes. This must be at 00369 * most #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT. 00370 * 00371 * \return \c 0 on success. 00372 * \return #MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG if 00373 * \p add_len is more than 00374 * #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT. 00375 * \return An error from the underlying AES cipher on failure. 00376 */ 00377 int mbedtls_ctr_drbg_update_ret( mbedtls_ctr_drbg_context *ctx, 00378 const unsigned char *additional, 00379 size_t add_len ); 00380 00381 /** 00382 * \brief This function updates a CTR_DRBG instance with additional 00383 * data and uses it to generate random data. 00384 * 00385 * This function automatically reseeds if the reseed counter is exceeded 00386 * or prediction resistance is enabled. 00387 * 00388 * \param p_rng The CTR_DRBG context. This must be a pointer to a 00389 * #mbedtls_ctr_drbg_context structure. 00390 * \param output The buffer to fill. 00391 * \param output_len The length of the buffer in bytes. 00392 * \param additional Additional data to update. Can be \c NULL, in which 00393 * case the additional data is empty regardless of 00394 * the value of \p add_len. 00395 * \param add_len The length of the additional data 00396 * if \p additional is not \c NULL. 00397 * This must be less than #MBEDTLS_CTR_DRBG_MAX_INPUT 00398 * and less than 00399 * #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT - \c entropy_len 00400 * where \c entropy_len is the entropy length 00401 * configured for the context. 00402 * 00403 * \return \c 0 on success. 00404 * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or 00405 * #MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG on failure. 00406 */ 00407 int mbedtls_ctr_drbg_random_with_add( void *p_rng, 00408 unsigned char *output, size_t output_len, 00409 const unsigned char *additional, size_t add_len ); 00410 00411 /** 00412 * \brief This function uses CTR_DRBG to generate random data. 00413 * 00414 * This function automatically reseeds if the reseed counter is exceeded 00415 * or prediction resistance is enabled. 00416 * 00417 * 00418 * \param p_rng The CTR_DRBG context. This must be a pointer to a 00419 * #mbedtls_ctr_drbg_context structure. 00420 * \param output The buffer to fill. 00421 * \param output_len The length of the buffer in bytes. 00422 * 00423 * \return \c 0 on success. 00424 * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or 00425 * #MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG on failure. 00426 */ 00427 int mbedtls_ctr_drbg_random( void *p_rng, 00428 unsigned char *output, size_t output_len ); 00429 00430 00431 #if ! defined(MBEDTLS_DEPRECATED_REMOVED) 00432 #if defined(MBEDTLS_DEPRECATED_WARNING) 00433 #define MBEDTLS_DEPRECATED __attribute__((deprecated)) 00434 #else 00435 #define MBEDTLS_DEPRECATED 00436 #endif 00437 /** 00438 * \brief This function updates the state of the CTR_DRBG context. 00439 * 00440 * \deprecated Superseded by mbedtls_ctr_drbg_update_ret() 00441 * in 2.16.0. 00442 * 00443 * \note If \p add_len is greater than 00444 * #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT, only the first 00445 * #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT Bytes are used. 00446 * The remaining Bytes are silently discarded. 00447 * 00448 * \param ctx The CTR_DRBG context. 00449 * \param additional The data to update the state with. 00450 * \param add_len Length of \p additional data. 00451 */ 00452 MBEDTLS_DEPRECATED void mbedtls_ctr_drbg_update( 00453 mbedtls_ctr_drbg_context *ctx, 00454 const unsigned char *additional, 00455 size_t add_len ); 00456 #undef MBEDTLS_DEPRECATED 00457 #endif /* !MBEDTLS_DEPRECATED_REMOVED */ 00458 00459 #if defined(MBEDTLS_FS_IO) 00460 /** 00461 * \brief This function writes a seed file. 00462 * 00463 * \param ctx The CTR_DRBG context. 00464 * \param path The name of the file. 00465 * 00466 * \return \c 0 on success. 00467 * \return #MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR on file error. 00468 * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on reseed 00469 * failure. 00470 */ 00471 int mbedtls_ctr_drbg_write_seed_file( mbedtls_ctr_drbg_context *ctx, const char *path ); 00472 00473 /** 00474 * \brief This function reads and updates a seed file. The seed 00475 * is added to this instance. 00476 * 00477 * \param ctx The CTR_DRBG context. 00478 * \param path The name of the file. 00479 * 00480 * \return \c 0 on success. 00481 * \return #MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR on file error. 00482 * \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on 00483 * reseed failure. 00484 * \return #MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG if the existing 00485 * seed file is too large. 00486 */ 00487 int mbedtls_ctr_drbg_update_seed_file( mbedtls_ctr_drbg_context *ctx, const char *path ); 00488 #endif /* MBEDTLS_FS_IO */ 00489 00490 #if defined(MBEDTLS_SELF_TEST) 00491 00492 /** 00493 * \brief The CTR_DRBG checkup routine. 00494 * 00495 * \return \c 0 on success. 00496 * \return \c 1 on failure. 00497 */ 00498 int mbedtls_ctr_drbg_self_test( int verbose ); 00499 00500 #endif /* MBEDTLS_SELF_TEST */ 00501 00502 /* Internal functions (do not call directly) */ 00503 int mbedtls_ctr_drbg_seed_entropy_len( mbedtls_ctr_drbg_context *, 00504 int (*)(void *, unsigned char *, size_t), void *, 00505 const unsigned char *, size_t, size_t ); 00506 00507 #ifdef __cplusplus 00508 } 00509 #endif 00510 00511 #endif /* ctr_drbg.h */
Generated on Tue Jul 12 2022 13:54:16 by
