This commit is contained in:
wangyu-
2018-06-24 08:22:26 -05:00
parent d3cbbe8085
commit 232ec4f339
2 changed files with 10 additions and 12 deletions

View File

@@ -956,14 +956,16 @@ int hkdf_sha256_expand( const unsigned char *prk,
return( MBEDTLS_ERR_HKDF_BAD_INPUT_DATA );
}
/*
mbedtls_md_init( &ctx );
//mbedtls_md_init( &ctx ); //old code
memset( &ctx, 0, sizeof( ctx) ); //its not necessary
/*
if( (ret = mbedtls_md_setup( &ctx, md, 1) ) != 0 )
{
goto exit;
}*/
/* RFC 5869 Section 2.3. */
for( i = 1; i <= n; i++ )
{
@@ -988,8 +990,8 @@ int hkdf_sha256_expand( const unsigned char *prk,
}
//exit:
//mbedtls_md_free( &ctx );
mbedtls_platform_zeroize( &ctx, sizeof( ctx ) );
//mbedtls_md_free( &ctx ); //old code
mbedtls_platform_zeroize( &ctx, sizeof( ctx ) ); //not necessary too
mbedtls_platform_zeroize( t, sizeof( t ) );