TLS Backends: Harmomise the rb_ssl_get_cipher() function
The GNUTLS backend reports the version in use for the client as well as its ciphersuite -- do the same for the other 2 backends.
This commit is contained in:
parent
1554951205
commit
f70b6f55f9
2 changed files with 18 additions and 8 deletions
|
@ -683,9 +683,10 @@ void
|
||||||
rb_get_ssl_info(char *buf, size_t len)
|
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, "ARM mbedTLS: compiled (v%s), library (v%s)",
|
(void) rb_snprintf(buf, len, "ARM mbedTLS: compiled (v%s), library (v%s)",
|
||||||
MBEDTLS_VERSION_STRING, version_str);
|
MBEDTLS_VERSION_STRING, version_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,7 +696,14 @@ rb_ssl_get_cipher(rb_fde_t *F)
|
||||||
if(F == NULL || F->ssl == NULL || SSL_P(F) == NULL)
|
if(F == NULL || F->ssl == NULL || SSL_P(F) == NULL)
|
||||||
return 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) rb_snprintf(buf, sizeof buf, "%s, %s", version, cipher);
|
||||||
|
|
||||||
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_MBEDTLS */
|
#endif /* HAVE_MBEDTLS */
|
||||||
|
|
|
@ -828,15 +828,17 @@ rb_get_ssl_info(char *buf, size_t len)
|
||||||
const char *
|
const char *
|
||||||
rb_ssl_get_cipher(rb_fde_t *F)
|
rb_ssl_get_cipher(rb_fde_t *F)
|
||||||
{
|
{
|
||||||
const SSL_CIPHER *sslciph;
|
|
||||||
|
|
||||||
if(F == NULL || F->ssl == NULL)
|
if(F == NULL || F->ssl == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if((sslciph = SSL_get_current_cipher(F->ssl)) == NULL)
|
static char buf[512];
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return SSL_CIPHER_get_name(sslciph);
|
const char *version = SSL_get_version(F->ssl);
|
||||||
|
const char *cipher = SSL_get_cipher_name(F->ssl);
|
||||||
|
|
||||||
|
(void) rb_snprintf(buf, sizeof buf, "%s, %s", version, cipher);
|
||||||
|
|
||||||
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_OPESSL */
|
#endif /* HAVE_OPESSL */
|
||||||
|
|
Loading…
Reference in a new issue