- Added function for stringified SSL/TLS version
diff --git a/ChangeLog b/ChangeLog
index 48ab5ae..bb15887 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,10 +4,8 @@
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 3d3c020..6d7b495 100644
--- a/include/polarssl/ssl.h
+++ b/include/polarssl/ssl.h
@@ -526,6 +526,15 @@
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
*
* \param ssl SSL context
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index a0be84f..74e51a3 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -1918,6 +1918,25 @@
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)