mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 20:22:59 -05:00 
			
		
		
		
	Fix hmac_drbg failure in benchmark, with threading
Remove redunadnat calls to `hmac_drbg_free()` between seeding operations, which make the mutex invalid. Fixes #1095
This commit is contained in:
		
							parent
							
								
									1ab9b57148
								
							
						
					
					
						commit
						278af4536c
					
				@ -22,6 +22,8 @@ Bugfix
 | 
				
			|||||||
Changes
 | 
					Changes
 | 
				
			||||||
   * Change the shebang line in Perl scripts to look up perl in the PATH.
 | 
					   * Change the shebang line in Perl scripts to look up perl in the PATH.
 | 
				
			||||||
     Contributed by fbrosson.
 | 
					     Contributed by fbrosson.
 | 
				
			||||||
 | 
					   * Fix efailure in hmac_drbg in the benchmark sample application, when
 | 
				
			||||||
 | 
					     MBEDTLS_THREADING_C is defined. Found by TrinityTonic, #1095
 | 
				
			||||||
 | 
					
 | 
				
			||||||
= mbed TLS 2.11.0 branch released 2018-06-18
 | 
					= mbed TLS 2.11.0 branch released 2018-06-18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -700,7 +700,6 @@ int main( int argc, char *argv[] )
 | 
				
			|||||||
            mbedtls_exit(1);
 | 
					            mbedtls_exit(1);
 | 
				
			||||||
        TIME_AND_TSC( "HMAC_DRBG SHA-1 (NOPR)",
 | 
					        TIME_AND_TSC( "HMAC_DRBG SHA-1 (NOPR)",
 | 
				
			||||||
                mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) );
 | 
					                mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) );
 | 
				
			||||||
        mbedtls_hmac_drbg_free( &hmac_drbg );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if( mbedtls_hmac_drbg_seed( &hmac_drbg, md_info, myrand, NULL, NULL, 0 ) != 0 )
 | 
					        if( mbedtls_hmac_drbg_seed( &hmac_drbg, md_info, myrand, NULL, NULL, 0 ) != 0 )
 | 
				
			||||||
            mbedtls_exit(1);
 | 
					            mbedtls_exit(1);
 | 
				
			||||||
@ -708,7 +707,6 @@ int main( int argc, char *argv[] )
 | 
				
			|||||||
                                             MBEDTLS_HMAC_DRBG_PR_ON );
 | 
					                                             MBEDTLS_HMAC_DRBG_PR_ON );
 | 
				
			||||||
        TIME_AND_TSC( "HMAC_DRBG SHA-1 (PR)",
 | 
					        TIME_AND_TSC( "HMAC_DRBG SHA-1 (PR)",
 | 
				
			||||||
                mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) );
 | 
					                mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) );
 | 
				
			||||||
        mbedtls_hmac_drbg_free( &hmac_drbg );
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(MBEDTLS_SHA256_C)
 | 
					#if defined(MBEDTLS_SHA256_C)
 | 
				
			||||||
@ -719,7 +717,6 @@ int main( int argc, char *argv[] )
 | 
				
			|||||||
            mbedtls_exit(1);
 | 
					            mbedtls_exit(1);
 | 
				
			||||||
        TIME_AND_TSC( "HMAC_DRBG SHA-256 (NOPR)",
 | 
					        TIME_AND_TSC( "HMAC_DRBG SHA-256 (NOPR)",
 | 
				
			||||||
                mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) );
 | 
					                mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) );
 | 
				
			||||||
        mbedtls_hmac_drbg_free( &hmac_drbg );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if( mbedtls_hmac_drbg_seed( &hmac_drbg, md_info, myrand, NULL, NULL, 0 ) != 0 )
 | 
					        if( mbedtls_hmac_drbg_seed( &hmac_drbg, md_info, myrand, NULL, NULL, 0 ) != 0 )
 | 
				
			||||||
            mbedtls_exit(1);
 | 
					            mbedtls_exit(1);
 | 
				
			||||||
@ -727,8 +724,8 @@ int main( int argc, char *argv[] )
 | 
				
			|||||||
                                             MBEDTLS_HMAC_DRBG_PR_ON );
 | 
					                                             MBEDTLS_HMAC_DRBG_PR_ON );
 | 
				
			||||||
        TIME_AND_TSC( "HMAC_DRBG SHA-256 (PR)",
 | 
					        TIME_AND_TSC( "HMAC_DRBG SHA-256 (PR)",
 | 
				
			||||||
                mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) );
 | 
					                mbedtls_hmac_drbg_random( &hmac_drbg, buf, BUFSIZE ) );
 | 
				
			||||||
        mbedtls_hmac_drbg_free( &hmac_drbg );
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					        mbedtls_hmac_drbg_free( &hmac_drbg );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user