1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-12-24 17:41:01 +03:00

Change the use of setjmp/longjmp in parameter failure callback

Change the use of setjmp and longjmp in signalling parameter validation failures
when using the MBEDTLS_CHECK_PARAMS config.h option. This change allows
all calls which might result in a call to the parameter validation failure
handler to always be caught, even without use of the new macros, by placing a
setjmp() in the outer function which calls the test function, which the handler
can jump to.

This has several benefits:
    * it allows us to remove the clang compiler warning (-Wclobbered) caused
      by local auto variables being in the same function as the call to setjmp.
    * removes the need to wrap all function calls in the test functions with the
      TEST_ASSERT() macro. Now all parameter validation function calls should be
      caught.
This commit is contained in:
Simon Butcher
2018-12-09 22:09:59 +00:00
committed by Manuel Pégourié-Gonnard
parent 747f5fe3e2
commit 6542f6c597
3 changed files with 97 additions and 101 deletions

View File

@@ -546,6 +546,7 @@ int execute_tests( int argc , const char ** argv )
if( unmet_dep_count == 0 )
{
test_info.failed = 0;
test_info.paramfail_test_state = PARAMFAIL_TESTSTATE_IDLE;
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
/* Suppress all output from the library unless we're verbose