diff options
author | jsing <> | 2017-01-22 03:50:45 +0000 |
---|---|---|
committer | jsing <> | 2017-01-22 03:50:45 +0000 |
commit | da11794e3abdcddc9079bb28bb8e44547030b01f (patch) | |
tree | 1305cf6ae8a5e82d3473b44db775f816b47c9554 /src/lib/libssl/ssl_sess.c | |
parent | bcd4033a22e1bf44686805b7d0fd9c2560c44eb4 (diff) | |
download | openbsd-da11794e3abdcddc9079bb28bb8e44547030b01f.tar.gz openbsd-da11794e3abdcddc9079bb28bb8e44547030b01f.tar.bz2 openbsd-da11794e3abdcddc9079bb28bb8e44547030b01f.zip |
Convert publically visible structs to translucent structs.
This change adds an internal opaque struct for each of the significant
publically visible structs. The opaque struct is then allocated and
attached to the publically visible struct when the appropriate *_new()
function is called, then cleared and freed as necessary.
This will allow for changes to be made to the internals of libssl, without
requiring a major bump each time the publically visible structs are
modified.
ok beck@
Diffstat (limited to 'src/lib/libssl/ssl_sess.c')
-rw-r--r-- | src/lib/libssl/ssl_sess.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/lib/libssl/ssl_sess.c b/src/lib/libssl/ssl_sess.c index f6e2642aeb..0970633a86 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.53 2016/11/02 11:21:05 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_sess.c,v 1.54 2017/01/22 03:50:45 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 | * |
@@ -199,10 +199,14 @@ SSL_SESSION_new(void) | |||
199 | { | 199 | { |
200 | SSL_SESSION *ss; | 200 | SSL_SESSION *ss; |
201 | 201 | ||
202 | ss = calloc(1, sizeof(SSL_SESSION)); | 202 | if ((ss = calloc(1, sizeof(*ss))) == NULL) { |
203 | if (ss == NULL) { | ||
204 | SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE); | 203 | SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE); |
205 | return (0); | 204 | return (NULL); |
205 | } | ||
206 | if ((ss->internal = calloc(1, sizeof(*ss->internal))) == NULL) { | ||
207 | free(ss); | ||
208 | SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE); | ||
209 | return (NULL); | ||
206 | } | 210 | } |
207 | 211 | ||
208 | ss->verify_result = 1; /* avoid 0 (= X509_V_OK) just in case */ | 212 | ss->verify_result = 1; /* avoid 0 (= X509_V_OK) just in case */ |
@@ -706,6 +710,10 @@ SSL_SESSION_free(SSL_SESSION *ss) | |||
706 | free(ss->tlsext_ecpointformatlist); | 710 | free(ss->tlsext_ecpointformatlist); |
707 | ss->tlsext_ellipticcurvelist_length = 0; | 711 | ss->tlsext_ellipticcurvelist_length = 0; |
708 | free(ss->tlsext_ellipticcurvelist); | 712 | free(ss->tlsext_ellipticcurvelist); |
713 | |||
714 | explicit_bzero(ss->internal, sizeof(*ss->internal)); | ||
715 | free(ss->internal); | ||
716 | |||
709 | explicit_bzero(ss, sizeof(*ss)); | 717 | explicit_bzero(ss, sizeof(*ss)); |
710 | free(ss); | 718 | free(ss); |
711 | } | 719 | } |