mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 23:55:44 +01:00
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:
parent
2c21073789
commit
8e661bf6a8
@ -69,16 +69,12 @@
|
|||||||
|
|
||||||
#if defined( MBEDTLS_CHECK_PARAMS )
|
#if defined( MBEDTLS_CHECK_PARAMS )
|
||||||
#define MBEDTLS_AES_VALIDATE_RET( cond ) do{ if( !(cond) ) { \
|
#define MBEDTLS_AES_VALIDATE_RET( cond ) do{ if( !(cond) ) { \
|
||||||
MBEDTLS_PARAM_FAILED( #cond, \
|
MBEDTLS_PARAM_FAILED( #cond ); \
|
||||||
__FILE__, \
|
|
||||||
__LINE__ ); \
|
|
||||||
return MBEDTLS_ERR_AES_BAD_INPUT_DATA;} \
|
return MBEDTLS_ERR_AES_BAD_INPUT_DATA;} \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
#define MBEDTLS_AES_VALIDATE( cond ) do{ if( !(cond) ) { \
|
#define MBEDTLS_AES_VALIDATE( cond ) do{ if( !(cond) ) { \
|
||||||
MBEDTLS_PARAM_FAILED( #cond, \
|
MBEDTLS_PARAM_FAILED( #cond ); \
|
||||||
__FILE__, \
|
|
||||||
__LINE__ ); \
|
|
||||||
return; } \
|
return; } \
|
||||||
} while(0);
|
} while(0);
|
||||||
#else
|
#else
|
||||||
|
@ -3015,7 +3015,7 @@
|
|||||||
//#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */
|
//#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */
|
||||||
//#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */
|
//#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */
|
||||||
|
|
||||||
//#define MBEDTLS_PARAM_FAILED(x) mbedtls_param_failed( #x ) /**< Default parameter validation callback to use. Can be undefined */
|
//#define MBEDTLS_PARAM_FAILED(x) mbedtls_param_failed( #x, __FILE__, __LINE__ ) /**< Default parameter validation callback to use. Can be undefined */
|
||||||
|
|
||||||
|
|
||||||
/* SSL Cache options */
|
/* SSL Cache options */
|
||||||
|
@ -42,8 +42,8 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( MBEDTLS_CHECK_PARAMS ) && !defined(MBEDTLS_PARAM_FAILED)
|
#if defined( MBEDTLS_CHECK_PARAMS ) && !defined(MBEDTLS_PARAM_FAILED)
|
||||||
#define MBEDTLS_PARAM_FAILED( cond, file, line ) \
|
#define MBEDTLS_PARAM_FAILED( cond ) \
|
||||||
mbedtls_param_failed( cond, file, line )
|
mbedtls_param_failed( cond, __FILE__, __LINE__ )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief User supplied callback function for parameter validation failure.
|
* \brief User supplied callback function for parameter validation failure.
|
||||||
@ -65,7 +65,6 @@ extern "C" {
|
|||||||
* execution in the application code.
|
* execution in the application code.
|
||||||
*/
|
*/
|
||||||
void mbedtls_param_failed( char* failure_condition, char* file, int line );
|
void mbedtls_param_failed( char* failure_condition, char* file, int line );
|
||||||
|
|
||||||
#endif /* MBEDTLS_CHECK_PARAMS && !MBEDTLS_PARAM_FAILED */
|
#endif /* MBEDTLS_CHECK_PARAMS && !MBEDTLS_PARAM_FAILED */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#if defined(MBEDTLS_CHECK_PARAMS)
|
#if defined(MBEDTLS_CHECK_PARAMS)
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#define MBEDTLS_PARAM_FAILED(x) mbedtls_param_failed( #x )
|
#define MBEDTLS_PARAM_FAILED(x) mbedtls_param_failed( #x, __FILE__, __LINE__ )
|
||||||
|
|
||||||
#endif /* MBEDTLS_CHECK_PARAMS */
|
#endif /* MBEDTLS_CHECK_PARAMS */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user