summaryrefslogtreecommitdiff
path: root/src/common/tortls.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-11-07 16:09:58 -0500
committerNick Mathewson <nickm@torproject.org>2012-11-08 16:44:50 -0500
commit49dd5ef3a3d1775fdc3c0a7d069d3097b3baeeec (patch)
tree7189ed200ae8f47bf7d3399d0b99243dc93bced3 /src/common/tortls.c
parent758428dd32128874cefacc92ef63c1b5bc9a656e (diff)
downloadtor-49dd5ef3a3d1775fdc3c0a7d069d3097b3baeeec.tar.gz
tor-49dd5ef3a3d1775fdc3c0a7d069d3097b3baeeec.zip
Add and use and unlikely-to-be-eliminated memwipe()
Apparently some compilers like to eliminate memset() operations on data that's about to go out-of-scope. I've gone with the safest possible replacement, which might be a bit slow. I don't think this is critical path in any way that will affect performance, but if it is, we can work on that in 0.2.4. Fixes bug 7352.
Diffstat (limited to 'src/common/tortls.c')
-rw-r--r--src/common/tortls.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c
index bec2c71232..60aac64929 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -713,7 +713,7 @@ tor_cert_free(tor_cert_t *cert)
if (cert->cert)
X509_free(cert->cert);
tor_free(cert->encoded);
- memset(cert, 0x03, sizeof(*cert));
+ memwipe(cert, 0x03, sizeof(*cert));
tor_free(cert);
}
@@ -2448,7 +2448,7 @@ tor_tls_get_tlssecrets(tor_tls_t *tls, uint8_t *secrets_out)
(char*)tls->ssl->session->master_key,
tls->ssl->session->master_key_length,
buf, len);
- memset(buf, 0, sizeof(buf));
+ memwipe(buf, 0, sizeof(buf));
return 0;
}