summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2017-04-10 17:27:33 +0000
committerjsing <>2017-04-10 17:27:33 +0000
commit8bea6e7211234af80b7a52972d3c14596a38c767 (patch)
tree8385526871849725f6ed77516a693d277bbdfa91
parentc8368f35409fe0a4a05ea25108a4055d6082d923 (diff)
downloadopenbsd-8bea6e7211234af80b7a52972d3c14596a38c767.tar.gz
openbsd-8bea6e7211234af80b7a52972d3c14596a38c767.tar.bz2
openbsd-8bea6e7211234af80b7a52972d3c14596a38c767.zip
Use freezero() for the internal opaque structures, instead of the current
explicit_bzero()/free(). Less code and potentially less overhead.
-rw-r--r--src/lib/libssl/d1_lib.c9
-rw-r--r--src/lib/libssl/s3_lib.c9
-rw-r--r--src/lib/libssl/ssl_sess.c9
3 files changed, 9 insertions, 18 deletions
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c
index 8092d56a4c..7e919a6c9b 100644
--- a/src/lib/libssl/d1_lib.c
+++ b/src/lib/libssl/d1_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_lib.c,v 1.41 2017/02/07 02:08:38 beck Exp $ */ 1/* $OpenBSD: d1_lib.c,v 1.42 2017/04/10 17:27:33 jsing Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -191,11 +191,8 @@ dtls1_free(SSL *s)
191 pqueue_free(s->d1->sent_messages); 191 pqueue_free(s->d1->sent_messages);
192 pqueue_free(D1I(s)->buffered_app_data.q); 192 pqueue_free(D1I(s)->buffered_app_data.q);
193 193
194 explicit_bzero(s->d1->internal, sizeof(*s->d1->internal)); 194 freezero(s->d1->internal, sizeof(*s->d1->internal));
195 free(s->d1->internal); 195 freezero(s->d1, sizeof(*s->d1));
196
197 explicit_bzero(s->d1, sizeof(*s->d1));
198 free(s->d1);
199 196
200 s->d1 = NULL; 197 s->d1 = NULL;
201} 198}
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index 1fd077ec6e..d4142e743f 100644
--- a/src/lib/libssl/s3_lib.c
+++ b/src/lib/libssl/s3_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s3_lib.c,v 1.139 2017/04/10 17:25:22 jsing Exp $ */ 1/* $OpenBSD: s3_lib.c,v 1.140 2017/04/10 17:27:33 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 *
@@ -1844,11 +1844,8 @@ ssl3_free(SSL *s)
1844 1844
1845 free(S3I(s)->alpn_selected); 1845 free(S3I(s)->alpn_selected);
1846 1846
1847 explicit_bzero(S3I(s), sizeof(*S3I(s))); 1847 freezero(S3I(s), sizeof(*S3I(s)));
1848 free(S3I(s)); 1848 freezero(s->s3, sizeof(*s->s3));
1849
1850 explicit_bzero(s->s3, sizeof(*s->s3));
1851 free(s->s3);
1852 1849
1853 s->s3 = NULL; 1850 s->s3 = NULL;
1854} 1851}
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c
index 5d80e58196..59d7d9ec24 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.70 2017/02/07 02:08:38 beck Exp $ */ 1/* $OpenBSD: ssl_sess.c,v 1.71 2017/04/10 17:27:33 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 *
@@ -705,11 +705,8 @@ SSL_SESSION_free(SSL_SESSION *ss)
705 free(ss->internal->tlsext_ecpointformatlist); 705 free(ss->internal->tlsext_ecpointformatlist);
706 free(ss->internal->tlsext_supportedgroups); 706 free(ss->internal->tlsext_supportedgroups);
707 707
708 explicit_bzero(ss->internal, sizeof(*ss->internal)); 708 freezero(ss->internal, sizeof(*ss->internal));
709 free(ss->internal); 709 freezero(ss, sizeof(*ss));
710
711 explicit_bzero(ss, sizeof(*ss));
712 free(ss);
713} 710}
714 711
715int 712int