1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Fix references to non-standard SIZE_T_MAX

Turns out C99 doesn't define SIZE_T_MAX, so let's not use it.
This commit is contained in:
Manuel Pégourié-Gonnard
2015-10-05 15:23:11 +01:00
parent 86ff4874a4
commit 2d7083435d
3 changed files with 9 additions and 6 deletions

View File

@ -38,7 +38,6 @@
#include "mbedtls/bn_mul.h"
#include <string.h>
#include <limits.h>
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
@ -59,6 +58,8 @@ static void mbedtls_zeroize( void *v, size_t n ) {
#define biL (ciL << 3) /* bits in limb */
#define biH (ciL << 2) /* half limb size */
#define MPI_SIZE_T_MAX ( (size_t) -1 ) /* SIZE_T_MAX is not standard */
/*
* Convert between bits/chars and number of limbs
* Divide first in order to avoid potential overflows
@ -411,7 +412,7 @@ int mbedtls_mpi_read_string( mbedtls_mpi *X, int radix, const char *s )
if( radix == 16 )
{
if( slen > SIZE_T_MAX >> 2 )
if( slen > MPI_SIZE_T_MAX >> 2 )
return( MBEDTLS_ERR_MPI_BAD_INPUT_DATA );
n = BITS_TO_LIMBS( slen << 2 );