[TLS backends] Make version strings more useful and consistent

This commit is contained in:
Aaron Jones 2016-05-04 00:20:07 +00:00
parent 2a1e5de8cb
commit d35caf56cb
No known key found for this signature in database
GPG key ID: 6E854C0FAAD4CEA4
3 changed files with 19 additions and 5 deletions

View file

@ -664,7 +664,7 @@ rb_supports_ssl(void)
void void
rb_get_ssl_info(char *buf, size_t len) 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)); LIBGNUTLS_VERSION, gnutls_check_version(NULL));
} }

View file

@ -596,7 +596,7 @@ rb_get_ssl_info(char *buf, size_t len)
char version_str[512]; char version_str[512];
mbedtls_version_get_string(version_str); 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); MBEDTLS_VERSION_STRING, version_str);
} }

View file

@ -768,9 +768,23 @@ rb_supports_ssl(void)
void void
rb_get_ssl_info(char *buf, size_t len) rb_get_ssl_info(char *buf, size_t len)
{ {
rb_snprintf(buf, len, "Using SSL: %s compiled: 0x%lx, library 0x%lx", #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
SSLeay_version(SSLEAY_VERSION), if (OpenSSL_version_num() == OPENSSL_VERSION_NUMBER)
(long)OPENSSL_VERSION_NUMBER, SSLeay()); 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 * const char *