Documentation and cosmetic fixes

Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
Andrzej Kurek 2023-05-04 17:07:57 -04:00
parent 9032711dc7
commit ecaf6fb8b2
3 changed files with 7 additions and 7 deletions

View file

@ -3683,18 +3683,18 @@
/** \def MBEDTLS_PLATFORM_STD_CALLOC /** \def MBEDTLS_PLATFORM_STD_CALLOC
* *
* Default allocator to use, can be undefined. * Default allocator to use, can be undefined.
* It should initialize the allocated buffer memory to zeroes. * It must initialize the allocated buffer memory to zeroes.
* The size of the buffer is the product of the two parameters. * The size of the buffer is the product of the two parameters.
* The behavior is undefined if the product of the two parameters overflows size_t. * The calloc function returns either a null pointer or a pointer to the allocated space.
* If the product is 0, the function may either return NULL or a valid pointer to an array of size 0 which is a valid input to the deallocation function. * If the product is 0, the function may either return NULL or a valid pointer to an array of size 0 which is a valid input to the deallocation function.
* The corresponding deallocation function is MBEDTLS_PLATFORM_STD_FREE. * The corresponding deallocation function is #MBEDTLS_PLATFORM_STD_FREE.
*/ */
//#define MBEDTLS_PLATFORM_STD_CALLOC calloc //#define MBEDTLS_PLATFORM_STD_CALLOC calloc
/** \def MBEDTLS_PLATFORM_STD_FREE /** \def MBEDTLS_PLATFORM_STD_FREE
* *
* Default free to use, can be undefined. * Default free to use, can be undefined.
* NULL is a valid parameter, and the function must do nothing. * NULL is a valid parameter, and the function must do nothing.
* A non-null parameter will always be a pointer previously returned by MBEDTLS_PLATFORM_STD_CALLOC and not yet freed. * A non-null parameter will always be a pointer previously returned by #MBEDTLS_PLATFORM_STD_CALLOC and not yet freed.
*/ */
//#define MBEDTLS_PLATFORM_STD_FREE free //#define MBEDTLS_PLATFORM_STD_FREE free
//#define MBEDTLS_PLATFORM_STD_SETBUF setbuf /**< Default setbuf to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_SETBUF setbuf /**< Default setbuf to use, can be undefined */
@ -3710,7 +3710,7 @@
//#define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */ //#define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_NV_SEED_FILE "seedfile" /**< Seed file to read/write with default implementation */ //#define MBEDTLS_PLATFORM_STD_NV_SEED_FILE "seedfile" /**< Seed file to read/write with default implementation */
/* To Use Function Macros MBEDTLS_PLATFORM_C must be enabled */ /* To use the following function macros, MBEDTLS_PLATFORM_C must be enabled. */
/* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */ /* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */
//#define MBEDTLS_PLATFORM_CALLOC_MACRO calloc /**< Default allocator macro to use, can be undefined. See MBEDTLS_PLATFORM_STD_CALLOC for requirements. */ //#define MBEDTLS_PLATFORM_CALLOC_MACRO calloc /**< Default allocator macro to use, can be undefined. See MBEDTLS_PLATFORM_STD_CALLOC for requirements. */
//#define MBEDTLS_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined. See MBEDTLS_PLATFORM_STD_FREE for requirements. */ //#define MBEDTLS_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined. See MBEDTLS_PLATFORM_STD_FREE for requirements. */

View file

@ -135,7 +135,7 @@ extern "C" {
/* /*
* The function pointers for calloc and free. * The function pointers for calloc and free.
* please see MBEDTLS_PLATFORM_STD_CALLOC and MBEDTLS_PLATFORM_STD_FREE * Please see MBEDTLS_PLATFORM_STD_CALLOC and MBEDTLS_PLATFORM_STD_FREE
* in mbedtls_config.h for more information about behaviour and requirements. * in mbedtls_config.h for more information about behaviour and requirements.
*/ */
#if defined(MBEDTLS_PLATFORM_MEMORY) #if defined(MBEDTLS_PLATFORM_MEMORY)

View file

@ -74,7 +74,7 @@ static int calloc_self_test(int verbose)
void *buffer1 = mbedtls_calloc(1, 1); void *buffer1 = mbedtls_calloc(1, 1);
void *buffer2 = mbedtls_calloc(1, 1); void *buffer2 = mbedtls_calloc(1, 1);
unsigned int buf_size = 256; unsigned int buf_size = 256;
unsigned char *buffer3 = mbedtls_calloc(buf_size, sizeof(unsigned char)); unsigned char *buffer3 = mbedtls_calloc(buf_size, 1);
if (empty1 == NULL && empty2 == NULL) { if (empty1 == NULL && empty2 == NULL) {
if (verbose) { if (verbose) {