15 #define CRYPTO_PRIVATE
32 #include "ext/siphash.h"
40 static int have_seeded_siphash = 0;
47 if (have_seeded_siphash)
51 siphash_set_global_key(&key);
52 have_seeded_siphash = 1;
69 crypto_nss_early_init(0);
107 if (crypto_nss_late_init() < 0)
118 #ifdef ENABLE_OPENSSL
131 crypto_dh_free_all();
133 #ifdef ENABLE_OPENSSL
137 crypto_nss_global_cleanup();
144 have_seeded_siphash = 0;
145 siphash_unset_global_key();
156 crypto_nss_prefork();
172 crypto_nss_postfork();
180 #ifdef ENABLE_OPENSSL
193 #ifdef ENABLE_OPENSSL
194 return crypto_openssl_get_version_str();
197 return crypto_nss_get_version_str();
206 #ifdef ENABLE_OPENSSL
207 return crypto_openssl_get_header_version_str();
210 return crypto_nss_get_header_version_str();
226 subsys_crypto_initialize(
void)
235 subsys_crypto_shutdown(
void)
241 subsys_crypto_prefork(
void)
247 subsys_crypto_postfork(
void)
253 subsys_crypto_thread_cleanup(
void)
259 #define CRYPTO_OPTIONS_MAGIC 0x68757368
273 *msg_out = tor_strdup(
"Can't use hardware crypto accelerator dir "
274 "without engine name.");
282 #define CONF_CONTEXT LL_TABLE
291 .magic = {
"crypto_options_t",
294 .vars = crypto_options_t_vars,
312 log_err(
LD_BUG,
"Unable to initialize the crypto subsystem. Exiting.");
323 .initialize = subsys_crypto_initialize,
324 .shutdown = subsys_crypto_shutdown,
325 .prefork = subsys_crypto_prefork,
326 .postfork = subsys_crypto_postfork,
327 .thread_cleanup = subsys_crypto_thread_cleanup,
Types used to specify configurable options.
void curve25519_init(void)
Header for crypto_curve25519.c.
Header for crypto_ed25519.c.
const char * crypto_get_library_name(void)
int crypto_global_cleanup(void)
const char * crypto_get_library_version_string(void)
static int crypto_options_validate(const void *arg, char **msg_out)
void crypto_postfork(void)
int crypto_init_siphash_key(void)
#define CRYPTO_OPTIONS_MAGIC
int crypto_early_init(void)
const char * crypto_get_header_version_string(void)
void crypto_thread_cleanup(void)
int crypto_global_init(int useAccel, const char *accelName, const char *accelDir)
static const config_format_t crypto_options_fmt
static int crypto_set_options(void *arg)
static int crypto_early_initialized_
void crypto_prefork(void)
static int crypto_global_initialized_
int tor_is_using_nss(void)
Headers for crypto_init.c.
Headers for crypto_nss_mgt.c.
void crypto_openssl_early_init(void)
void crypto_openssl_thread_cleanup(void)
int crypto_openssl_late_init(int useAccel, const char *accelName, const char *accelDir)
void crypto_openssl_global_cleanup(void)
Headers for crypto_openssl_mgt.c.
Declare configuration options for the crypto_ops module.
Header for lib/crypt_ops/crypto_options_st.c.
int crypto_seed_rng(void)
void crypto_rand(char *to, size_t n)
Common functions for using (pseudo-)random number generators.
void destroy_thread_fast_rng(void)
void crypto_rand_fast_init(void)
void crypto_rand_fast_shutdown(void)
Declare subsystem object for the crypto module.
Types used to declare a subsystem.
#define SUBSYS_DECLARE_LOCATION()
Macros to manage assertions, fatal and non-fatal.