Skip param validation tests if custom macro used
The test framework for validation of parameters depends on the macro MBEDTLS_PARAM_FAILED() being set to its default value when building the library. So far the test framework attempted to define this macro but this was the wrong place - this definition wouldn't be picked by the library. Instead, a different approach is taken: skip those tests when the macro is defined in config.h, as in that case we have no way to know if it will indeed end up calling mbedtls_param_failed() as we need it to. This commit was tested by manually ensuring that aes_invalid_params: - passes (and is not skipped) in the default configuration - is skipped when MBEDTLS_PARAM_FAILED() is defined in config.h
This commit is contained in:
parent
3ef6a6dc5c
commit
a2b0e27378
4 changed files with 24 additions and 31 deletions
|
@ -41,7 +41,16 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined( MBEDTLS_CHECK_PARAMS ) && !defined(MBEDTLS_PARAM_FAILED)
|
||||
#if defined( MBEDTLS_CHECK_PARAMS )
|
||||
|
||||
#if defined(MBEDTLS_PARAM_FAILED)
|
||||
/** An alternative definition of MBEDTLS_PARAM_FAILED has been set in config.h.
|
||||
*
|
||||
* This flag can be used to check whether it is safe to assume that
|
||||
* MBEDTLS_PARAM_FAILED() will expand to a call to mbedtls_param_failed().
|
||||
*/
|
||||
#define MBEDTLS_PARAM_FAILED_ALT
|
||||
#else
|
||||
#define MBEDTLS_PARAM_FAILED( cond ) \
|
||||
mbedtls_param_failed( cond, __FILE__, __LINE__ )
|
||||
|
||||
|
@ -67,7 +76,8 @@ extern "C" {
|
|||
void mbedtls_param_failed( const char* failure_condition,
|
||||
const char* file,
|
||||
int line );
|
||||
#endif /* MBEDTLS_CHECK_PARAMS && !MBEDTLS_PARAM_FAILED */
|
||||
#endif /* MBEDTLS_PARAM_FAILED */
|
||||
#endif /* MBEDTLS_CHECK_PARAMS */
|
||||
|
||||
/**
|
||||
* \brief Securely zeroize a buffer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue