diff --git a/ChangeLog b/ChangeLog index 48ab5aefa..bb15887b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,10 +4,8 @@ PolarSSL ChangeLog Features Note: Most of these features have been donated by Fox-IT * Added Doxygen source code documentation parts - * Added generic message digest wrapper for integration - with OpenVPN - * Added generic cipher wrapper for integration - with OpenVPN + * Added generic message digest and cipher wrapper + for integration with OpenVPN * Added reading of DHM context from memory and file * Added verification callback on certificate chain verification to allow external blacklisting. diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h index 3d3c020b1..6d7b4952d 100644 --- a/include/polarssl/ssl.h +++ b/include/polarssl/ssl.h @@ -525,6 +525,15 @@ int ssl_get_verify_result( const ssl_context *ssl ); */ const char *ssl_get_cipher( const ssl_context *ssl ); +/** + * \brief Return the current SSL version (SSLv3/TLSv1/etc) + * + * \param ssl SSL context + * + * \return a string containing the SSL version + */ +const char *ssl_get_version( const ssl_context *ssl ); + /** * \brief Perform the SSL handshake * diff --git a/library/ssl_tls.c b/library/ssl_tls.c index a0be84f68..74e51a3a5 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -1918,6 +1918,25 @@ const char *ssl_get_cipher( const ssl_context *ssl ) return( "unknown" ); } +const char *ssl_get_version( const ssl_context *ssl ) +{ + switch( ssl->minor_ver ) + { + case SSL_MINOR_VERSION_0: + return( "SSLv3.0" ); + + case SSL_MINOR_VERSION_1: + return( "TLSv1.0" ); + + case SSL_MINOR_VERSION_2: + return( "TLSv1.1" ); + + default: + break; + } + return( "unknown" ); +} + int ssl_default_ciphers[] = { #if defined(POLARSSL_DHM_C)