Fix arity of the PARAM_FAILED() macro and function

It was inconsistent between files: sometimes 3 arguments, sometimes one.

Align to 1 argument for the macro and 3 for the function, because:
- we don't need 3 arguments for the macro, it can add __FILE__ and __LINE__
  in its expansion, while the function needs them as parameters to be correct;
- people who re-defined the macro should have flexibility, and 3 arguments
  can give the impression they they don't have as much as they actually do;
- the design document has the macro with 1 argument, so let's stick to that.
This commit is contained in:
Manuel Pégourié-Gonnard 2018-12-10 12:41:46 +01:00
parent 2c21073789
commit 8e661bf6a8
4 changed files with 6 additions and 11 deletions

View file

@ -69,16 +69,12 @@
#if defined( MBEDTLS_CHECK_PARAMS )
#define MBEDTLS_AES_VALIDATE_RET( cond ) do{ if( !(cond) ) { \
MBEDTLS_PARAM_FAILED( #cond, \
__FILE__, \
__LINE__ ); \
MBEDTLS_PARAM_FAILED( #cond ); \
return MBEDTLS_ERR_AES_BAD_INPUT_DATA;} \
} while(0);
#define MBEDTLS_AES_VALIDATE( cond ) do{ if( !(cond) ) { \
MBEDTLS_PARAM_FAILED( #cond, \
__FILE__, \
__LINE__ ); \
MBEDTLS_PARAM_FAILED( #cond ); \
return; } \
} while(0);
#else