Zeroize tmp buf in mbedtls_md_file() md.c
@@ -312,13 +312,12 @@ int mbedtls_md_file( const mbedtls_md_info_t *md_info, const char *path, unsigne
md_info->update_func( ctx.md_ctx, buf, n );
if( ferror( f ) != 0 )
- {
ret = MBEDTLS_ERR_MD_FILE_IO_ERROR;
- goto cleanup;
- }
-
+ else
md_info->finish_func( ctx.md_ctx, output );
+ mbedtls_zeroize( buf, sizeof( buf ) );
+
cleanup:
fclose( f );
mbedtls_md_free( &ctx );
