mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 19:54:40 +02:00
Fix DTLS server memory leak, ssn11
This commit is contained in:
@@ -9441,7 +9441,8 @@ int SetCipherList(Suites* s, const char* list)
|
||||
|
||||
ssl->options.haveSessionId = 1;
|
||||
/* ProcessOld uses same resume code */
|
||||
if (ssl->options.resuming) { /* let's try */
|
||||
if (ssl->options.resuming && (!ssl->options.dtls ||
|
||||
ssl->options.acceptState == HELLO_VERIFY_SENT)) { /* let's try */
|
||||
int ret = -1;
|
||||
CYASSL_SESSION* session = GetSession(ssl,ssl->arrays->masterSecret);
|
||||
if (!session) {
|
||||
|
36
src/keys.c
36
src/keys.c
@@ -1421,9 +1421,11 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
#ifdef BUILD_ARC4
|
||||
word32 sz = specs->key_size;
|
||||
if (specs->bulk_cipher_algorithm == rc4) {
|
||||
if (enc->arc4 == NULL)
|
||||
enc->arc4 = (Arc4*)XMALLOC(sizeof(Arc4), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->arc4 == NULL)
|
||||
return MEMORY_E;
|
||||
if (dec->arc4 == NULL)
|
||||
dec->arc4 = (Arc4*)XMALLOC(sizeof(Arc4), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->arc4 == NULL)
|
||||
return MEMORY_E;
|
||||
@@ -1455,10 +1457,14 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
#ifdef HAVE_HC128
|
||||
if (specs->bulk_cipher_algorithm == hc128) {
|
||||
int hcRet;
|
||||
enc->hc128 = (HC128*)XMALLOC(sizeof(HC128), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->hc128 == NULL)
|
||||
enc->hc128 =
|
||||
(HC128*)XMALLOC(sizeof(HC128), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->hc128 == NULL)
|
||||
return MEMORY_E;
|
||||
dec->hc128 = (HC128*)XMALLOC(sizeof(HC128), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->hc128 == NULL)
|
||||
dec->hc128 =
|
||||
(HC128*)XMALLOC(sizeof(HC128), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->hc128 == NULL)
|
||||
return MEMORY_E;
|
||||
if (side == CLIENT_END) {
|
||||
@@ -1485,10 +1491,14 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
#ifdef BUILD_RABBIT
|
||||
if (specs->bulk_cipher_algorithm == rabbit) {
|
||||
int rabRet;
|
||||
enc->rabbit = (Rabbit*)XMALLOC(sizeof(Rabbit),heap,DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->rabbit == NULL)
|
||||
enc->rabbit =
|
||||
(Rabbit*)XMALLOC(sizeof(Rabbit), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->rabbit == NULL)
|
||||
return MEMORY_E;
|
||||
dec->rabbit = (Rabbit*)XMALLOC(sizeof(Rabbit),heap,DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->rabbit == NULL)
|
||||
dec->rabbit =
|
||||
(Rabbit*)XMALLOC(sizeof(Rabbit), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->rabbit == NULL)
|
||||
return MEMORY_E;
|
||||
if (side == CLIENT_END) {
|
||||
@@ -1514,9 +1524,11 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
|
||||
#ifdef BUILD_DES3
|
||||
if (specs->bulk_cipher_algorithm == triple_des) {
|
||||
if (enc->des3 == NULL)
|
||||
enc->des3 = (Des3*)XMALLOC(sizeof(Des3), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->des3 == NULL)
|
||||
return MEMORY_E;
|
||||
if (dec->des3 == NULL)
|
||||
dec->des3 = (Des3*)XMALLOC(sizeof(Des3), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->des3 == NULL)
|
||||
return MEMORY_E;
|
||||
@@ -1551,9 +1563,11 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
|
||||
#ifdef BUILD_AES
|
||||
if (specs->bulk_cipher_algorithm == aes) {
|
||||
if (enc->aes == NULL)
|
||||
enc->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->aes == NULL)
|
||||
return MEMORY_E;
|
||||
if (dec->aes == NULL)
|
||||
dec->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->aes == NULL)
|
||||
return MEMORY_E;
|
||||
@@ -1592,9 +1606,11 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
|
||||
#ifdef BUILD_AESGCM
|
||||
if (specs->bulk_cipher_algorithm == aes_gcm) {
|
||||
if (enc->aes == NULL)
|
||||
enc->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->aes == NULL)
|
||||
return MEMORY_E;
|
||||
if (dec->aes == NULL)
|
||||
dec->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->aes == NULL)
|
||||
return MEMORY_E;
|
||||
@@ -1622,9 +1638,11 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
|
||||
#ifdef HAVE_AESCCM
|
||||
if (specs->bulk_cipher_algorithm == aes_ccm) {
|
||||
if (enc->aes == NULL)
|
||||
enc->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->aes == NULL)
|
||||
return MEMORY_E;
|
||||
if (dec->aes == NULL)
|
||||
dec->aes = (Aes*)XMALLOC(sizeof(Aes), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->aes == NULL)
|
||||
return MEMORY_E;
|
||||
@@ -1652,12 +1670,14 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
|
||||
#ifdef HAVE_CAMELLIA
|
||||
if (specs->bulk_cipher_algorithm == camellia) {
|
||||
enc->cam = (Camellia*)XMALLOC(sizeof(Camellia),
|
||||
heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->cam == NULL)
|
||||
enc->cam =
|
||||
(Camellia*)XMALLOC(sizeof(Camellia), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (enc->cam == NULL)
|
||||
return MEMORY_E;
|
||||
dec->cam = (Camellia*)XMALLOC(sizeof(Camellia),
|
||||
heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->cam == NULL)
|
||||
dec->cam =
|
||||
(Camellia*)XMALLOC(sizeof(Camellia), heap, DYNAMIC_TYPE_CIPHER);
|
||||
if (dec->cam == NULL)
|
||||
return MEMORY_E;
|
||||
if (side == CLIENT_END) {
|
||||
|
Reference in New Issue
Block a user