mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 17:55:37 +01:00
Use rand instead of srand
This commit is contained in:
parent
f049304895
commit
2b7c9a2e1a
@ -70,7 +70,7 @@ static int dummy_random( void *p_rng, unsigned char *output, size_t output_len )
|
|||||||
ret = mbedtls_ctr_drbg_random(p_rng, output, output_len);
|
ret = mbedtls_ctr_drbg_random(p_rng, output, output_len);
|
||||||
for (i=0; i<output_len; i++) {
|
for (i=0; i<output_len; i++) {
|
||||||
//replace result with pseudo random
|
//replace result with pseudo random
|
||||||
output[i] = (unsigned char) random();
|
output[i] = (unsigned char) rand();
|
||||||
}
|
}
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ static int dummy_entropy( void *data, unsigned char *output, size_t len )
|
|||||||
//ret = mbedtls_entropy_func(data, output, len);
|
//ret = mbedtls_entropy_func(data, output, len);
|
||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
//replace result with pseudo random
|
//replace result with pseudo random
|
||||||
output[i] = (unsigned char) random();
|
output[i] = (unsigned char) rand();
|
||||||
}
|
}
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
|||||||
//There may be other options to add :
|
//There may be other options to add :
|
||||||
// mbedtls_ssl_conf_cert_profile, mbedtls_ssl_conf_sig_hashes
|
// mbedtls_ssl_conf_cert_profile, mbedtls_ssl_conf_sig_hashes
|
||||||
|
|
||||||
srandom(1);
|
srand(1);
|
||||||
mbedtls_ssl_conf_rng( &conf, dummy_random, &ctr_drbg );
|
mbedtls_ssl_conf_rng( &conf, dummy_random, &ctr_drbg );
|
||||||
|
|
||||||
if( mbedtls_ssl_setup( &ssl, &conf ) != 0 )
|
if( mbedtls_ssl_setup( &ssl, &conf ) != 0 )
|
||||||
|
@ -71,7 +71,7 @@ static int dummy_random( void *p_rng, unsigned char *output, size_t output_len )
|
|||||||
ret = mbedtls_ctr_drbg_random(p_rng, output, output_len);
|
ret = mbedtls_ctr_drbg_random(p_rng, output, output_len);
|
||||||
for (i=0; i<output_len; i++) {
|
for (i=0; i<output_len; i++) {
|
||||||
//replace result with pseudo random
|
//replace result with pseudo random
|
||||||
output[i] = (unsigned char) random();
|
output[i] = (unsigned char) rand();
|
||||||
}
|
}
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ static int dummy_entropy( void *data, unsigned char *output, size_t len )
|
|||||||
//ret = mbedtls_entropy_func(data, output, len);
|
//ret = mbedtls_entropy_func(data, output, len);
|
||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
//replace result with pseudo random
|
//replace result with pseudo random
|
||||||
output[i] = (unsigned char) random();
|
output[i] = (unsigned char) rand();
|
||||||
}
|
}
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@ -121,7 +121,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
|||||||
mbedtls_ctr_drbg_init( &ctr_drbg );
|
mbedtls_ctr_drbg_init( &ctr_drbg );
|
||||||
mbedtls_entropy_init( &entropy );
|
mbedtls_entropy_init( &entropy );
|
||||||
|
|
||||||
srandom(1);
|
srand(1);
|
||||||
if( mbedtls_ctr_drbg_seed( &ctr_drbg, dummy_entropy, &entropy,
|
if( mbedtls_ctr_drbg_seed( &ctr_drbg, dummy_entropy, &entropy,
|
||||||
(const unsigned char *) pers, strlen( pers ) ) != 0 )
|
(const unsigned char *) pers, strlen( pers ) ) != 0 )
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -72,7 +72,7 @@ static int dummy_random( void *p_rng, unsigned char *output, size_t output_len )
|
|||||||
ret = mbedtls_ctr_drbg_random(p_rng, output, output_len);
|
ret = mbedtls_ctr_drbg_random(p_rng, output, output_len);
|
||||||
for (i=0; i<output_len; i++) {
|
for (i=0; i<output_len; i++) {
|
||||||
//replace result with pseudo random
|
//replace result with pseudo random
|
||||||
output[i] = (unsigned char) random();
|
output[i] = (unsigned char) rand();
|
||||||
}
|
}
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ static int dummy_entropy( void *data, unsigned char *output, size_t len )
|
|||||||
//ret = mbedtls_entropy_func(data, output, len);
|
//ret = mbedtls_entropy_func(data, output, len);
|
||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
//replace result with pseudo random
|
//replace result with pseudo random
|
||||||
output[i] = (unsigned char) random();
|
output[i] = (unsigned char) rand();
|
||||||
}
|
}
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
|||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
|
|
||||||
srandom(1);
|
srand(1);
|
||||||
mbedtls_ssl_conf_rng( &conf, dummy_random, &ctr_drbg );
|
mbedtls_ssl_conf_rng( &conf, dummy_random, &ctr_drbg );
|
||||||
|
|
||||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||||
|
@ -71,7 +71,7 @@ static int dummy_random( void *p_rng, unsigned char *output, size_t output_len )
|
|||||||
ret = mbedtls_ctr_drbg_random(p_rng, output, output_len);
|
ret = mbedtls_ctr_drbg_random(p_rng, output, output_len);
|
||||||
for (i=0; i<output_len; i++) {
|
for (i=0; i<output_len; i++) {
|
||||||
//replace result with pseudo random
|
//replace result with pseudo random
|
||||||
output[i] = (unsigned char) random();
|
output[i] = (unsigned char) rand();
|
||||||
}
|
}
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ static int dummy_entropy( void *data, unsigned char *output, size_t len )
|
|||||||
//ret = mbedtls_entropy_func(data, output, len);
|
//ret = mbedtls_entropy_func(data, output, len);
|
||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
//replace result with pseudo random
|
//replace result with pseudo random
|
||||||
output[i] = (unsigned char) random();
|
output[i] = (unsigned char) rand();
|
||||||
}
|
}
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
|||||||
MBEDTLS_SSL_PRESET_DEFAULT ) != 0 )
|
MBEDTLS_SSL_PRESET_DEFAULT ) != 0 )
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
srandom(1);
|
srand(1);
|
||||||
mbedtls_ssl_conf_rng( &conf, dummy_random, &ctr_drbg );
|
mbedtls_ssl_conf_rng( &conf, dummy_random, &ctr_drbg );
|
||||||
|
|
||||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||||
|
Loading…
Reference in New Issue
Block a user