Merge pull request #1109 from JacobBarthelmeh/Testing

fix check on ephemeral key type before free'ing
This commit is contained in:
toddouska
2017-08-18 11:53:08 -07:00
committed by GitHub
2 changed files with 6 additions and 4 deletions

View File

@ -4811,7 +4811,8 @@ void SSL_ResourceFree(WOLFSSL* ssl)
FreeKey(ssl, DYNAMIC_TYPE_ECC, (void**)&ssl->peerEccDsaKey);
ssl->peerEccDsaKeyPresent = 0;
#ifdef HAVE_CURVE25519
if (!ssl->peerX25519KeyPresent)
if (!ssl->peerX25519KeyPresent &&
ssl->eccTempKeyPresent != DYNAMIC_TYPE_CURVE25519)
#endif /* HAVE_CURVE25519 */
{
FreeKey(ssl, DYNAMIC_TYPE_ECC, (void**)&ssl->eccTempKey);
@ -20693,7 +20694,8 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
ret = X25519MakeKey(ssl,
(curve25519_key*)ssl->eccTempKey, NULL);
if (ret == 0 || ret == WC_PENDING_E) {
ssl->eccTempKeyPresent = 1;
ssl->eccTempKeyPresent =
DYNAMIC_TYPE_CURVE25519;
}
}
break;
@ -20715,7 +20717,7 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
then we know curve dp */
ret = EccMakeKey(ssl, ssl->eccTempKey, NULL);
if (ret == 0 || ret == WC_PENDING_E) {
ssl->eccTempKeyPresent = 1;
ssl->eccTempKeyPresent = DYNAMIC_TYPE_ECC;
}
}
#endif

View File

@ -3312,7 +3312,7 @@ struct WOLFSSL {
#if defined(HAVE_ECC) || defined(HAVE_CURVE25519)
word32 ecdhCurveOID; /* curve Ecc_Sum */
ecc_key* eccTempKey; /* private ECDHE key */
byte eccTempKeyPresent;
byte eccTempKeyPresent; /* also holds type */
byte peerEccKeyPresent;
#endif
#ifdef HAVE_ECC