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

Use a proper DRBG in programs

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
Manuel Pégourié-Gonnard
2021-06-16 10:35:56 +02:00
parent 7f93da1265
commit 1503a9adab
4 changed files with 64 additions and 19 deletions

View File

@@ -20,7 +20,6 @@
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
#include "ssl_test_lib.h"
#include "test/random.h"
#if defined(MBEDTLS_SSL_TEST_IMPOSSIBLE)
int main( void )
@@ -689,7 +688,7 @@ void sni_free( sni_entry *head )
*
* Modifies the input string! This is not production quality!
*/
sni_entry *sni_parse( char *sni_string )
sni_entry *sni_parse( char *sni_string, rng_context_t *p_rng )
{
sni_entry *cur = NULL, *new = NULL;
char *p = sni_string;
@@ -728,8 +727,7 @@ sni_entry *sni_parse( char *sni_string )
mbedtls_pk_init( new->key );
if( mbedtls_x509_crt_parse_file( new->cert, crt_file ) != 0 ||
mbedtls_pk_parse_keyfile( new->key, key_file, "",
mbedtls_test_rnd_std_rand, NULL ) != 0 )
mbedtls_pk_parse_keyfile( new->key, key_file, "", rng_get, p_rng ) != 0 )
goto error;
if( strcmp( ca_file, "-" ) != 0 )
@@ -2373,7 +2371,7 @@ int main( int argc, char *argv[] )
mbedtls_printf( " . Setting up SNI information..." );
fflush( stdout );
if( ( sni_info = sni_parse( opt.sni ) ) == NULL )
if( ( sni_info = sni_parse( opt.sni, &rng ) ) == NULL )
{
mbedtls_printf( " failed\n" );
goto exit;