mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 11:25:42 +01:00
Fix possible memory leak in <MD>_ext()
This commit is contained in:
parent
94682d1d7d
commit
0963e6cfac
@ -229,18 +229,18 @@ int mbedtls_md2_ext( const unsigned char *input,
|
||||
mbedtls_md2_init( &ctx );
|
||||
|
||||
if( ( ret = mbedtls_md2_starts_ext( &ctx ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_md2_update_ext( &ctx, input, ilen ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_md2_finish_ext( &ctx, output ) ) != 0 )
|
||||
return( ret );
|
||||
|
||||
goto exit;
|
||||
|
||||
exit:
|
||||
mbedtls_md2_free( &ctx );
|
||||
|
||||
return( 0 );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
@ -333,17 +333,18 @@ int mbedtls_md4_ext( const unsigned char *input,
|
||||
mbedtls_md4_init( &ctx );
|
||||
|
||||
if( ( ret = mbedtls_md4_starts_ext( &ctx ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_md4_update_ext( &ctx, input, ilen ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_md4_finish_ext( &ctx, output ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
exit:
|
||||
mbedtls_md4_free( &ctx );
|
||||
|
||||
return( 0 );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
@ -347,17 +347,18 @@ int mbedtls_md5_ext( const unsigned char *input,
|
||||
mbedtls_md5_init( &ctx );
|
||||
|
||||
if( ( ret = mbedtls_md5_starts_ext( &ctx ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_md5_update_ext( &ctx, input, ilen ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_md5_finish_ext( &ctx, output ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
exit:
|
||||
mbedtls_md5_free( &ctx );
|
||||
|
||||
return( 0 );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
@ -406,17 +406,18 @@ int mbedtls_ripemd160_ext( const unsigned char *input,
|
||||
mbedtls_ripemd160_init( &ctx );
|
||||
|
||||
if( ( ret = mbedtls_ripemd160_starts_ext( &ctx ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_ripemd160_update_ext( &ctx, input, ilen ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_ripemd160_finish_ext( &ctx, output ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
exit:
|
||||
mbedtls_ripemd160_free( &ctx );
|
||||
|
||||
return( 0 );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
@ -380,17 +380,18 @@ int mbedtls_sha1_ext( const unsigned char *input,
|
||||
mbedtls_sha1_init( &ctx );
|
||||
|
||||
if( ( ret = mbedtls_sha1_starts_ext( &ctx ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_sha1_update_ext( &ctx, input, ilen ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_sha1_finish_ext( &ctx, output ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
exit:
|
||||
mbedtls_sha1_free( &ctx );
|
||||
|
||||
return( 0 );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
@ -355,17 +355,18 @@ int mbedtls_sha256_ext( const unsigned char *input,
|
||||
mbedtls_sha256_init( &ctx );
|
||||
|
||||
if( ( ret = mbedtls_sha256_starts_ext( &ctx, is224 ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_sha256_update_ext( &ctx, input, ilen ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_sha256_finish_ext( &ctx, output ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
exit:
|
||||
mbedtls_sha256_free( &ctx );
|
||||
|
||||
return( 0 );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
@ -391,17 +391,18 @@ int mbedtls_sha512_ext( const unsigned char *input,
|
||||
mbedtls_sha512_init( &ctx );
|
||||
|
||||
if( ( ret = mbedtls_sha512_starts_ext( &ctx, is384 ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_sha512_update_ext( &ctx, input, ilen ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
if( ( ret = mbedtls_sha512_finish_ext( &ctx, output ) ) != 0 )
|
||||
return( ret );
|
||||
goto exit;
|
||||
|
||||
exit:
|
||||
mbedtls_sha512_free( &ctx );
|
||||
|
||||
return( 0 );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
Loading…
Reference in New Issue
Block a user