Merge pull request #3160 from gilles-peskine-arm/hkdf_expand-initialize_t-development

hkdf_expand: explicitly initialize t
This commit is contained in:
Gilles Peskine 2020-04-06 16:34:31 +02:00 committed by GitHub
commit 54e1c30d1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,7 +115,7 @@ int mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const unsigned char *prk,
n = okm_len / hash_len;
if( (okm_len % hash_len) != 0 )
if( okm_len % hash_len != 0 )
{
n++;
}
@ -131,11 +131,13 @@ int mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const unsigned char *prk,
mbedtls_md_init( &ctx );
if( (ret = mbedtls_md_setup( &ctx, md, 1) ) != 0 )
if( ( ret = mbedtls_md_setup( &ctx, md, 1 ) ) != 0 )
{
goto exit;
}
memset( t, 0, hash_len );
/*
* Compute T = T(1) | T(2) | T(3) | ... | T(N)
* Where T(N) is defined in RFC 5869 Section 2.3