Fix build issues with new async changes. Fixed issue with unused args preSigSz and preSigIdx with PSK enabled and ECC + RSA disabled. Fixed issue with missing qsSz variable in DoClientKeyExchange. Fixed missing DhAgree and DhKeyGen with NO_CERTS and PSK enabled. Fixed a couple scan-build warnings with "Value stored to '' is never read".

This commit is contained in:
David Garske
2016-04-01 09:23:46 -07:00
parent 63b1282e67
commit dd28d53cfb
2 changed files with 20 additions and 14 deletions

View File

@ -2061,6 +2061,9 @@ int EccMakeTempKey(WOLFSSL* ssl)
#endif /* HAVE_ECC */ #endif /* HAVE_ECC */
#endif /* !NO_CERTS */
#if !defined(NO_CERTS) || !defined(NO_PSK)
#if !defined(NO_DH) #if !defined(NO_DH)
int DhGenKeyPair(WOLFSSL* ssl, int DhGenKeyPair(WOLFSSL* ssl,
@ -2145,8 +2148,8 @@ int DhAgree(WOLFSSL* ssl,
} }
#endif /* !NO_DH */ #endif /* !NO_DH */
#endif /* !NO_CERTS || !NO_PSK */
#endif /* NO_CERTS */
/* This function inherits a WOLFSSL_CTX's fields into an SSL object. /* This function inherits a WOLFSSL_CTX's fields into an SSL object.
@ -14445,6 +14448,13 @@ int DoSessionTicket(WOLFSSL* ssl,
word32 exportSz = 0; word32 exportSz = 0;
#endif #endif
#ifdef HAVE_QSH
word32 qshSz = 0;
if (ssl->peerQSHKeyPresent) {
qshSz = QSH_KeyGetSize(ssl);
}
#endif
(void)ssl; (void)ssl;
(void)sigSz; (void)sigSz;
@ -14602,14 +14612,9 @@ int DoSessionTicket(WOLFSSL* ssl,
case KEYSHARE_BUILD: case KEYSHARE_BUILD:
{ {
#if (!defined(NO_DH) && !defined(NO_RSA)) || defined(HAVE_ECC)
word32 preSigSz, preSigIdx; word32 preSigSz, preSigIdx;
#endif
#ifdef HAVE_QSH
word32 qshSz = 0;
if (ssl->peerQSHKeyPresent && ssl->options.haveQSH) {
qshSz = QSH_KeyGetSize(ssl);
}
#endif
switch(ssl->specs.kea) switch(ssl->specs.kea)
{ {
@ -14731,7 +14736,8 @@ int DoSessionTicket(WOLFSSL* ssl,
idx += LENGTH_SZ; idx += LENGTH_SZ;
XMEMCPY(output + idx, ssl->buffers.serverDH_Pub.buffer, XMEMCPY(output + idx, ssl->buffers.serverDH_Pub.buffer,
ssl->buffers.serverDH_Pub.length); ssl->buffers.serverDH_Pub.length);
idx += ssl->buffers.serverDH_Pub.length; /* No need to update idx, since sizes are already set */
/* idx += ssl->buffers.serverDH_Pub.length; */
break; break;
} }
#endif /* !defined(NO_DH) && !defined(NO_PSK) */ #endif /* !defined(NO_DH) && !defined(NO_PSK) */
@ -17441,7 +17447,6 @@ int DoSessionTicket(WOLFSSL* ssl,
{ {
#ifdef HAVE_QSH #ifdef HAVE_QSH
word16 name; word16 name;
int qshSz;
if (ssl->options.haveQSH) { if (ssl->options.haveQSH) {
/* extension name */ /* extension name */
@ -17449,6 +17454,7 @@ int DoSessionTicket(WOLFSSL* ssl,
idx += OPAQUE16_LEN; idx += OPAQUE16_LEN;
if (name == TLSX_QUANTUM_SAFE_HYBRID) { if (name == TLSX_QUANTUM_SAFE_HYBRID) {
int qshSz;
/* if qshSz is larger than 0 it is the /* if qshSz is larger than 0 it is the
length of buffer used */ length of buffer used */
if ((qshSz = TLSX_QSHCipher_Parse(ssl, if ((qshSz = TLSX_QSHCipher_Parse(ssl,

View File

@ -1391,16 +1391,16 @@ void bench_dh(void)
(void)tmp; (void)tmp;
#ifdef USE_CERT_BUFFERS_1024 #if defined(NO_ASN)
dhKeySz = 1024;
/* do nothing, but don't use default FILE */
#elif defined(USE_CERT_BUFFERS_1024)
tmp = dh_key_der_1024; tmp = dh_key_der_1024;
bytes = sizeof_dh_key_der_1024; bytes = sizeof_dh_key_der_1024;
dhKeySz = 1024; dhKeySz = 1024;
#elif defined(USE_CERT_BUFFERS_2048) #elif defined(USE_CERT_BUFFERS_2048)
tmp = dh_key_der_2048; tmp = dh_key_der_2048;
bytes = sizeof_dh_key_der_2048; bytes = sizeof_dh_key_der_2048;
#elif defined(NO_ASN)
dhKeySz = 1024;
/* do nothing, but don't use default FILE */
#else #else
#error "need to define a cert buffer size" #error "need to define a cert buffer size"
#endif /* USE_CERT_BUFFERS */ #endif /* USE_CERT_BUFFERS */