mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-30 19:20:40 -04:00 
			
		
		
		
	Only define test_hooks_xxx under MBEDTLS_TEST_HOOKS
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
		
							parent
							
								
									00d0ad4036
								
							
						
					
					
						commit
						60fe6606bf
					
				| @ -734,7 +734,9 @@ int main( int argc, char *argv[] ) | |||||||
|     mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof(alloc_buf) ); |     mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof(alloc_buf) ); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #if defined(MBEDTLS_TEST_HOOKS) | ||||||
|     test_hooks_init( ); |     test_hooks_init( ); | ||||||
|  | #endif /* MBEDTLS_TEST_HOOKS */ | ||||||
| 
 | 
 | ||||||
|     /*
 |     /*
 | ||||||
|      * Make sure memory references are valid. |      * Make sure memory references are valid. | ||||||
| @ -3042,6 +3044,7 @@ exit: | |||||||
|     mbedtls_psa_crypto_free( ); |     mbedtls_psa_crypto_free( ); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #if defined(MBEDTLS_TEST_HOOKS) | ||||||
|     if( test_hooks_failure_detected( ) ) |     if( test_hooks_failure_detected( ) ) | ||||||
|     { |     { | ||||||
|         if( ret == 0 ) |         if( ret == 0 ) | ||||||
| @ -3049,6 +3052,7 @@ exit: | |||||||
|         mbedtls_printf( "Test hooks detected errors.\n" ); |         mbedtls_printf( "Test hooks detected errors.\n" ); | ||||||
|     } |     } | ||||||
|     test_hooks_free( ); |     test_hooks_free( ); | ||||||
|  | #endif /* MBEDTLS_TEST_HOOKS */ | ||||||
| 
 | 
 | ||||||
| #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) | #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) | ||||||
| #if defined(MBEDTLS_MEMORY_DEBUG) | #if defined(MBEDTLS_MEMORY_DEBUG) | ||||||
|  | |||||||
| @ -1369,7 +1369,9 @@ int main( int argc, char *argv[] ) | |||||||
| #endif  /* MBEDTLS_MEMORY_DEBUG */ | #endif  /* MBEDTLS_MEMORY_DEBUG */ | ||||||
| #endif  /* MBEDTLS_MEMORY_BUFFER_ALLOC_C */ | #endif  /* MBEDTLS_MEMORY_BUFFER_ALLOC_C */ | ||||||
| 
 | 
 | ||||||
|  | #if defined(MBEDTLS_TEST_HOOKS) | ||||||
|     test_hooks_init( ); |     test_hooks_init( ); | ||||||
|  | #endif /* MBEDTLS_TEST_HOOKS */ | ||||||
| 
 | 
 | ||||||
|     /*
 |     /*
 | ||||||
|      * Make sure memory references are valid in case we exit early. |      * Make sure memory references are valid in case we exit early. | ||||||
| @ -4004,6 +4006,7 @@ exit: | |||||||
|     mbedtls_psa_crypto_free( ); |     mbedtls_psa_crypto_free( ); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #if defined(MBEDTLS_TEST_HOOKS) | ||||||
|     /* Let test hooks detect errors such as resource leaks.
 |     /* Let test hooks detect errors such as resource leaks.
 | ||||||
|      * Don't do it in query_config mode, because some test code prints |      * Don't do it in query_config mode, because some test code prints | ||||||
|      * information to stdout and this gets mixed with the regular output. */ |      * information to stdout and this gets mixed with the regular output. */ | ||||||
| @ -4017,6 +4020,7 @@ exit: | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     test_hooks_free( ); |     test_hooks_free( ); | ||||||
|  | #endif /* MBEDTLS_TEST_HOOKS */ | ||||||
| 
 | 
 | ||||||
| #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) | #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) | ||||||
| #if defined(MBEDTLS_MEMORY_DEBUG) | #if defined(MBEDTLS_MEMORY_DEBUG) | ||||||
|  | |||||||
| @ -288,13 +288,6 @@ int test_hooks_failure_detected( void ); | |||||||
|  */ |  */ | ||||||
| void test_hooks_free( void ); | void test_hooks_free( void ); | ||||||
| 
 | 
 | ||||||
| #else /* MBEDTLS_TEST_HOOKS */ |  | ||||||
| 
 |  | ||||||
| /* Define macros that do nothing, for convenience. */ |  | ||||||
| #define test_hooks_init( ) ( (void) 0 ) |  | ||||||
| #define test_hooks_failure_detected( ) 0 |  | ||||||
| #define test_hooks_free( ) ( (void) 0 ) |  | ||||||
| 
 |  | ||||||
| #endif /* !MBEDTLS_TEST_HOOKS */ | #endif /* !MBEDTLS_TEST_HOOKS */ | ||||||
| 
 | 
 | ||||||
| #endif /* MBEDTLS_SSL_TEST_IMPOSSIBLE conditions: else */ | #endif /* MBEDTLS_SSL_TEST_IMPOSSIBLE conditions: else */ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Gilles Peskine
						Gilles Peskine