Tor
0.4.7.0-alpha-dev
|
Initialize and shut down Tor's crypto library and subsystem. More...
#include "orconfig.h"
#include "lib/crypt_ops/crypto_init.h"
#include "lib/crypt_ops/crypto_curve25519.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "lib/crypt_ops/crypto_ed25519.h"
#include "lib/crypt_ops/crypto_openssl_mgt.h"
#include "lib/crypt_ops/crypto_nss_mgt.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_sys.h"
#include "lib/crypt_ops/crypto_options_st.h"
#include "lib/conf/conftypes.h"
#include "lib/log/util_bug.h"
#include "lib/subsys/subsys.h"
#include "ext/siphash.h"
#include "lib/crypt_ops/crypto_options.inc"
Go to the source code of this file.
Macros | |
#define | CRYPTO_PRIVATE |
#define | CRYPTO_OPTIONS_MAGIC 0x68757368 |
#define | CONF_CONTEXT LL_TABLE |
Functions | |
int | crypto_init_siphash_key (void) |
int | crypto_early_init (void) |
int | crypto_global_init (int useAccel, const char *accelName, const char *accelDir) |
void | crypto_thread_cleanup (void) |
int | crypto_global_cleanup (void) |
void | crypto_prefork (void) |
void | crypto_postfork (void) |
const char * | crypto_get_library_name (void) |
const char * | crypto_get_library_version_string (void) |
const char * | crypto_get_header_version_string (void) |
int | tor_is_using_nss (void) |
static int | subsys_crypto_initialize (void) |
static void | subsys_crypto_shutdown (void) |
static void | subsys_crypto_prefork (void) |
static void | subsys_crypto_postfork (void) |
static void | subsys_crypto_thread_cleanup (void) |
static int | crypto_options_validate (const void *arg, char **msg_out) |
static int | crypto_set_options (void *arg) |
Variables | |
static int | crypto_early_initialized_ = 0 |
static int | crypto_global_initialized_ = 0 |
static int | have_seeded_siphash = 0 |
static const config_format_t | crypto_options_fmt |
const struct subsys_fns_t | sys_crypto |
Initialize and shut down Tor's crypto library and subsystem.
Definition in file crypto_init.c.
#define CRYPTO_OPTIONS_MAGIC 0x68757368 |
Magic number for crypto_options_t.
Definition at line 259 of file crypto_init.c.
int crypto_early_init | ( | void | ) |
Initialize the crypto library. Return 0 on success, -1 on failure.
Definition at line 59 of file crypto_init.c.
Referenced by crypto_global_init().
const char* crypto_get_header_version_string | ( | void | ) |
Return the version of the crypto library we're using, as given in the headers.
Definition at line 204 of file crypto_init.c.
const char* crypto_get_library_name | ( | void | ) |
Return the name of the crypto library we're using.
Definition at line 178 of file crypto_init.c.
Referenced by options_init_from_torrc().
const char* crypto_get_library_version_string | ( | void | ) |
Return the version of the crypto library we are using, as given in the library.
Definition at line 191 of file crypto_init.c.
Referenced by options_init_from_torrc().
int crypto_global_cleanup | ( | void | ) |
Uninitialize the crypto library. Return 0 on success. Does not detect failure.
Definition at line 129 of file crypto_init.c.
int crypto_global_init | ( | int | useAccel, |
const char * | accelName, | ||
const char * | accelDir | ||
) |
Initialize the crypto library. Return 0 on success, -1 on failure.
Definition at line 88 of file crypto_init.c.
Referenced by crypto_set_options().
int crypto_init_siphash_key | ( | void | ) |
Set up the siphash key if we haven't already done so.
Definition at line 44 of file crypto_init.c.
|
static |
Return 0 if arg is a valid crypto_options_t. Otherwise return -1 and set *msg_out to a freshly allocated error string.
Definition at line 266 of file crypto_init.c.
void crypto_postfork | ( | void | ) |
Run operations that the crypto library requires to be happy again after forking.
Definition at line 169 of file crypto_init.c.
void crypto_prefork | ( | void | ) |
Run operations that the crypto library requires to be happy again after forking.
Definition at line 153 of file crypto_init.c.
|
static |
Invoked from subsysmgr.c when a new set of options arrives.
Definition at line 302 of file crypto_init.c.
void crypto_thread_cleanup | ( | void | ) |
Free crypto resources held by this thread.
Definition at line 116 of file crypto_init.c.
int tor_is_using_nss | ( | void | ) |
Return true iff Tor is using the NSS library.
Definition at line 216 of file crypto_init.c.
|
static |
Boolean: has our crypto library been initialized? (early phase)
Definition at line 35 of file crypto_init.c.
Referenced by crypto_early_init().
|
static |
Boolean: has our crypto library been initialized? (late phase)
Definition at line 38 of file crypto_init.c.
Referenced by crypto_global_init().
|
static |
Declares the configuration options for this module.
Definition at line 289 of file crypto_init.c.
const struct subsys_fns_t sys_crypto |
Definition at line 302 of file crypto_init.c.