Commit 8cd3e66d authored by Nick Mathewson's avatar Nick Mathewson 🦀
Browse files

Use new configuration architecture for crypto options

This is a comparatively simple change.
parent b06e9d8a
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -498,11 +498,8 @@ static const config_var_t option_vars_[] = {
#endif /* defined(_WIN32) */
  OBSOLETE("Group"),
  V(GuardLifetime,               INTERVAL, "0 minutes"),
  V_IMMUTABLE(HardwareAccel,     BOOL,     "0"),
  V(HeartbeatPeriod,             INTERVAL, "6 hours"),
  V(MainloopStats,               BOOL,     "0"),
  V_IMMUTABLE(AccelName,         STRING,   NULL),
  V_IMMUTABLE(AccelDir,          FILENAME, NULL),
  V(HashedControlPassword,       LINELIST, NULL),
  OBSOLETE("HidServDirectoryV2"),
  VAR("HiddenServiceDir",    LINELIST_S, RendConfigLines,    NULL),
@@ -3938,11 +3935,6 @@ options_validate_cb(const void *old_options_, void *options_, char **msg)
                        "testing Tor network!");
  }

  if (options->AccelName && !options->HardwareAccel)
    options->HardwareAccel = 1;
  if (options->AccelDir && !options->AccelName)
    REJECT("Can't use hardware crypto accelerator dir without engine name.");

  if (options_validate_scheduler(options, msg) < 0) {
    return -1;
  }
+0 −4
Original line number Diff line number Diff line
@@ -536,12 +536,8 @@ struct or_options_t {
                         * protocol, is it a warn or an info in our logs? */
  int TestSocks; /**< Boolean: when we get a socks connection, do we loudly
                  * log whether it was DNS-leaking or not? */
  int HardwareAccel; /**< Boolean: Should we enable OpenSSL hardware
                      * acceleration where available? */
  /** Token Bucket Refill resolution in milliseconds. */
  int TokenBucketRefillInterval;
  char *AccelName; /**< Optional hardware acceleration engine name. */
  char *AccelDir; /**< Optional hardware acceleration engine search dir. */

  /** Boolean: Do we try to enter from a smallish number
   * of fixed nodes? */
+0 −10
Original line number Diff line number Diff line
@@ -592,9 +592,6 @@ tor_init(int argc, char *argv[])
    return 1;
  }

  /* The options are now initialised */
  const or_options_t *options = get_options();

  /* Initialize channelpadding and circpad parameters to defaults
   * until we get a consensus */
  channelpadding_new_consensus_params(NULL);
@@ -616,13 +613,6 @@ tor_init(int argc, char *argv[])
             "and you probably shouldn't.");
#endif

  if (crypto_global_init(options->HardwareAccel,
                         options->AccelName,
                         options->AccelDir)) {
    log_err(LD_BUG, "Unable to initialize OpenSSL. Exiting.");
    return -1;
  }

  /* Scan/clean unparseable descriptors; after reading config */
  routerparse_init();

+0 −9
Original line number Diff line number Diff line
@@ -887,15 +887,6 @@ init_keys_common(void)
  if (!key_lock)
    key_lock = tor_mutex_new();

  /* There are a couple of paths that put us here before we've asked
   * openssl to initialize itself. */
  if (crypto_global_init(get_options()->HardwareAccel,
                         get_options()->AccelName,
                         get_options()->AccelDir)) {
    log_err(LD_BUG, "Unable to initialize OpenSSL. Exiting.");
    return -1;
  }

  return 0;
}

+3 −0
Original line number Diff line number Diff line
orconfig.h
lib/arch/*.h
lib/cc/*.h
lib/conf/*.h
lib/container/*.h
lib/crypt_ops/*.h
lib/ctime/*.h
@@ -17,6 +18,8 @@ lib/testsupport/*.h
lib/thread/*.h
lib/log/*.h

lib/crypt_ops/*.inc

trunnel/pwbox.h

keccak-tiny/*.h
Loading