Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upFix using of uninitialized buffer "t" #2942
Conversation
Hello, @svpcom, and thanks for the contribution! |
This comment has been minimized.
This comment has been minimized.
In /*
* Compute T = T(1) | T(2) | T(3) | ... | T(N)
* Where T(N) is defined in RFC 5869 Section 2.3
*/
for( i = 1; i <= n; i++ )
{ HMAC read data from uninitialized ret = mbedtls_md_hmac_update( &ctx, t, t_len ); So |
Could you please add a regression test? We test with ASan and would expect a failure there if we provide the right test case. |
@@ -93,7 +93,7 @@ int mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const unsigned char *prk, | |||
int ret = 0; | |||
mbedtls_md_context_t ctx; | |||
unsigned char t[MBEDTLS_MD_MAX_SIZE]; | |||
bzero(t, sizeof(t)); | |||
mbedtls_platform_zeroize(t, sizeof(t)); |
This comment has been minimized.
This comment has been minimized.
Patater
Nov 29, 2019
Collaborator
memset()
should be fine here, since t
doesn't contain secrets at this point.
This comment has been minimized.
This comment has been minimized.
For the mbedtls-2.16 and mbedtls-2.7 branches, we need a contributor license agreement (CLA) in order to take onboard your fix. If this is a personal contribution, the easiest way to do this is if you create an mbed account and accept this click through agreement. Alternatively, you can find a slightly different agreement to sign here, which can be signed and returned to us, and is applicable if you don't want to create an mbed account or alternatively if this is a corporate contribution. Thanks! |
This comment has been minimized.
This comment has been minimized.
@svpcom, looking at the first iteration, Thanks to @yanesca for also taking a look at this. |
svpcom commentedNov 29, 2019
Status
READY
Requires Backporting
Yes
Which branch?
All branches
Migrations
NO
Additional comments
Security fix