summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2017-04-10 16:47:08 +0000
committerjsing <>2017-04-10 16:47:08 +0000
commite72e6e8b3e034010045877652f0b5cdefc2a1d25 (patch)
tree584dabdd6a37ef6049e55ffc10649637e5fb6e3b
parente275c4cbf7151d136aea4305fa19fe5ce550bfbf (diff)
downloadopenbsd-e72e6e8b3e034010045877652f0b5cdefc2a1d25.tar.gz
openbsd-e72e6e8b3e034010045877652f0b5cdefc2a1d25.tar.bz2
openbsd-e72e6e8b3e034010045877652f0b5cdefc2a1d25.zip
Use freezero() for i2d_SSL_SESSION() - one line of code instead of three.
In this case the memory allocated can also be significant, in which case freezero() will have less overhead than explicit_bzero() (munmap instead of touching all of the memory to write zeros).
-rw-r--r--src/lib/libssl/ssl_asn1.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lib/libssl/ssl_asn1.c b/src/lib/libssl/ssl_asn1.c
index 4014bf6fe6..5110ca3cc8 100644
--- a/src/lib/libssl/ssl_asn1.c
+++ b/src/lib/libssl/ssl_asn1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_asn1.c,v 1.49 2017/02/07 02:08:38 beck Exp $ */ 1/* $OpenBSD: ssl_asn1.c,v 1.50 2017/04/10 16:47:08 jsing Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2016 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2016 Joel Sing <jsing@openbsd.org>
@@ -205,12 +205,9 @@ i2d_SSL_SESSION(SSL_SESSION *s, unsigned char **pp)
205 rv = (int)data_len; 205 rv = (int)data_len;
206 206
207 err: 207 err:
208 if (data != NULL)
209 explicit_bzero(data, data_len);
210
211 CBB_cleanup(&session); 208 CBB_cleanup(&session);
209 freezero(data, data_len);
212 free(peer_cert_bytes); 210 free(peer_cert_bytes);
213 free(data);
214 211
215 return rv; 212 return rv;
216} 213}