Added functionality to fetch the TLS version and cipher info for a connection.

This commit is contained in:
Jan Vidar Krey 2014-08-05 17:43:24 +02:00
parent b3b4876c08
commit 95de69efeb
2 changed files with 15 additions and 1 deletions

View File

@ -394,6 +394,18 @@ void net_ssl_callback(struct net_connection* con, int events)
}
}
const char* net_ssl_get_tls_version(struct net_connection* con)
{
struct net_ssl_openssl* handle = get_handle(con);
return SSL_get_version(handle->ssl);
}
const char* net_ssl_get_tls_cipher(struct net_connection* con)
{
struct net_ssl_openssl* handle = get_handle(con);
const SSL_CIPHER *cipher = SSL_get_current_cipher(handle->ssl);
return SSL_CIPHER_get_name(cipher);
}
#endif /* SSL_USE_OPENSSL */
#endif /* SSL_SUPPORT */

View File

@ -103,10 +103,12 @@ extern void net_ssl_destroy(struct net_connection* con);
extern void net_ssl_callback(struct net_connection* con, int events);
extern ssize_t net_con_ssl_handshake(struct net_connection* con, enum net_con_ssl_mode, struct ssl_context_handle* ssl_ctx);
extern int net_con_is_ssl(struct net_connection* con);
extern const char* net_ssl_get_tls_version(struct net_connection* con);
extern const char* net_ssl_get_tls_cipher(struct net_connection* con);
#endif /* SSL_SUPPORT */
#endif /* HAVE_UHUB_NETWORK_TLS_H */