forked from wolfSSL/wolfssl
warning from windows build with ECDHE-PSK and fix potential memory leak
This commit is contained in:
@@ -13008,20 +13008,28 @@ static word32 QSH_KeyExchangeWrite(WOLFSSL* ssl, byte isServer)
|
||||
|
||||
/* Place ECC key in output buffer, leaving room for size */
|
||||
ret = wc_ecc_export_x963(&myKey, es + 1, &size);
|
||||
*es = size; /* place size of key in output buffer */
|
||||
*es = (byte)size; /* place size of key in output buffer */
|
||||
encSz += size + 1;
|
||||
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(encSecret, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
ret = ECC_EXPORT_ERROR;
|
||||
}
|
||||
else {
|
||||
size = sizeof(ssl->arrays->preMasterSecret);
|
||||
/* Create shared ECC key leaveing room at the begining
|
||||
of buffer for size of shared key */
|
||||
ret = wc_ecc_shared_secret(&myKey, peerKey,
|
||||
ssl->arrays->preMasterSecret + OPAQUE16_LEN, &size);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(encSecret, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
ret = ECC_SHARED_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
wc_ecc_free(&myKey);
|
||||
if (ret != 0) {
|
||||
|
Reference in New Issue
Block a user