diff options
Diffstat (limited to 'src/lib/libssl/ssl_sess.c')
-rw-r--r-- | src/lib/libssl/ssl_sess.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c index 664f8c2230..a505e388fb 100644 --- a/src/lib/libssl/ssl_sess.c +++ b/src/lib/libssl/ssl_sess.c | |||
@@ -308,9 +308,12 @@ int ssl_get_prev_session(SSL *s, unsigned char *session_id, int len) | |||
308 | if (copy) | 308 | if (copy) |
309 | CRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION); | 309 | CRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION); |
310 | 310 | ||
311 | /* The following should not return 1, otherwise, | 311 | /* Add the externally cached session to the internal |
312 | * things are very strange */ | 312 | * cache as well if and only if we are supposed to. */ |
313 | SSL_CTX_add_session(s->ctx,ret); | 313 | if(!(s->ctx->session_cache_mode & SSL_SESS_CACHE_NO_INTERNAL_STORE)) |
314 | /* The following should not return 1, otherwise, | ||
315 | * things are very strange */ | ||
316 | SSL_CTX_add_session(s->ctx,ret); | ||
314 | } | 317 | } |
315 | if (ret == NULL) | 318 | if (ret == NULL) |
316 | goto err; | 319 | goto err; |
@@ -524,13 +527,13 @@ void SSL_SESSION_free(SSL_SESSION *ss) | |||
524 | 527 | ||
525 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data); | 528 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data); |
526 | 529 | ||
527 | memset(ss->key_arg,0,SSL_MAX_KEY_ARG_LENGTH); | 530 | OPENSSL_cleanse(ss->key_arg,sizeof ss->key_arg); |
528 | memset(ss->master_key,0,SSL_MAX_MASTER_KEY_LENGTH); | 531 | OPENSSL_cleanse(ss->master_key,sizeof ss->master_key); |
529 | memset(ss->session_id,0,SSL_MAX_SSL_SESSION_ID_LENGTH); | 532 | OPENSSL_cleanse(ss->session_id,sizeof ss->session_id); |
530 | if (ss->sess_cert != NULL) ssl_sess_cert_free(ss->sess_cert); | 533 | if (ss->sess_cert != NULL) ssl_sess_cert_free(ss->sess_cert); |
531 | if (ss->peer != NULL) X509_free(ss->peer); | 534 | if (ss->peer != NULL) X509_free(ss->peer); |
532 | if (ss->ciphers != NULL) sk_SSL_CIPHER_free(ss->ciphers); | 535 | if (ss->ciphers != NULL) sk_SSL_CIPHER_free(ss->ciphers); |
533 | memset(ss,0,sizeof(*ss)); | 536 | OPENSSL_cleanse(ss,sizeof(*ss)); |
534 | OPENSSL_free(ss); | 537 | OPENSSL_free(ss); |
535 | } | 538 | } |
536 | 539 | ||