Make tortls use the subsystems interface

This one only needs a shutdown right now.
This commit is contained in:
Nick Mathewson 2018-11-02 18:46:35 -04:00
parent 019a044e5e
commit 32b23a4c40
6 changed files with 26 additions and 1 deletions

View File

@ -776,7 +776,6 @@ tor_free_all(int postfork)
policies_free_all();
}
if (!postfork) {
tor_tls_free_all();
#ifndef _WIN32
tor_getpwnam(NULL);
#endif

View File

@ -16,6 +16,7 @@
#include "lib/process/winprocess_sys.h"
#include "lib/thread/thread_sys.h"
#include "lib/time/time_sys.h"
#include "lib/tls/tortls_sys.h"
#include "lib/wallclock/wallclock_sys.h"
#include <stddef.h>
@ -33,6 +34,7 @@ const subsys_fns_t *tor_subsystems[] = {
&sys_network,
&sys_compress,
&sys_crypto,
&sys_tortls,
};
const unsigned n_tor_subsystems = ARRAY_LENGTH(tor_subsystems);

View File

@ -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

View File

@ -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

View File

@ -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,9 @@ tor_tls_verify(int severity, tor_tls_t *tls, crypto_pk_t **identity)
return rv;
}
const subsys_fns_t sys_tortls = {
.name = "tortls",
.level = -50,
.shutdown = tor_tls_free_all
};

14
src/lib/tls/tortls_sys.h Normal file
View File

@ -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) */