Merge pull request #2628 from tmael/nightly_valgrind

Fix Valgrind Known Configs Test
This commit is contained in:
David Garske
2019-11-29 08:59:58 -08:00
committed by GitHub

View File

@ -2344,10 +2344,10 @@ static int FindSuiteSSL(WOLFSSL* ssl, byte* suite)
static int CreateCookie(WOLFSSL* ssl, byte* hash, byte hashSz) static int CreateCookie(WOLFSSL* ssl, byte* hash, byte hashSz)
{ {
int ret; int ret;
byte mac[WC_MAX_DIGEST_SIZE]; byte mac[WC_MAX_DIGEST_SIZE] = {0};
Hmac cookieHmac; Hmac cookieHmac;
byte cookieType; byte cookieType = 0;
byte macSz; byte macSz = 0;
#if !defined(NO_SHA) && defined(NO_SHA256) #if !defined(NO_SHA) && defined(NO_SHA256)
cookieType = SHA; cookieType = SHA;
@ -2357,6 +2357,7 @@ static int CreateCookie(WOLFSSL* ssl, byte* hash, byte hashSz)
cookieType = WC_SHA256; cookieType = WC_SHA256;
macSz = WC_SHA256_DIGEST_SIZE; macSz = WC_SHA256_DIGEST_SIZE;
#endif /* NO_SHA256 */ #endif /* NO_SHA256 */
XMEMSET(&cookieHmac, 0, sizeof(Hmac));
ret = wc_HmacSetKey(&cookieHmac, cookieType, ret = wc_HmacSetKey(&cookieHmac, cookieType,
ssl->buffers.tls13CookieSecret.buffer, ssl->buffers.tls13CookieSecret.buffer,
@ -2382,7 +2383,7 @@ static int RestartHandshakeHash(WOLFSSL* ssl)
{ {
int ret; int ret;
Hashes hashes; Hashes hashes;
byte header[HANDSHAKE_HEADER_SZ]; byte header[HANDSHAKE_HEADER_SZ] = {0};
byte* hash = NULL; byte* hash = NULL;
byte hashSz = 0; byte hashSz = 0;
@ -3764,10 +3765,10 @@ static int DoPreSharedKeys(WOLFSSL* ssl, const byte* input, word32 helloSz,
static int CheckCookie(WOLFSSL* ssl, byte* cookie, byte cookieSz) static int CheckCookie(WOLFSSL* ssl, byte* cookie, byte cookieSz)
{ {
int ret; int ret;
byte mac[WC_MAX_DIGEST_SIZE]; byte mac[WC_MAX_DIGEST_SIZE] = {0};
Hmac cookieHmac; Hmac cookieHmac;
byte cookieType; byte cookieType = 0;
byte macSz; byte macSz = 0;
#if !defined(NO_SHA) && defined(NO_SHA256) #if !defined(NO_SHA) && defined(NO_SHA256)
cookieType = SHA; cookieType = SHA;
@ -3781,6 +3782,7 @@ static int CheckCookie(WOLFSSL* ssl, byte* cookie, byte cookieSz)
if (cookieSz < ssl->specs.hash_size + macSz) if (cookieSz < ssl->specs.hash_size + macSz)
return HRR_COOKIE_ERROR; return HRR_COOKIE_ERROR;
cookieSz -= macSz; cookieSz -= macSz;
XMEMSET(&cookieHmac, 0, sizeof(Hmac));
ret = wc_HmacSetKey(&cookieHmac, cookieType, ret = wc_HmacSetKey(&cookieHmac, cookieType,
ssl->buffers.tls13CookieSecret.buffer, ssl->buffers.tls13CookieSecret.buffer,
@ -3831,8 +3833,8 @@ static int CheckCookie(WOLFSSL* ssl, byte* cookie, byte cookieSz)
*/ */
static int RestartHandshakeHashWithCookie(WOLFSSL* ssl, Cookie* cookie) static int RestartHandshakeHashWithCookie(WOLFSSL* ssl, Cookie* cookie)
{ {
byte header[HANDSHAKE_HEADER_SZ]; byte header[HANDSHAKE_HEADER_SZ] = {0};
byte hrr[MAX_HRR_SZ]; byte hrr[MAX_HRR_SZ] = {0};
int hrrIdx; int hrrIdx;
word32 idx; word32 idx;
byte hashSz; byte hashSz;
@ -4038,19 +4040,22 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
word32 helloSz) word32 helloSz)
{ {
int ret = VERSION_ERROR; int ret = VERSION_ERROR;
byte b; byte b = 0;
ProtocolVersion pv; ProtocolVersion pv;
Suites clSuites; Suites clSuites;
word32 i = *inOutIdx; word32 i = *inOutIdx;
word32 begin = i; word32 begin = i;
word16 totalExtSz = 0; word16 totalExtSz = 0;
int usingPSK = 0; int usingPSK = 0;
byte sessIdSz; byte sessIdSz = 0;
int wantDowngrade = 0; int wantDowngrade = 0;
WOLFSSL_START(WC_FUNC_CLIENT_HELLO_DO); WOLFSSL_START(WC_FUNC_CLIENT_HELLO_DO);
WOLFSSL_ENTER("DoTls13ClientHello"); WOLFSSL_ENTER("DoTls13ClientHello");
XMEMSET(&pv, 0, sizeof(ProtocolVersion));
XMEMSET(&clSuites, 0, sizeof(Suites));
#ifdef WOLFSSL_CALLBACKS #ifdef WOLFSSL_CALLBACKS
if (ssl->hsInfoOn) AddPacketName(ssl, "ClientHello"); if (ssl->hsInfoOn) AddPacketName(ssl, "ClientHello");
if (ssl->toInfoOn) AddLateName("ClientHello", &ssl->timeoutInfo); if (ssl->toInfoOn) AddLateName("ClientHello", &ssl->timeoutInfo);