Commit 6e17fa6d authored by Kevin Butler's avatar Kevin Butler
Browse files

Added --library-versions flag to print the compile time and runtime versions...

Added --library-versions flag to print the compile time and runtime versions of libevent, openssl and zlib. Partially implements #6384.
parent 00bcc25d
Loading
Loading
Loading
Loading

changes/bug6384

0 → 100644
+2 −0
Original line number Diff line number Diff line
  o Minor features:
    - Add support for `--library-versions` flag. Implements ticket #6384.
+8 −0
Original line number Diff line number Diff line
@@ -415,6 +415,14 @@ tor_check_libevent_version(const char *m, int server,
#define HEADER_VERSION _EVENT_VERSION
#endif

/** Return a string representation of the version of Libevent that was used
* at compilation time. */
const char *
tor_libevent_get_header_version_str(void)
{
  return HEADER_VERSION;
}

/** See whether the headers we were built against differ from the library we
 * linked against so much that we're likely to crash.  If so, warn the
 * user. */
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ void tor_check_libevent_version(const char *m, int server,
                                const char **badness_out);
void tor_check_libevent_header_compatibility(void);
const char *tor_libevent_get_version_str(void);
const char *tor_libevent_get_header_version_str(void);

#ifdef USE_BUFFEREVENTS
const struct timeval *tor_libevent_get_one_tick_timeout(void);
+28 −13
Original line number Diff line number Diff line
@@ -195,13 +195,9 @@ try_load_engine(const char *path, const char *engine)
}
#endif

static char *crypto_openssl_version_str = NULL;
/* Return a human-readable version of the run-time openssl version number. */
const char *
crypto_openssl_get_version_str(void)
static char *
parse_openssl_version_str(const char *raw_version)
{
  if (crypto_openssl_version_str == NULL) {
    const char *raw_version = SSLeay_version(SSLEAY_VERSION);
  const char *end_of_version = NULL;
  /* The output should be something like "OpenSSL 1.0.0b 10 May 2012. Let's
     trim that down. */
@@ -211,14 +207,33 @@ crypto_openssl_get_version_str(void)
  }

  if (end_of_version)
      crypto_openssl_version_str = tor_strndup(raw_version,
    return tor_strndup(raw_version,
                      end_of_version-raw_version);
  else
      crypto_openssl_version_str = tor_strdup(raw_version);
    return tor_strdup(raw_version);
}

static char *crypto_openssl_version_str = NULL;
/* Return a human-readable version of the run-time openssl version number. */
const char *
crypto_openssl_get_version_str(void)
{
  if (crypto_openssl_version_str == NULL) {
    const char *raw_version = SSLeay_version(SSLEAY_VERSION);
    crypto_openssl_version_str = parse_openssl_version_str(raw_version);
  }
  return crypto_openssl_version_str;
}

/* Return a human-readable version of the compile-time openssl version
* number. */
const char *
crypto_openssl_get_header_version_str(void)
{
  //return OPENSSL_VERSION_TEXT;
  return parse_openssl_version_str(OPENSSL_VERSION_TEXT);
}

/** Initialize the crypto library.  Return 0 on success, -1 on failure.
 */
int
+1 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ typedef struct crypto_dh_t crypto_dh_t;

/* global state */
const char * crypto_openssl_get_version_str(void);
const char * crypto_openssl_get_header_version_str(void);
int crypto_global_init(int hardwareAccel,
                       const char *accelName,
                       const char *accelPath);
Loading