diff --git a/librb/src/mbedtls.c b/librb/src/mbedtls.c index a8471fdc..515b8b17 100644 --- a/librb/src/mbedtls.c +++ b/librb/src/mbedtls.c @@ -735,8 +735,8 @@ rb_get_ssl_info(char *buf, size_t len) char version_str[512]; mbedtls_version_get_string(version_str); - snprintf(buf, len, "ARM mbedTLS: compiled (v%s), library (v%s)", - MBEDTLS_VERSION_STRING, version_str); + (void) snprintf(buf, len, "ARM mbedTLS: compiled (v%s), library (v%s)", + MBEDTLS_VERSION_STRING, version_str); } const char * @@ -744,7 +744,15 @@ rb_ssl_get_cipher(rb_fde_t *F) { if(F == NULL || F->ssl == NULL || SSL_P(F) == NULL) return NULL; - return mbedtls_ssl_get_ciphersuite(SSL_P(F)); + + static char buf[512]; + + const char *version = mbedtls_ssl_get_version(SSL_P(F)); + const char *cipher = mbedtls_ssl_get_ciphersuite(SSL_P(F)); + + (void) snprintf(buf, sizeof buf, "%s, %s", version, cipher); + + return buf; } #endif /* HAVE_MBEDTLS */ diff --git a/librb/src/openssl.c b/librb/src/openssl.c index 63b1dfc8..ef5a60da 100644 --- a/librb/src/openssl.c +++ b/librb/src/openssl.c @@ -871,15 +871,17 @@ rb_get_ssl_info(char *buf, size_t len) const char * rb_ssl_get_cipher(rb_fde_t *F) { - const SSL_CIPHER *sslciph; - if(F == NULL || F->ssl == NULL) return NULL; - if((sslciph = SSL_get_current_cipher(F->ssl)) == NULL) - return NULL; + static char buf[512]; - return SSL_CIPHER_get_name(sslciph); + const char *version = SSL_get_version(F->ssl); + const char *cipher = SSL_get_cipher_name(F->ssl); + + (void) snprintf(buf, sizeof buf, "%s, %s", version, cipher); + + return buf; } #endif /* HAVE_OPENSSL */