Skip to contentSkip to conversation

RFD: ssl library version numbers

Openvpn-devel Gert Doering 7 participants 15 messages Apr 13, 2014 – Apr 18, 2014

lore
Share & tools
lore
#0 lore raw

Hi,

OpenVPN does not currently report the version of the SSL library it is using - which I'm not sure whether it's by design or just because nobody ever added it. Anyway, right now I think we need it, to help future cases.

There are a few questions that go along with that, which I want to discuss here :-)

- shall we report compile-time versions as well, or only run-time version?

Like:

	OpenSSL compile version='OpenSSL 1.0.1f 6 Jan 2014'
		library version='OpenSSL 1.0.1g 7 Apr 2014'

(this is on one of my test systems where I discovered an old OpenSSL installation, and upgraded *after* I built the OpenVPN binary)

While I always like seeing numbers, I think the compile-time version is not actually that useful - if the ABI is not compatible, it will break, and if it is, the library version is what is relevant.

- how do I get the library version for PolarSSL?

- shall we report the library version to the server, e.g. in the form of

IV_SSL=OpenSSL 1.0.1f
IV_SSL=PolarSSL 1.2.8

as a sysadmin on the server side, I'd welcome this ("show me what my users are running"). From a security geek side, I'm not sure whether there is potential for abuse, so "please give me your input"

- if we report it, do we want to report it always (as IV_VER) or only if --push-peer-info is set?

feedback, please! :-)

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#1 lore raw

Love it. Report always

Quoted 58 lines · Gert Doering

Hi,

OpenVPN does not currently report the version of the SSL library it is using - which I'm not sure whether it's by design or just because nobody ever added it. Anyway, right now I think we need it, to help future cases.

There are a few questions that go along with that, which I want to discuss here :-)

- shall we report compile-time versions as well, or only run-time version?

Like:

   OpenSSL compile version='OpenSSL 1.0.1f 6 Jan 2014'
       library version='OpenSSL 1.0.1g 7 Apr 2014'

(this is on one of my test systems where I discovered an old OpenSSL installation, and upgraded *after* I built the OpenVPN binary)

While I always like seeing numbers, I think the compile-time version is not actually that useful - if the ABI is not compatible, it will break, and if it is, the library version is what is relevant.

- how do I get the library version for PolarSSL?

- shall we report the library version to the server, e.g. in the form of

IV_SSL=OpenSSL 1.0.1f
IV_SSL=PolarSSL 1.2.8

as a sysadmin on the server side, I'd welcome this ("show me what my users are running"). From a security geek side, I'm not sure whether there is potential for abuse, so "please give me your input"

- if we report it, do we want to report it always (as IV_VER) or only if --push-peer-info is set?

feedback, please! :-)

gert

Signature · 14 lines
USENET is *not* the non-clickable part of WWW!
                                                          //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
#2 lore raw
In reply to Gert Doering

Hi Gert,

Quoted 17 lines · Gert Doering

Hi,

OpenVPN does not currently report the version of the SSL library it is using - which I'm not sure whether it's by design or just because nobody ever added it. Anyway, right now I think we need it, to help future cases.

There are a few questions that go along with that, which I want to discuss here :-)

- shall we report compile-time versions as well, or only run-time version?

Like:

	OpenSSL compile version='OpenSSL 1.0.1f 6 Jan 2014'
		library version='OpenSSL 1.0.1g 7 Apr 2014'
Quoted 8 lines

(this is on one of my test systems where I discovered an old OpenSSL installation, and upgraded *after* I built the OpenVPN binary)

While I always like seeing numbers, I think the compile-time version is not actually that useful - if the ABI is not compatible, it will break, and if it is, the library version is what is relevant.

+1 for this; I'd go for runtime versions only , although it might be an interesting debug flag to get the compile time version as well - it might aid in debugging cases where the ABI is supposed to be compatible, but isn't .

Quoted 3 lines

- how do I get the library version for PolarSSL?

void version_get_string_full( char *string )

Quoted 5 lines

- shall we report the library version to the server, e.g. in the form of

   IV_SSL=OpenSSL 1.0.1f
   IV_SSL=PolarSSL 1.2.8
Quoted 10 lines

as a sysadmin on the server side, I'd welcome this ("show me what my users are running"). From a security geek side, I'm not sure whether there is potential for abuse, so "please give me your input"

- if we report it, do we want to report it always (as IV_VER) or only if --push-peer-info is set?

we're reporting the openvpn version info anyway, so adding the SSL lib version would not change much; if it is only returned when --push-peer-info is set then there shouldn't be any privacy/security concerns, esp if the info is given *AFTER* the initial connection is made (i.e. after the first certificate handshake).

while we're at it : if we're printing out (not reporting) the version number of the SSL lib, why not also print out the version numbers of the other libs
- zlib
- pkcs11-helper
- snappy?

this is what 'curl' does and it has saved me debugging time in some strange cases.

JM2CW,

JJK

#3 lore raw

Hi,

Quoted 9 lines · Jan Just Keijser
Quoted 3 lines · Gert Doering

- if we report it, do we want to report it always (as IV_VER) or only if --push-peer-info is set?

we're reporting the openvpn version info anyway, so adding the SSL lib version would not change much; if it is only returned when --push-peer-info is set then there shouldn't be any privacy/security concerns, esp if the info is given *AFTER* the initial connection is made (i.e. after the first certificate handshake).

My thoughts exactly. I think this is useful, but I do not want to tell an eavesdropper whether I'm running a vulnerable SSL library. So, this should really happen *after* the peer authentication, over a secure channel.

-Steffan

#4 lore raw
In reply to Jan Just Keijser

Hi,

Quoted 2 lines · Jan Just Keijser
Quoted 1 line

- how do I get the library version for PolarSSL?

void version_get_string_full( char *string )

I really wonder what they smoked when designing this API...

/**
* Get the full version string ("PolarSSL x.y.z"). *
* \param string The string that will receive the value.
* (Should be at least 18 bytes in size)
*/
void version_get_string_full( char *string );

"pass me a pointer to a string, don't pass me a length field, and there's no real way you can be sure whatever you use is long enough"...

Anyway. Patch coming.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#5 lore raw
In reply to Gert Doering

----- Opprinnelig melding -----

Quoted 12 lines

Fra: "Gert Doering" <[email protected]...>
Til: [email protected]
Sendt: 13. april 2014 17:26:13
Emne: [Openvpn-devel] RFD: ssl library version numbers

Hi,

OpenVPN does not currently report the version of the SSL library it is using - which I'm not sure whether it's by design or just because nobody ever added it. Anyway, right now I think we need it, to help future cases.

Quoted 4 lines

There are a few questions that go along with that, which I want to discuss here :-)

- shall we report compile-time versions as well, or only run-time version?

I'd say we should return *run-time* versions. For RPM based distros at least, the OpenSSL library can be upgraded without a rebuild of OpenVPN (as long as the ABI doesn't change, which most enterprise level distros will beware of). In that perspective there is not much value which compile-time version OpenVPN was compiled against.

The only time OpenSSL compile-time versions is interesting is when there are #define constants and macros which would directly change the OpenVPN runtime behaviour. But such changes is actually breaking the OpenSSL ABI, which again most enterprise level distros will beware of and avoid. And I even believe, at least for OpenSSL, that such ABI breaking changes goes into their major releases, not the minor updates.

--
kind regards,

David Sommerseth

#6 lore raw
In reply to Gert Doering

Hi,

Quoted 4 lines · Gert Doering

OpenVPN does not currently report the version of the SSL library it is using - which I'm not sure whether it's by design or just because nobody ever added it. Anyway, right now I think we need it, to help future cases.

OK, here's a "continue the discussion" patch.

This is actually surprisingly messy, as the "first line" OpenVPN prints is a static string that is referenced all over the place, sometimes sent to file descriptors, sometimes used with msg(), so extending this to include the "library version numbers" would be a fairly big change. So I've decided to just print a second line:

Mon Apr 14 21:23:11 2014 library versions: OpenSSL 1.0.1g 7 Apr 2014, LZO 2.06

or

Mon Apr 14 21:27:49 2014 library versions: PolarSSL 1.2.10

(--with-crypto-library=polarssl --disable-lzo)

If --push-peer-info is set (and only then), this is sent as part of the peer-info handshake towards the server:

Apr 14 21:23:49 gentoo openvpn[17804]: 2001:608:4:0:222:68ff:fe7f:7420 peer info: IV_SSL=OpenSSL_1.0.1g_7_Apr_2014

(this happens after the client has already accepted the server certificate, and is part of the same message as username+passwort, so if you trust the server enough to give him your password, there is no "more secure" point in the handshake to give him your SSL version).

Library version printing is only done for SSL and LZO so far - LZO is more "look how messy this gets", but it's encapsulated in options.c, so sort of acceptable.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...

From 8126ab53978160529f7797e0e50cfa39a3d4c971 Mon Sep 17 00:00:00 2001
From: Gert Doering <[email protected]...>
Date: Sun, 13 Apr 2014 17:29:32 +0200
Subject: [PATCH] Add SSL library version reporting.

Print the version of the SSL and LZO library (if any) used.

SSL library version is also sent as IV_SSL=<version> to the server if --push-peer-info is enabled.

---
 src/openvpn/openvpn.c      |  1 +
 src/openvpn/options.c      | 18 ++++++++++++++++++
 src/openvpn/ssl.c          |  1 +
 src/openvpn/ssl_backend.h  |  6 ++++++
 src/openvpn/ssl_openssl.c  |  6 ++++++
 src/openvpn/ssl_polarssl.c |  8 ++++++++
 6 files changed, 40 insertions(+)
src/openvpn/openvpn.c +1 -0
index 5125eae..fd87fc1 100644
@@ -220,6 +220,7 @@ openvpn_main (int argc, char *argv[])
 
 	  /* print version number */
 	  msg (M_INFO, "%s", title_string);
+	  show_library_versions(M_INFO);
 
 	  /* misc stuff */
 	  pre_setup (&c.options);
src/openvpn/options.c +18 -0
index 18cb354..dc74b53 100644
@@ -3435,10 +3435,28 @@ usage_small (void)
   openvpn_exit (OPENVPN_EXIT_STATUS_USAGE); /* exit point */
 }
 
+void
+show_library_versions(const unsigned int flags)
+{
+  msg (flags, "library versions: %s%s%s",
+#ifdef ENABLE_SSL
+	  		get_ssl_library_version(),
+#else
+			"",
+#endif
+#ifdef ENABLE_LZO
+			", LZO ", lzo_version_string()
+#else
+			"", ""
+#endif
+	);
+}
+
 static void
 usage_version (void)
 {
   msg (M_INFO|M_NOPREFIX, "%s", title_string);
+  show_library_versions( M_INFO|M_NOPREFIX );
   msg (M_INFO|M_NOPREFIX, "Originally developed by James Yonan");
   msg (M_INFO|M_NOPREFIX, "Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <[email protected]...>");
 #ifndef ENABLE_SMALL
src/openvpn/ssl.c +1 -0
index d4acc0f..b09e52b 100644
@@ -1835,6 +1835,7 @@ push_peer_info(struct buffer *buf, struct tls_session *session)
 	  get_default_gateway (&rgi);
 	  if (rgi.flags & RGI_HWADDR_DEFINED)
 	    buf_printf (&out, "IV_HWADDR=%s\n", format_hex_ex (rgi.hwaddr, 6, 0, 1, ":", &gc));
+	  buf_printf (&out, "IV_SSL=%s\n", get_ssl_library_version() );
         }
 
       /* push env vars that begin with UV_ and IV_GUI_VER */
src/openvpn/ssl_backend.h +6 -0
index a6fc3bd..b1087e1 100644
@@ -466,4 +466,10 @@ void show_available_tls_ciphers (const char *tls_ciphers);
  */
 void get_highest_preference_tls_cipher (char *buf, int size);
 
+/*
+ * return a pointer to a static memory area containing the
+ * name and version number of the SSL library in use
+ */
+char * get_ssl_library_version(void);
+
 #endif /* SSL_BACKEND_H_ */
src/openvpn/ssl_openssl.c +6 -0
index 0b63e26..a7d7142 100644
@@ -1320,4 +1320,10 @@ get_highest_preference_tls_cipher (char *buf, int size)
   SSL_CTX_free (ctx);
 }
 
+char *
+get_ssl_library_version(void)
+{
+    return  SSLeay_version(SSLEAY_VERSION);
+}
+
 #endif /* defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_OPENSSL) */
src/openvpn/ssl_polarssl.c +8 -0
index 9dc4e87..8e0b898 100644
@@ -1079,4 +1079,12 @@ get_highest_preference_tls_cipher (char *buf, int size)
   strncpynt (buf, cipher_name, size);
 }
 
+char *
+get_ssl_library_version(void)
+{
+    static char polar_version[30];	/* "at least 18 bytes in size" */
+    version_get_string_full( polar_version );
+    return polar_version;
+}
+
 #endif /* defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_POLARSSL) */
Signature · 1 line
1.8.3.2
#7 lore raw
Quoted 8 lines · Gert Doering

Hi,

Quoted 4 lines · Gert Doering

OpenVPN does not currently report the version of the SSL library it is using - which I'm not sure whether it's by design or just because nobody ever added it. Anyway, right now I think we need it, to help future cases.

Quoted 7 lines

OK, here's a "continue the discussion" patch.

This is actually surprisingly messy, as the "first line" OpenVPN prints is a static string that is referenced all over the place, sometimes sent to file descriptors, sometimes used with msg(), so extending this to include the "library version numbers" would be a fairly big change. So I've decided to just print a second line:

Makes sense!

Quoted 5 lines

If --push-peer-info is set (and only then), this is sent as part of the peer-info handshake towards the server:

Apr 14 21:23:49 gentoo openvpn[17804]: 2001:608:4:0:222:68ff:fe7f:7420 peer info: IV_SSL=OpenSSL_1.0.1g_7_Apr_2014

Looks good.

Regarding your patch - the PolarSSL stuff

+char *
+get_ssl_library_version(void)
+{

+    static char polar_version[30];	/* "at least 18 bytes in size" */
+    version_get_string_full( polar_version );
+    return polar_version;

+}

version_get_string_full() is crappy due to the "at least 18 bytes". That's ugly. Can we please ensure that we at least adds a NULL termination in polar_version[29] after version_get_string_full() ... just to reduce the risk somewhat, in case it suddenly gets longer. Then it should (hopefully) be somewhat harder to get a buffer information leak.

Or maybe even slightly more hardened. Put version_get_string_full() into a much bigger temporary buffer, which then uses a strncpy() or memcpy() into the polar_version[] buffer. The strncpy()/memcpy() should restrict it to 30 bytes, including NULL terminator.

I presume get_ssl_library_version() will be treated as a normal NULL terminated string elsewhere in the code, also later on.

Signature · 3 lines
kind regards,

David Sommerseth
#8 lore raw

HI,

Quoted 10 lines · David Sommerseth

Regarding your patch - the PolarSSL stuff

src/openvpn/ssl_polarssl.c +7 -0
+char *
+get_ssl_library_version(void)
+{
+    static char polar_version[30];	/* "at least 18 bytes in size" */
+    version_get_string_full( polar_version );
+    return polar_version;
+}
Quoted 5 lines

version_get_string_full() is crappy due to the "at least 18 bytes". That's ugly. Can we please ensure that we at least adds a NULL termination in polar_version[29] after version_get_string_full() ... just to reduce the risk somewhat, in case it suddenly gets longer. Then it should (hopefully) be somewhat harder to get a buffer information leak.

Different approach:

char *
get_ssl_library_version(void)

{
    static char polar_version[30];
    unsigned int pv = version_get_number();
    sprintf( polar_version, "PolarSSL %d.%d.%d",
                (pv>>24)&0xff, (pv>>16)&0xff, (pv>>8)&0xff );
    return polar_version;
}

this is well-defined (polarssl/version.h), and guaranteed to not overflow.

Quoted 4 lines

Or maybe even slightly more hardened. Put version_get_string_full() into a much bigger temporary buffer, which then uses a strncpy() or memcpy() into the polar_version[] buffer. The strncpy()/memcpy() should restrict it to 30 bytes, including NULL terminator.

"much bigger", right :-)

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#9 lore raw

Hi,

Am 15.04.2014 09:42, schrieb Gert Doering:> char *

Quoted 10 lines

get_ssl_library_version(void)

{
    static char polar_version[30];
    unsigned int pv = version_get_number();
    sprintf( polar_version, "PolarSSL %d.%d.%d",
                (pv>>24)&0xff, (pv>>16)&0xff, (pv>>8)&0xff );
    return polar_version;
}

this is well-defined (polarssl/version.h), and guaranteed to not overflow.

wouldn't be using snprintf with length sizeof(polar_version) instead of just sprintf be better as to make sure this will not be broken by accident in future?

Regards,
M. Braun

#10 lore raw

Hi,

Quoted 10 lines · M. Braun

Am 15.04.2014 09:42, schrieb Gert Doering:> char *

Quoted 9 lines

get_ssl_library_version(void)

{
    static char polar_version[30];
    unsigned int pv = version_get_number();
    sprintf( polar_version, "PolarSSL %d.%d.%d",
                (pv>>24)&0xff, (pv>>16)&0xff, (pv>>8)&0xff );
    return polar_version;
}
Quoted 5 lines
Quoted 1 line

this is well-defined (polarssl/version.h), and guaranteed to not overflow.

wouldn't be using snprintf with length sizeof(polar_version) instead of just sprintf be better as to make sure this will not be broken by accident in future?

How can this ever be broken? 0xff bounds the numbers to 3 digits, there are only 3 numbers in there, which adds up to 21 bytes, at maximum.

Now if someone changes that code to add more text, it might...

(but I actually tend to go back to the previous version, as PolarSSL guarantees that they won't overrun these "magic 18 bytes", as that is "2 digits for each number", and if they ever add more text to the string, they will introduce a new API which is more sane than this - had a side-track discussion with Paul and David on it, of which David missed most due to his MTA bouncing all mails...)

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#11 lore raw
In reply to Gert Doering

On 15/04/14 09:42, Gert Doering wrote:> HI,

Quoted 12 lines · David Sommerseth
Quoted 10 lines

Regarding your patch - the PolarSSL stuff

src/openvpn/ssl_polarssl.c +7 -0
+char *
+get_ssl_library_version(void)
+{
+    static char polar_version[30];	/* "at least 18 bytes in size" */
+    version_get_string_full( polar_version );
+    return polar_version;
+}
Quoted 5 lines
Quoted 5 lines

version_get_string_full() is crappy due to the "at least 18 bytes". That's ugly. Can we please ensure that we at least adds a NULL termination in polar_version[29] after version_get_string_full() ... just to reduce the risk somewhat, in case it suddenly gets longer. Then it should (hopefully) be somewhat harder to get a buffer information

leak.

Quoted 13 lines

Different approach:

char *
get_ssl_library_version(void)

{
    static char polar_version[30];
    unsigned int pv = version_get_number();
    sprintf( polar_version, "PolarSSL %d.%d.%d",
                (pv>>24)&0xff, (pv>>16)&0xff, (pv>>8)&0xff );
    return polar_version;
}
Quoted 1 line

this is well-defined (polarssl/version.h), and guaranteed to not overflow.

I like this. I know that Paul has promised to never exceed 18 bytes. But you never know what some distros might do. They may modify these strings to provide more fine grained info. But this approach above will actually always be far more predictable.

--
kind regards,

David Sommerseth

#12 lore raw
In reply to Gert Doering

Hi,

Quoted 11 lines · Gert Doering

Different approach:

char *
get_ssl_library_version(void)

{
    static char polar_version[30];
    unsigned int pv = version_get_number();
    sprintf( polar_version, "PolarSSL %d.%d.%d",
                (pv>>24)&0xff, (pv>>16)&0xff, (pv>>8)&0xff );
    return polar_version;
}

OK, here's the full patch with this version.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...

From 2834a400c6225833da9b9559f1be709b4e77d5e9 Mon Sep 17 00:00:00 2001
From: Gert Doering <[email protected]...>
Date: Sun, 13 Apr 2014 17:29:32 +0200
Subject: [PATCH] Add SSL library version reporting.

Print the version of the SSL and LZO library (if any) used.

SSL library version is also sent as IV_SSL=<version> to the server if --push-peer-info is enabled.

---
 src/openvpn/openvpn.c      |  1 +
 src/openvpn/options.c      | 18 ++++++++++++++++++
 src/openvpn/ssl.c          |  1 +
 src/openvpn/ssl_backend.h  |  6 ++++++
 src/openvpn/ssl_openssl.c  |  6 ++++++
 src/openvpn/ssl_polarssl.c | 10 ++++++++++
 6 files changed, 42 insertions(+)
src/openvpn/openvpn.c +1 -0
index 5125eae..fd87fc1 100644
@@ -220,6 +220,7 @@ openvpn_main (int argc, char *argv[])
 
 	  /* print version number */
 	  msg (M_INFO, "%s", title_string);
+	  show_library_versions(M_INFO);
 
 	  /* misc stuff */
 	  pre_setup (&c.options);
src/openvpn/options.c +18 -0
index 18cb354..dc74b53 100644
@@ -3435,10 +3435,28 @@ usage_small (void)
   openvpn_exit (OPENVPN_EXIT_STATUS_USAGE); /* exit point */
 }
 
+void
+show_library_versions(const unsigned int flags)
+{
+  msg (flags, "library versions: %s%s%s",
+#ifdef ENABLE_SSL
+	  		get_ssl_library_version(),
+#else
+			"",
+#endif
+#ifdef ENABLE_LZO
+			", LZO ", lzo_version_string()
+#else
+			"", ""
+#endif
+	);
+}
+
 static void
 usage_version (void)
 {
   msg (M_INFO|M_NOPREFIX, "%s", title_string);
+  show_library_versions( M_INFO|M_NOPREFIX );
   msg (M_INFO|M_NOPREFIX, "Originally developed by James Yonan");
   msg (M_INFO|M_NOPREFIX, "Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <[email protected]...>");
 #ifndef ENABLE_SMALL
src/openvpn/ssl.c +1 -0
index d4acc0f..b09e52b 100644
@@ -1835,6 +1835,7 @@ push_peer_info(struct buffer *buf, struct tls_session *session)
 	  get_default_gateway (&rgi);
 	  if (rgi.flags & RGI_HWADDR_DEFINED)
 	    buf_printf (&out, "IV_HWADDR=%s\n", format_hex_ex (rgi.hwaddr, 6, 0, 1, ":", &gc));
+	  buf_printf (&out, "IV_SSL=%s\n", get_ssl_library_version() );
         }
 
       /* push env vars that begin with UV_ and IV_GUI_VER */
src/openvpn/ssl_backend.h +6 -0
index a6fc3bd..b1087e1 100644
@@ -466,4 +466,10 @@ void show_available_tls_ciphers (const char *tls_ciphers);
  */
 void get_highest_preference_tls_cipher (char *buf, int size);
 
+/*
+ * return a pointer to a static memory area containing the
+ * name and version number of the SSL library in use
+ */
+char * get_ssl_library_version(void);
+
 #endif /* SSL_BACKEND_H_ */
src/openvpn/ssl_openssl.c +6 -0
index 0b63e26..a7d7142 100644
@@ -1320,4 +1320,10 @@ get_highest_preference_tls_cipher (char *buf, int size)
   SSL_CTX_free (ctx);
 }
 
+char *
+get_ssl_library_version(void)
+{
+    return  SSLeay_version(SSLEAY_VERSION);
+}
+
 #endif /* defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_OPENSSL) */
src/openvpn/ssl_polarssl.c +10 -0
index 9dc4e87..844c04e 100644
@@ -1079,4 +1079,14 @@ get_highest_preference_tls_cipher (char *buf, int size)
   strncpynt (buf, cipher_name, size);
 }
 
+char *
+get_ssl_library_version(void)
+{
+    static char polar_version[30];
+    unsigned int pv = version_get_number();
+    sprintf( polar_version, "PolarSSL %d.%d.%d",
+    		(pv>>24)&0xff, (pv>>16)&0xff, (pv>>8)&0xff );
+    return polar_version;
+}
+
 #endif /* defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_POLARSSL) */
Signature · 1 line
1.8.3.2
#13 lore raw
Quoted 1 line · Gert Doering

OK, here's the full patch with this version.

One minor remark: if you add an extra * to the /* of the comment above get_ssl_library_version(void), the comment becomes a doxygen comment and will be included in the generated doxygen.

Otherwise, ACK.

-Steffan

#14 lore raw

[Openvpn-devel] [PATCH applied] Re: Add SSL library version reporting.

In reply to Gert Doering

Patch has been applied to the master and release/2.3 branches.

commit 1ec984b154aa3247ef58c9d44e7e477880b632b1 (master) commit 25bc9f082432034315b3efd9401aa8a9e5884506 (release/2.3)

Author: Gert Doering
Date:   Sun Apr 13 17:29:32 2014 +0200
     Add SSL library version reporting.

     Signed-off-by: Gert Doering <[email protected]...>
     Acked-by: Steffan Karger <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/8537

--
kind regards,

Gert Doering