mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-24 10:43:31 +00:00
Merge pull request #5526 from paul-elliott-arm/fix_fuzzer_null_ref
Ensure ctr_drbg is initialised every time in fuzz_server
This commit is contained in:
commit
a1b506996d
@ -971,6 +971,7 @@ int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
|
|||||||
unsigned char output[16] )
|
unsigned char output[16] )
|
||||||
{
|
{
|
||||||
AES_VALIDATE_RET( ctx != NULL );
|
AES_VALIDATE_RET( ctx != NULL );
|
||||||
|
AES_VALIDATE_RET( ctx->rk != NULL );
|
||||||
AES_VALIDATE_RET( input != NULL );
|
AES_VALIDATE_RET( input != NULL );
|
||||||
AES_VALIDATE_RET( output != NULL );
|
AES_VALIDATE_RET( output != NULL );
|
||||||
AES_VALIDATE_RET( mode == MBEDTLS_AES_ENCRYPT ||
|
AES_VALIDATE_RET( mode == MBEDTLS_AES_ENCRYPT ||
|
||||||
|
@ -55,13 +55,14 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
|||||||
}
|
}
|
||||||
options = Data[Size - 1];
|
options = Data[Size - 1];
|
||||||
|
|
||||||
if (initialized == 0) {
|
mbedtls_ctr_drbg_init( &ctr_drbg );
|
||||||
mbedtls_ctr_drbg_init( &ctr_drbg );
|
mbedtls_entropy_init( &entropy );
|
||||||
mbedtls_entropy_init( &entropy );
|
|
||||||
|
|
||||||
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 )
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
if (initialized == 0) {
|
||||||
|
|
||||||
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
|
#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_PEM_PARSE_C)
|
||||||
mbedtls_x509_crt_init( &srvcert );
|
mbedtls_x509_crt_init( &srvcert );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user