summaryrefslogtreecommitdiff
path: root/src/common/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r--src/common/crypto.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index a5eb7b5c9a..e1094aec50 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -3459,3 +3459,15 @@ crypto_global_cleanup(void)
/** @} */
+#ifdef USE_DMALLOC
+/** Tell the crypto library to use Tor's allocation functions rather than
+ * calling libc's allocation functions directly. Return 0 on success, -1
+ * on failure. */
+int
+crypto_use_tor_alloc_functions(void)
+{
+ int r = CRYPTO_set_mem_ex_functions(tor_malloc_, tor_realloc_, tor_free_);
+ return r ? 0 : -1;
+}
+#endif
+