aboutsummaryrefslogtreecommitdiff
path: root/src/lib/tls
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-11-09 15:01:49 -0500
committerNick Mathewson <nickm@torproject.org>2018-11-09 15:01:49 -0500
commitbf4f55a13da783083b0c76decd6ebf475a63ebd0 (patch)
tree15ebd3463fc900d52cd3065b6c83cf83a364e3e7 /src/lib/tls
parent5d73f87cedaf58fd6e7a53a230b311f5e8b51b73 (diff)
parent60d10812368458cb88aa9f9d628c49766d4bb490 (diff)
downloadtor-bf4f55a13da783083b0c76decd6ebf475a63ebd0.tar.gz
tor-bf4f55a13da783083b0c76decd6ebf475a63ebd0.zip
Merge branch 'subsystems'
Diffstat (limited to 'src/lib/tls')
-rw-r--r--src/lib/tls/.may_include1
-rw-r--r--src/lib/tls/include.am1
-rw-r--r--src/lib/tls/tortls.c14
-rw-r--r--src/lib/tls/tortls_sys.h14
4 files changed, 30 insertions, 0 deletions
diff --git a/src/lib/tls/.may_include b/src/lib/tls/.may_include
index 2840e590b8..79301bc318 100644
--- a/src/lib/tls/.may_include
+++ b/src/lib/tls/.may_include
@@ -11,6 +11,7 @@ lib/log/*.h
lib/malloc/*.h
lib/net/*.h
lib/string/*.h
+lib/subsys/*.h
lib/testsupport/testsupport.h
lib/tls/*.h
diff --git a/src/lib/tls/include.am b/src/lib/tls/include.am
index a664b29fb2..1817739eef 100644
--- a/src/lib/tls/include.am
+++ b/src/lib/tls/include.am
@@ -36,5 +36,6 @@ noinst_HEADERS += \
src/lib/tls/tortls.h \
src/lib/tls/tortls_internal.h \
src/lib/tls/tortls_st.h \
+ src/lib/tls/tortls_sys.h \
src/lib/tls/x509.h \
src/lib/tls/x509_internal.h
diff --git a/src/lib/tls/tortls.c b/src/lib/tls/tortls.c
index 56f70bc371..654cacacf7 100644
--- a/src/lib/tls/tortls.c
+++ b/src/lib/tls/tortls.c
@@ -7,6 +7,7 @@
#define TOR_X509_PRIVATE
#include "lib/tls/x509.h"
#include "lib/tls/x509_internal.h"
+#include "lib/tls/tortls_sys.h"
#include "lib/tls/tortls.h"
#include "lib/tls/tortls_st.h"
#include "lib/tls/tortls_internal.h"
@@ -15,6 +16,7 @@
#include "lib/crypt_ops/crypto_rsa.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/net/socket.h"
+#include "lib/subsys/subsys.h"
#ifdef _WIN32
#include <winsock2.h>
@@ -440,3 +442,15 @@ tor_tls_verify(int severity, tor_tls_t *tls, crypto_pk_t **identity)
return rv;
}
+
+static void
+subsys_tortls_shutdown(void)
+{
+ tor_tls_free_all();
+}
+
+const subsys_fns_t sys_tortls = {
+ .name = "tortls",
+ .level = -50,
+ .shutdown = subsys_tortls_shutdown
+};
diff --git a/src/lib/tls/tortls_sys.h b/src/lib/tls/tortls_sys.h
new file mode 100644
index 0000000000..fd909f6019
--- /dev/null
+++ b/src/lib/tls/tortls_sys.h
@@ -0,0 +1,14 @@
+/* Copyright (c) 2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file tortls_sys.h
+ * \brief Declare subsystem object for the tortls module
+ **/
+
+#ifndef TOR_TORTLS_SYS_H
+#define TOR_TORTLS_SYS_H
+
+extern const struct subsys_fns_t sys_tortls;
+
+#endif /* !defined(TOR_TORTLS_SYS_H) */