summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorjsing <>2017-01-24 01:44:00 +0000
committerjsing <>2017-01-24 01:44:00 +0000
commit3081f3692fb8e5bf49e152a7ae9b9ff9c9fc674a (patch)
tree638752c6b1feb5f40f8bff8667fcb28a69488e92 /src/lib
parent71e6acb0d65f7db5b5d23d22c0a5eaf2fd76d0c4 (diff)
downloadopenbsd-3081f3692fb8e5bf49e152a7ae9b9ff9c9fc674a.tar.gz
openbsd-3081f3692fb8e5bf49e152a7ae9b9ff9c9fc674a.tar.bz2
openbsd-3081f3692fb8e5bf49e152a7ae9b9ff9c9fc674a.zip
sk_SSL_CIPHER_free() checks for NULL so do not bother doing the same from
the callers.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libssl/s3_srvr.c16
-rw-r--r--src/lib/libssl/ssl_ciph.c8
-rw-r--r--src/lib/libssl/ssl_lib.c14
-rw-r--r--src/lib/libssl/ssl_sess.c5
4 files changed, 16 insertions, 27 deletions
diff --git a/src/lib/libssl/s3_srvr.c b/src/lib/libssl/s3_srvr.c
index 4c6caf0eed..ef37862091 100644
--- a/src/lib/libssl/s3_srvr.c
+++ b/src/lib/libssl/s3_srvr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_srvr.c,v 1.150 2017/01/23 14:35:42 jsing Exp $ */ 1/* $OpenBSD: s3_srvr.c,v 1.151 2017/01/24 01:44:00 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1002,11 +1002,8 @@ ssl3_get_client_hello(SSL *s)
1002 1002
1003 s->session->cipher = pref_cipher; 1003 s->session->cipher = pref_cipher;
1004 1004
1005 if (s->cipher_list) 1005 sk_SSL_CIPHER_free(s->cipher_list);
1006 sk_SSL_CIPHER_free(s->cipher_list); 1006 sk_SSL_CIPHER_free(s->internal->cipher_list_by_id);
1007
1008 if (s->internal->cipher_list_by_id)
1009 sk_SSL_CIPHER_free(s->internal->cipher_list_by_id);
1010 1007
1011 s->cipher_list = sk_SSL_CIPHER_dup(s->session->ciphers); 1008 s->cipher_list = sk_SSL_CIPHER_dup(s->session->ciphers);
1012 s->internal->cipher_list_by_id = 1009 s->internal->cipher_list_by_id =
@@ -1020,8 +1017,7 @@ ssl3_get_client_hello(SSL *s)
1020 */ 1017 */
1021 1018
1022 if (!s->internal->hit) { 1019 if (!s->internal->hit) {
1023 if (s->session->ciphers != NULL) 1020 sk_SSL_CIPHER_free(s->session->ciphers);
1024 sk_SSL_CIPHER_free(s->session->ciphers);
1025 s->session->ciphers = ciphers; 1021 s->session->ciphers = ciphers;
1026 if (ciphers == NULL) { 1022 if (ciphers == NULL) {
1027 al = SSL_AD_ILLEGAL_PARAMETER; 1023 al = SSL_AD_ILLEGAL_PARAMETER;
@@ -1081,8 +1077,8 @@ f_err:
1081 ssl3_send_alert(s, SSL3_AL_FATAL, al); 1077 ssl3_send_alert(s, SSL3_AL_FATAL, al);
1082 } 1078 }
1083err: 1079err:
1084 if (ciphers != NULL) 1080 sk_SSL_CIPHER_free(ciphers);
1085 sk_SSL_CIPHER_free(ciphers); 1081
1086 return (ret); 1082 return (ret);
1087} 1083}
1088 1084
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c
index af5c83fcaf..5a5bb165d8 100644
--- a/src/lib/libssl/ssl_ciph.c
+++ b/src/lib/libssl/ssl_ciph.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_ciph.c,v 1.89 2016/11/06 12:08:32 jsing Exp $ */ 1/* $OpenBSD: ssl_ciph.c,v 1.90 2017/01/24 01:44:00 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1516,11 +1516,9 @@ ssl_create_cipher_list(const SSL_METHOD *ssl_method,
1516 sk_SSL_CIPHER_free(cipherstack); 1516 sk_SSL_CIPHER_free(cipherstack);
1517 return NULL; 1517 return NULL;
1518 } 1518 }
1519 if (*cipher_list != NULL) 1519 sk_SSL_CIPHER_free(*cipher_list);
1520 sk_SSL_CIPHER_free(*cipher_list);
1521 *cipher_list = cipherstack; 1520 *cipher_list = cipherstack;
1522 if (*cipher_list_by_id != NULL) 1521 sk_SSL_CIPHER_free(*cipher_list_by_id);
1523 sk_SSL_CIPHER_free(*cipher_list_by_id);
1524 *cipher_list_by_id = tmp_cipher_list; 1522 *cipher_list_by_id = tmp_cipher_list;
1525 (void)sk_SSL_CIPHER_set_cmp_func(*cipher_list_by_id, 1523 (void)sk_SSL_CIPHER_set_cmp_func(*cipher_list_by_id,
1526 ssl_cipher_ptr_id_cmp); 1524 ssl_cipher_ptr_id_cmp);
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 7f49648611..01041146b7 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.141 2017/01/23 22:34:38 beck Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.142 2017/01/24 01:44:00 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -516,10 +516,8 @@ SSL_free(SSL *s)
516 BUF_MEM_free(s->internal->init_buf); 516 BUF_MEM_free(s->internal->init_buf);
517 517
518 /* add extra stuff */ 518 /* add extra stuff */
519 if (s->cipher_list != NULL) 519 sk_SSL_CIPHER_free(s->cipher_list);
520 sk_SSL_CIPHER_free(s->cipher_list); 520 sk_SSL_CIPHER_free(s->internal->cipher_list_by_id);
521 if (s->internal->cipher_list_by_id != NULL)
522 sk_SSL_CIPHER_free(s->internal->cipher_list_by_id);
523 521
524 /* Make the next call work :-) */ 522 /* Make the next call work :-) */
525 if (s->session != NULL) { 523 if (s->session != NULL) {
@@ -1985,10 +1983,8 @@ SSL_CTX_free(SSL_CTX *a)
1985 1983
1986 if (a->cert_store != NULL) 1984 if (a->cert_store != NULL)
1987 X509_STORE_free(a->cert_store); 1985 X509_STORE_free(a->cert_store);
1988 if (a->cipher_list != NULL) 1986 sk_SSL_CIPHER_free(a->cipher_list);
1989 sk_SSL_CIPHER_free(a->cipher_list); 1987 sk_SSL_CIPHER_free(a->internal->cipher_list_by_id);
1990 if (a->internal->cipher_list_by_id != NULL)
1991 sk_SSL_CIPHER_free(a->internal->cipher_list_by_id);
1992 if (a->internal->cert != NULL) 1988 if (a->internal->cert != NULL)
1993 ssl_cert_free(a->internal->cert); 1989 ssl_cert_free(a->internal->cert);
1994 if (a->internal->client_CA != NULL) 1990 if (a->internal->client_CA != NULL)
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c
index 2ebdf81b41..307c730e3f 100644
--- a/src/lib/libssl/ssl_sess.c
+++ b/src/lib/libssl/ssl_sess.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_sess.c,v 1.65 2017/01/24 01:39:13 jsing Exp $ */ 1/* $OpenBSD: ssl_sess.c,v 1.66 2017/01/24 01:44:00 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -704,8 +704,7 @@ SSL_SESSION_free(SSL_SESSION *ss)
704 704
705 X509_free(ss->peer); 705 X509_free(ss->peer);
706 706
707 if (ss->ciphers != NULL) 707 sk_SSL_CIPHER_free(ss->ciphers);
708 sk_SSL_CIPHER_free(ss->ciphers);
709 708
710 free(ss->tlsext_hostname); 709 free(ss->tlsext_hostname);
711 free(ss->tlsext_tick); 710 free(ss->tlsext_tick);