[TLS Backends] Make version strings more useful and consistent

This commit is contained in:
Aaron Jones 2016-05-05 03:28:58 +00:00
parent 0fe9dd4119
commit c40eede13b
No known key found for this signature in database
GPG key ID: 6E854C0FAAD4CEA4
3 changed files with 20 additions and 6 deletions

View file

@ -748,7 +748,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)
{ {
snprintf(buf, len, "GNUTLS: compiled (%s), library(%s)", snprintf(buf, len, "GNUTLS: compiled (%s), library (%s)",
LIBGNUTLS_VERSION, gnutls_check_version(NULL)); LIBGNUTLS_VERSION, gnutls_check_version(NULL));
} }

View file

@ -643,8 +643,8 @@ 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);
snprintf(buf, len, "MBEDTLS: compiled (%s), library(%s)", snprintf(buf, len, "ARM mbedTLS: compiled (v%s), library (v%s)",
MBEDTLS_VERSION_STRING, version_str); MBEDTLS_VERSION_STRING, version_str);
} }
const char * const char *

View file

@ -810,9 +810,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)
{ {
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()); snprintf(buf, len, "OpenSSL: 0x%lx, %s",
OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT);
else
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)
snprintf(buf, len, "OpenSSL: 0x%lx, %s",
SSLeay(), SSLeay_version(SSLEAY_VERSION));
else
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 *