From d35caf56cbd3360c002094c482efc1eb53bc09ac Mon Sep 17 00:00:00 2001 From: Aaron Jones Date: Wed, 4 May 2016 00:20:07 +0000 Subject: [PATCH] [TLS backends] Make version strings more useful and consistent --- libratbox/src/gnutls.c | 2 +- libratbox/src/mbedtls.c | 2 +- libratbox/src/openssl.c | 20 +++++++++++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/libratbox/src/gnutls.c b/libratbox/src/gnutls.c index 9f274b58..f51211fe 100644 --- a/libratbox/src/gnutls.c +++ b/libratbox/src/gnutls.c @@ -664,7 +664,7 @@ rb_supports_ssl(void) void rb_get_ssl_info(char *buf, size_t len) { - rb_snprintf(buf, len, "GNUTLS: compiled (%s), library(%s)", + rb_snprintf(buf, len, "GNUTLS: compiled (%s), library (%s)", LIBGNUTLS_VERSION, gnutls_check_version(NULL)); } diff --git a/libratbox/src/mbedtls.c b/libratbox/src/mbedtls.c index 4fb150e9..9c1e2941 100644 --- a/libratbox/src/mbedtls.c +++ b/libratbox/src/mbedtls.c @@ -596,7 +596,7 @@ rb_get_ssl_info(char *buf, size_t len) char version_str[512]; mbedtls_version_get_string(version_str); - rb_snprintf(buf, len, "MBEDTLS: compiled (%s), library(%s)", + rb_snprintf(buf, len, "ARM mbedTLS: compiled (v%s), library (v%s)", MBEDTLS_VERSION_STRING, version_str); } diff --git a/libratbox/src/openssl.c b/libratbox/src/openssl.c index f86dd798..32d74a42 100644 --- a/libratbox/src/openssl.c +++ b/libratbox/src/openssl.c @@ -768,9 +768,23 @@ rb_supports_ssl(void) void rb_get_ssl_info(char *buf, size_t len) { - rb_snprintf(buf, len, "Using SSL: %s compiled: 0x%lx, library 0x%lx", - SSLeay_version(SSLEAY_VERSION), - (long)OPENSSL_VERSION_NUMBER, SSLeay()); +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) + if (OpenSSL_version_num() == OPENSSL_VERSION_NUMBER) + rb_snprintf(buf, len, "OpenSSL: 0x%lx, %s", + OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT); + else + rb_snprintf(buf, len, "OpenSSL: compiled (0x%lx, %s), library (0x%lx, %s)", + OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT, + OpenSSL_version_num(), OpenSSL_version(OPENSSL_VERSION)); +#else + if (SSLeay() == SSLEAY_VERSION_NUMBER) + rb_snprintf(buf, len, "OpenSSL: 0x%lx, %s", + SSLeay(), SSLeay_version(SSLEAY_VERSION)); + else + rb_snprintf(buf, len, "OpenSSL: compiled (0x%lx, %s), library (0x%lx, %s)", + SSLEAY_VERSION_NUMBER, "???", + SSLeay(), SSLeay_version(SSLEAY_VERSION)); +#endif } const char *