mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 20:22:59 -05:00 
			
		
		
		
	Detect and report mutex usage errors in SSL test programs
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
		
							parent
							
								
									d0a46e5c7f
								
							
						
					
					
						commit
						e374b95fe1
					
				@ -22,6 +22,10 @@
 | 
			
		||||
 | 
			
		||||
#include "ssl_test_lib.h"
 | 
			
		||||
 | 
			
		||||
#if defined(MBEDTLS_TEST_HOOKS)
 | 
			
		||||
#include "test/helpers.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(MBEDTLS_SSL_TEST_IMPOSSIBLE)
 | 
			
		||||
 | 
			
		||||
void my_debug( void *ctx, int level,
 | 
			
		||||
@ -325,10 +329,22 @@ int idle( mbedtls_net_context *fd,
 | 
			
		||||
 | 
			
		||||
void test_hooks_init( void )
 | 
			
		||||
{
 | 
			
		||||
    mbedtls_test_info_reset( );
 | 
			
		||||
 | 
			
		||||
#if defined(MBEDTLS_TEST_MUTEX_USAGE)
 | 
			
		||||
    mbedtls_test_mutex_usage_init( );
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int test_hooks_failure_detected( void )
 | 
			
		||||
{
 | 
			
		||||
#if defined(MBEDTLS_TEST_MUTEX_USAGE)
 | 
			
		||||
    /* Errors are reported via mbedtls_test_info. */
 | 
			
		||||
    mbedtls_test_mutex_usage_check( );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    if( mbedtls_test_info.result != MBEDTLS_TEST_RESULT_SUCCESS )
 | 
			
		||||
        return( 1 );
 | 
			
		||||
    return( 0 );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user