summaryrefslogtreecommitdiff
path: root/src/lib/crypt_ops/crypto_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/crypt_ops/crypto_util.c')
-rw-r--r--src/lib/crypt_ops/crypto_util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/crypt_ops/crypto_util.c b/src/lib/crypt_ops/crypto_util.c
index 60e81af165..7ebb860d09 100644
--- a/src/lib/crypt_ops/crypto_util.c
+++ b/src/lib/crypt_ops/crypto_util.c
@@ -107,3 +107,17 @@ memwipe(void *mem, uint8_t byte, size_t sz)
**/
memset(mem, byte, sz);
}
+
+/**
+ * Securely all memory in <b>str</b>, then free it.
+ *
+ * As tor_free(), tolerates null pointers.
+ **/
+void
+tor_str_wipe_and_free_(char *str)
+{
+ if (!str)
+ return;
+ memwipe(str, 0, strlen(str));
+ tor_free_(str);
+}