diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-02-06 00:25:42 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-02-06 00:25:42 +0100 |
commit | 9b99c5ad31eb8de222d2b3aa1daa9412f0b25857 (patch) | |
tree | e2d3dff2588c665eea801064ddc3403200fd8349 /src/modules/extra | |
parent | 1a6974fe0db1cd432e55c673c5b1307a7d62980b (diff) | |
parent | be692fc3af2dde60c4e6a665fe21092875b3ae5c (diff) |
Merge branch 'master+tlsversion'
Diffstat (limited to 'src/modules/extra')
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 15 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 10 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index be642a79d..e4c3128f5 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -934,11 +934,8 @@ info_done_dealloc: if (sess) { std::string text = "*** You are connected using SSL cipher '"; - - text += UnknownIfNULL(gnutls_kx_get_name(gnutls_kx_get(sess))); - text.append("-").append(UnknownIfNULL(gnutls_cipher_get_name(gnutls_cipher_get(sess)))).append("-"); - text.append(UnknownIfNULL(gnutls_mac_get_name(gnutls_mac_get(sess)))).append("'"); - + GetCiphersuite(text); + text += '\''; if (!certificate->fingerprint.empty()) text += " and your SSL certificate fingerprint is " + certificate->fingerprint; @@ -946,6 +943,14 @@ info_done_dealloc: } } + void GetCiphersuite(std::string& out) const + { + out.append(UnknownIfNULL(gnutls_protocol_get_name(gnutls_protocol_get_version(sess)))).push_back('-'); + out.append(UnknownIfNULL(gnutls_kx_get_name(gnutls_kx_get(sess)))).push_back('-'); + out.append(UnknownIfNULL(gnutls_cipher_get_name(gnutls_cipher_get(sess)))).push_back('-'); + out.append(UnknownIfNULL(gnutls_mac_get_name(gnutls_mac_get(sess)))); + } + GnuTLS::Profile* GetProfile() { return profile; } }; diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index b38478d6d..c1a3bf41a 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -678,7 +678,9 @@ class OpenSSLIOHook : public SSLIOHook { if (sess) { - std::string text = "*** You are connected using SSL cipher '" + std::string(SSL_get_cipher(sess)) + "'"; + std::string text = "*** You are connected using SSL cipher '"; + GetCiphersuite(text); + text += '\''; const std::string& fingerprint = certificate->fingerprint; if (!fingerprint.empty()) text += " and your SSL certificate fingerprint is " + fingerprint; @@ -686,6 +688,12 @@ class OpenSSLIOHook : public SSLIOHook user->WriteNotice(text); } } + + void GetCiphersuite(std::string& out) const + { + out.append(SSL_get_version(sess)).push_back('-'); + out.append(SSL_get_cipher(sess)); + } }; static void StaticSSLInfoCallback(const SSL* ssl, int where, int rc) |