mirror of
				https://github.com/Mbed-TLS/mbedtls.git
				synced 2025-10-27 12:15:33 +03:00 
			
		
		
		
	Merge remote-tracking branch 'public/pr/1508' into development-proposed
* public/pr/1508: Update ctr_drbg.h Update ctr_drbg.h
This commit is contained in:
		| @@ -1,10 +1,15 @@ | ||||
| /** | ||||
|  * \file ctr_drbg.h | ||||
|  * | ||||
|  * \brief    CTR_DRBG is based on AES-256, as defined in <em>NIST SP 800-90A: | ||||
|  *           Recommendation for Random Number Generation Using Deterministic | ||||
|  *           Random Bit Generators</em>. | ||||
|  * \brief    This file contains CTR_DRBG definitions and functions. | ||||
|  * | ||||
|  * CTR_DRBG is a standardized way of building a PRNG from a block-cipher | ||||
|  * in counter mode operation, as defined in <em>NIST SP 800-90A: | ||||
|  * Recommendation for Random Number Generation Using Deterministic Random | ||||
|  * Bit Generators</em>. | ||||
|  * | ||||
|  * The Mbed TLS implementation of CTR_DRBG uses AES-256 as the underlying | ||||
|  * block cipher. | ||||
|  */ | ||||
| /* | ||||
|  *  Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved | ||||
| @@ -156,8 +161,8 @@ void mbedtls_ctr_drbg_init( mbedtls_ctr_drbg_context *ctx ); | ||||
|                         identifiers. Can be NULL. | ||||
|  * \param len           The length of the personalization data. | ||||
|  * | ||||
|  * \return              \c 0 on success, or | ||||
|  *                      #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on failure. | ||||
|  * \return              \c 0 on success. | ||||
|  * \return              #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on failure. | ||||
|  */ | ||||
| int mbedtls_ctr_drbg_seed( mbedtls_ctr_drbg_context *ctx, | ||||
|                    int (*f_entropy)(void *, unsigned char *, size_t), | ||||
| @@ -216,8 +221,8 @@ void mbedtls_ctr_drbg_set_reseed_interval( mbedtls_ctr_drbg_context *ctx, | ||||
|  * \param additional    Additional data to add to the state. Can be NULL. | ||||
|  * \param len           The length of the additional data. | ||||
|  * | ||||
|  * \return   \c 0 on success, or | ||||
|  *           #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on failure. | ||||
|  * \return              \c 0 on success. | ||||
|  * \return              #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on failure. | ||||
|  */ | ||||
| int mbedtls_ctr_drbg_reseed( mbedtls_ctr_drbg_context *ctx, | ||||
|                      const unsigned char *additional, size_t len ); | ||||
| @@ -225,13 +230,15 @@ int mbedtls_ctr_drbg_reseed( mbedtls_ctr_drbg_context *ctx, | ||||
| /** | ||||
|  * \brief              This function updates the state of the CTR_DRBG context. | ||||
|  * | ||||
|  * \note               If \p add_len is greater than | ||||
|  *                     #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT, only the first | ||||
|  *                     #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT Bytes are used. | ||||
|  *                     The remaining Bytes are silently discarded. | ||||
|  * | ||||
|  * \param ctx          The CTR_DRBG context. | ||||
|  * \param additional   The data to update the state with. | ||||
|  * \param add_len      Length of \p additional data. | ||||
|  * | ||||
|  * \note     If \p add_len is greater than #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT, | ||||
|  *           only the first #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT Bytes are used. | ||||
|  *           The remaining Bytes are silently discarded. | ||||
|  */ | ||||
| void mbedtls_ctr_drbg_update( mbedtls_ctr_drbg_context *ctx, | ||||
|                       const unsigned char *additional, size_t add_len ); | ||||
| @@ -249,8 +256,8 @@ void mbedtls_ctr_drbg_update( mbedtls_ctr_drbg_context *ctx, | ||||
|  * \param additional    Additional data to update. Can be NULL. | ||||
|  * \param add_len       The length of the additional data. | ||||
|  * | ||||
|  * \return    \c 0 on success, or | ||||
|  *            #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or | ||||
|  * \return    \c 0 on success. | ||||
|  * \return    #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or | ||||
|  *            #MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG on failure. | ||||
|  */ | ||||
| int mbedtls_ctr_drbg_random_with_add( void *p_rng, | ||||
| @@ -267,8 +274,8 @@ int mbedtls_ctr_drbg_random_with_add( void *p_rng, | ||||
|  * \param output        The buffer to fill. | ||||
|  * \param output_len    The length of the buffer. | ||||
|  * | ||||
|  * \return              \c 0 on success, or | ||||
|  *                      #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or | ||||
|  * \return              \c 0 on success. | ||||
|  * \return              #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or | ||||
|  *                      #MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG on failure. | ||||
|  */ | ||||
| int mbedtls_ctr_drbg_random( void *p_rng, | ||||
| @@ -281,9 +288,9 @@ int mbedtls_ctr_drbg_random( void *p_rng, | ||||
|  * \param ctx           The CTR_DRBG context. | ||||
|  * \param path          The name of the file. | ||||
|  * | ||||
|  * \return              \c 0 on success, | ||||
|  *                      #MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR on file error, or | ||||
|  *                      #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on | ||||
|  * \return              \c 0 on success. | ||||
|  * \return              #MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR on file error. | ||||
|  * \return              #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED on | ||||
|  *                      failure. | ||||
|  */ | ||||
| int mbedtls_ctr_drbg_write_seed_file( mbedtls_ctr_drbg_context *ctx, const char *path ); | ||||
| @@ -295,9 +302,9 @@ int mbedtls_ctr_drbg_write_seed_file( mbedtls_ctr_drbg_context *ctx, const char | ||||
|  * \param ctx           The CTR_DRBG context. | ||||
|  * \param path          The name of the file. | ||||
|  * | ||||
|  * \return              \c 0 on success, | ||||
|  *                      #MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR on file error, | ||||
|  *                      #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or | ||||
|  * \return              \c 0 on success. | ||||
|  * \return              #MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR on file error. | ||||
|  * \return              #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or | ||||
|  *                      #MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG on failure. | ||||
|  */ | ||||
| int mbedtls_ctr_drbg_update_seed_file( mbedtls_ctr_drbg_context *ctx, const char *path ); | ||||
| @@ -306,7 +313,8 @@ int mbedtls_ctr_drbg_update_seed_file( mbedtls_ctr_drbg_context *ctx, const char | ||||
| /** | ||||
|  * \brief               The CTR_DRBG checkup routine. | ||||
|  * | ||||
|  * \return              \c 0 on success, or \c 1 on failure. | ||||
|  * \return              \c 0 on success. | ||||
|  * \return              \c 1 on failure. | ||||
|  */ | ||||
| int mbedtls_ctr_drbg_self_test( int verbose ); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user