PolarSSL 1.2 support, while keeping config file compatibility
Hi Everyone,
The attached patches add PolarSSL 1.2 support to OpenVPN 2.3, while maintaining OpenVPN configuration file compatibility between the OpenSSL and PolarSSL builds.
Patches 1-3 upgrade the supported PolarSSL versions to 1.2.5 or newer.
Patch 4 adds data channel cipher name compatibility.
Patch 5 adds TLS control channel cipher suite name compatibility as discussed at FOSDEM. It makes the IANA (IETF) cipher suite naming that PolarSSL uses since 1.2 the preferred format, but still accepts OpenSSL names. It attempts to tranlate cipher names in both directions whenever required.
Regards,
-Steffan
PATCH 1/5 PolarSSL-1.2 support
From: Steffan Karger <[email protected]...>
Add support for PolarSSL-1.2, which has changed the API in several places. This is a minimal port, new features have not been enabled. Only PolarSSL 1.2.5 and newer are accepted, as earlier versions contain unresolved (security) issues.
--- configure.ac | 4 ++-- src/openvpn/crypto_polarssl.h | 3 +-- src/openvpn/options.c | 4 ++++ src/openvpn/ssl_polarssl.c | 33 +++++---------------------------- src/openvpn/ssl_polarssl.h | 1 - src/openvpn/ssl_verify_polarssl.c | 21 +++++++++------------ src/openvpn/ssl_verify_polarssl.h | 22 ++++++++++------------ 7 files changed, 31 insertions(+), 57 deletions(-)
configure.ac +2 -2
@@ -805,8 +805,8 @@ if test "${with_crypto_library}" = "polarssl" ; then #include <polarssl/version.h> ]], [[ -#if POLARSSL_VERSION_NUMBER < 0x01010000 -#error invalid version +#if POLARSSL_VERSION_NUMBER < 0x01020500 +#error invalid version PolarSSL-1.2.5 or newer required #endif ]] )],
src/openvpn/crypto_polarssl.h +1 -2
@@ -30,7 +30,6 @@#ifndef CRYPTO_POLARSSL_H_ #define CRYPTO_POLARSSL_H_ -#include <polarssl/version.h> #include <polarssl/cipher.h> #include <polarssl/md.h> #include <polarssl/ctr_drbg.h>
@@ -60,7 +59,7 @@ typedef md_context_t hmac_ctx_t;#define OPENVPN_MODE_OFB POLARSSL_MODE_OFB/** Cipher is in CFB mode */ -#define OPENVPN_MODE_CFB POLARSSL_MODE_CFB128 +#define OPENVPN_MODE_CFB POLARSSL_MODE_CFB/** Cipher should encrypt */ #define OPENVPN_OP_ENCRYPT POLARSSL_ENCRYPT
src/openvpn/options.c +4 -0
@@ -827,7 +827,11 @@ init_options (struct options *o, const bool init_gc) o->server_poll_timeout =0 ;#endif #ifdef ENABLE_CRYPTO +#ifdef ENABLE_CRYPTO_POLARSSL + o->ciphername ="BLOWFISH-CBC" ; +#else o->ciphername ="BF-CBC" ; +#endif o->ciphername_defined = true; o->authname ="SHA1" ; o->authname_defined = true;
src/openvpn/ssl_polarssl.c +5 -28
@@ -65,23 +65,6 @@ tls_clear_error() { } -static int default_ciphersuites[] = -{ -SSL_EDH_RSA_AES_256_SHA , -SSL_EDH_RSA_CAMELLIA_256_SHA , -SSL_EDH_RSA_AES_128_SHA , -SSL_EDH_RSA_CAMELLIA_128_SHA , -SSL_EDH_RSA_DES_168_SHA , -SSL_RSA_AES_256_SHA , -SSL_RSA_CAMELLIA_256_SHA , -SSL_RSA_AES_128_SHA , -SSL_RSA_CAMELLIA_128_SHA , -SSL_RSA_DES_168_SHA , -SSL_RSA_RC4_128_SHA , -SSL_RSA_RC4_128_MD5 , -0 -}; -void tls_ctx_server_new (struct tls_root_ctx *ctx) {
@@ -514,20 +497,17 @@ void key_state_ssl_init(struct key_state_ssl *ks_ssl,ssl_set_rng (ks_ssl->ctx, ctr_drbg_random,rand_ctx_get ()); -ALLOC_OBJ_CLEAR (ks_ssl->ssn, ssl_session); -ssl_set_session (ks_ssl->ctx,0 ,0 , ks_ssl->ssn );if (ssl_ctx->allowed_ciphers)ssl_set_ciphersuites (ks_ssl->ctx, ssl_ctx->allowed_ciphers); -else -ssl_set_ciphersuites (ks_ssl->ctx, default_ciphersuites);/* Initialise authentication information */ if (is_server)ssl_set_dh_param_ctx (ks_ssl->ctx, ssl_ctx->dhm_ctx );#if defined(ENABLE_PKCS11 )if (ssl_ctx->priv_key_pkcs11 !=NULL ) -ssl_set_own_cert_pkcs11 ( ks_ssl->ctx, ssl_ctx->crt_chain, - ssl_ctx->priv_key_pkcs11 ); +ssl_set_own_cert_alt ( ks_ssl->ctx, ssl_ctx->crt_chain, + ssl_ctx->priv_key_pkcs11, ssl_pkcs11_decrypt, ssl_pkcs11_sign, + ssl_pkcs11_key_len ); else#endif ssl_set_own_cert ( ks_ssl->ctx, ssl_ctx->crt_chain, ssl_ctx->priv_key );
@@ -543,7 +523,6 @@ void key_state_ssl_init(struct key_state_ssl *ks_ssl,ALLOC_OBJ_CLEAR (ks_ssl->ct_out, endless_buffer);ssl_set_bio (ks_ssl->ctx, endless_buf_read, ks_ssl->ct_in, endless_buf_write, ks_ssl->ct_out); - } }
@@ -556,8 +535,6 @@ key_state_ssl_free(struct key_state_ssl *ks_ssl)ssl_free (ks_ssl->ctx);free (ks_ssl->ctx); } -if (ks_ssl->ssn) -free (ks_ssl->ssn);if (ks_ssl->ct_in) {buf_free_entries (ks_ssl->ct_in);free (ks_ssl->ct_in);
@@ -818,7 +795,7 @@ key_state_read_plaintext (struct key_state_ssl *ks, struct buffer *buf,void print_details (struct key_state_ssl * ks_ssl,const char *prefix) { -x509_cert *cert; +const x509_cert *cert;char s1[256 ];char s2[256 ];
@@ -828,7 +805,7 @@ print_details (struct key_state_ssl * ks_ssl, const char *prefix)ssl_get_version (ks_ssl->ctx), ssl_get_ciphersuite(ks_ssl->ctx)); - cert = ks_ssl->ctx->peer_cert; + cert =ssl_get_peer_cert (ks_ssl->ctx);if (cert !=NULL ) {openvpn_snprintf (s2,sizeof (s2),", " counter_format" bit RSA" , (counter_type ) cert->rsa.len *8 );
src/openvpn/ssl_polarssl.h +0 -1
@@ -73,7 +73,6 @@ struct tls_root_ctx {struct key_state_ssl {ssl_context *ctx; -ssl_session *ssn;endless_buffer *ct_in;endless_buffer *ct_out; };
src/openvpn/ssl_verify_polarssl.c +9 -12
@@ -44,11 +44,10 @@int verify_callback (void *session_obj,x509_cert *cert,int cert_depth, -int preverify_ok) +int *flags) {struct tls_session *session = (struct tls_session *) session_obj;struct gc_arena gc =gc_new (); -int ret =1 ;ASSERT (cert);ASSERT (session);
@@ -59,7 +58,7 @@ verify_callback (void *session_obj, x509_cert *cert, int cert_depth,cert_hash_remember (session, cert_depth,x509_get_sha1_hash (cert, &gc));/* did peer present cert which was signed by our root cert? */ -if (!preverify_ok) +if (*flags !=0 ) {char *subject =x509_get_subject (cert, &gc);
@@ -69,21 +68,19 @@ verify_callback (void *session_obj, x509_cert *cert, int cert_depth,msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, could not extract X509 " "subject string from certificate" , cert_depth); - goto cleanup; +/* Leave flags set to non-zero to indicate that the cert is not ok */ + } +else if (SUCCESS !=verify_cert (session, cert, cert_depth)) + { + *flags |=BADCERT_OTHER ; } -if (SUCCESS !=verify_cert (session, cert, cert_depth)) - goto cleanup; - - ret =0 ; - -cleanup:gc_free (&gc);/* -* PolarSSL expects 1 on failure, 0 on success +* PolarSSL-1.2.0+ expects 0 on anything except fatal errors. */ -return ret; +return 0 ; }#ifdef ENABLE_X509ALTUSERNAME
src/openvpn/ssl_verify_polarssl.h +10 -12
@@ -55,27 +55,25 @@ typedef x509_cert openvpn_x509_cert_t;* calls the PolarSSL library's \c ssl_set_verify_callback() function with \c * verify_callback() as its callback argument. * -* It checks preverify_ok, and registers the certificate hash. If these steps -* succeed, it calls the \c verify_cert() function, which performs -* OpenVPN-specific verification. +* It checks *flags and registers the certificate hash. If these steps succeed, +* it calls the \c verify_cert() function, which performs OpenVPN-specific +* verification. * * @param session_obj - The OpenVPN \c tls_session associated with this object, * as set during SSL session setup. * @param cert - The certificate used by PolarSSL. * @param cert_depth - The depth of the current certificate in the chain, with * 0 being the actual certificate. -* @param preverify_ok - Whether the remote OpenVPN peer's certificate -* past verification. A value of 1 means it -* verified successfully, 0 means it failed. +* @param flags - Whether the remote OpenVPN peer's certificate +* passed verification. A value of 0 means it +* verified successfully, any other value means it +* failed. \c verify_callback() is considered to have +* ok'ed this certificate if flags is 0 when it returns. * -* @return The return value indicates whether the supplied certificate is -* allowed to set up a VPN tunnel. The following values can be -* returned: -* - \c 0: failure, this certificate is not allowed to connect. -* - \c 1: success, this certificate is allowed to connect. +* @return The return value is 0 unless a fatal error occurred. */ int verify_callback (void *session_obj,x509_cert *cert,int cert_depth, -int preverify_ok); +int *flags);/** @} name Function for authenticating a new connection from a remote OpenVPN peer */
Signature · 1 line
1.7.9.5
Re: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
Quoted 6 lines · On Monday 18 March 2013 17:37:28 [email protected]... wrote:
src/openvpn/options.c +0
-0@@ -827,7 +827,11 @@ init_options (struct options *o, const bool init_gc) o->server_poll_timeout =0 ;
src/openvpn/options.c init_options (struct options *o, const bool init_gc) · line 837
Quoted 10 lines
src/openvpn/options.c +4
-0#endif #ifdef ENABLE_CRYPTO +#ifdef ENABLE_CRYPTO_POLARSSL + o->ciphername ="BLOWFISH-CBC" ; +#else o->ciphername ="BF-CBC" ; +#endif o->ciphername_defined = true; o->authname ="SHA1" ; o->authname_defined = true;
Couldn't this be done better with the functionality in 4/5?
Heiko
Signature · 2 lines
Heiko Hund | Sr. Software Engineer | Tel +49-721-25516-237 | Fax -200 SOPHOS NSG | Amalienbadstr. 41 Bau 52 | 76227 Karlsruhe | Germany
Re: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
Sure. There's two options here: remove it from 1/5 and 'break' BF-CBC between 1/5 and 4/5 (although BF wasn't supported by polar before 1.2 anyway), or revert these changes in 4/5. I'd go for first option, since it delivers cleaner patches. If no one objects, I'll send an updated patch this afternoon.
-Steffan
-----Original Message-----
From: Heiko Hund [mailto:[email protected]...]
Sent: dinsdag 19 maart 2013 11:27
To: [email protected]
Cc: Steffan Karger
Subject: Re: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
Quoted 6 lines · On Monday 18 March 2013 17:37:28 [email protected]... wrote:
src/openvpn/options.c index renamed from src/openvpn/options.c +0
-08592955..9766742 100644
src/openvpn/options.c +0
-0@@ -827,7 +827,11 @@ init_options (struct options *o, const bool init_gc) o->server_poll_timeout =0 ;
src/openvpn/options.c init_options (struct options *o, const bool init_gc) · line 837
Quoted 10 lines
src/openvpn/options.c +4
-0#endif #ifdef ENABLE_CRYPTO +#ifdef ENABLE_CRYPTO_POLARSSL + o->ciphername ="BLOWFISH-CBC" ; +#else o->ciphername ="BF-CBC" ; +#endif o->ciphername_defined = true; o->authname ="SHA1" ; o->authname_defined = true;
Couldn't this be done better with the functionality in 4/5?
Heiko
--
Heiko Hund | Sr. Software Engineer | Tel +49-721-25516-237 | Fax -200 SOPHOS NSG | Amalienbadstr. 41 Bau 52 | 76227 Karlsruhe | Germany
Re: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
Hi,
Quoted 1 line · Steffan Karger
Sure. There's two options here: remove it from 1/5 and 'break' BF-CBC between 1/5 and 4/5 (although BF wasn't supported by polar before 1.2 anyway), or revert these changes in 4/5. I'd go for first option, since it delivers cleaner patches. If no one objects, I'll send an updated patch this afternoon.
I think that "option 1" is fine. We'll apply these as a whole set, not individually, so breaking "in between" is no concern :-)
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]...Gert Doering
NAKRe: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
In reply to [email protected]...Hi,
Quoted 6 lines · On Mon, Mar 18, 2013 at 05:37:28PM +0100, [email protected]... wrote:
From: Steffan Karger <[email protected]...>
Add support for PolarSSL-1.2, which has changed the API in several places. This is a minimal port, new features have not been enabled. Only PolarSSL 1.2.5 and newer are accepted, as earlier versions contain unresolved (security) issues.
NAK, actually, for two reasons:
- there is "something wrong" with the blowfish support - patching release/2.3 in git with these 5 patches and compiling with polar 1.2.5 creates a binary that is not interoperating with openssl-compiled openvpn (cipher blowfish-cbc on the polar side, bf-cbc on openssl) - it negotiates just fine, but data packets cannot be decrypted
14:23 <@dazo> Tue Mar 19 14:16:08 2013 Authenticate/Decrypt packet error:
cipher final failed
- when configuring with --enable-pkcs11, compilation fails
14:17 <@dazo> ssl_polarssl.h:69:5: error: expected specifier-qualifier-list
before \u2018pkcs11_context\u2019
(I'm just relaying, David did the actual testing... my buildbot box is still busy trying to compile polar 1.2.6...)
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]...Steffan Karger
NAKRe: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
Hi,
Attached a patch for the second point you make. It was a pre-existing bug where the autoconf script was not equipped to detect incorrectly compiled polarssl builds, e.g. without pkcs11 support.
I'm still working on the first (polarssl-blowfish) point, need to do some more testing first on that one.
Regards,
-Steffan
-----Original Message-----
From: Gert Doering [mailto:[email protected]...]
Sent: dinsdag 19 maart 2013 15:27
To: Steffan Karger
Cc: [email protected]
Subject: Re: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
Hi,
Quoted 7 lines · On Mon, Mar 18, 2013 at 05:37:28PM +0100, [email protected]... wrote:
From: Steffan Karger <[email protected]...>
Add support for PolarSSL-1.2, which has changed the API in several places. This is a minimal port, new features have not been enabled. Only PolarSSL
1.2.5 and newer are accepted, as earlier versions contain unresolved (security) issues.
NAK, actually, for two reasons:
- there is "something wrong" with the blowfish support - patching release/2.3 in git with these 5 patches and compiling with polar 1.2.5 creates a binary that is not interoperating with openssl-compiled openvpn (cipher blowfish-cbc on the polar side, bf-cbc on openssl) - it negotiates just fine, but data packets cannot be decrypted
14:23 <@dazo> Tue Mar 19 14:16:08 2013 Authenticate/Decrypt packet error:
cipher final failed
- when configuring with --enable-pkcs11, compilation fails
14:17 <@dazo> ssl_polarssl.h:69:5: error: expected specifier-qualifier-list
before \u2018pkcs11_context\u2019
(I'm just relaying, David did the actual testing... my buildbot box is still busy trying to compile polar 1.2.6...)
gert
--
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 9cc74ae086b3152a65e32506822108356be70771 Mon Sep 17 00:00:00 2001
From: Steffan Karger <[email protected]>
Date: Wed, 20 Mar 2013 19:41:29 +0100
Subject: [PATCH] Fixed autoconf script to properly detect missing pkcs11 with
polarssl.
When polarssl is compiled without pkcs11 support, or a required pkcs11-helper library is missing, configure will now issue an error.
--- configure.ac | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 11 deletions(-)
configure.ac +43 -11
@@ -726,6 +726,13 @@ case "${with_mem_check}" in esac PKG_CHECK_MODULES( + [PKCS11_HELPER], + [libpkcs11-helper-1 >= 1.02], + [have_pkcs11_helper="yes"], + [] +) + +PKG_CHECK_MODULES( [OPENSSL_CRYPTO], [libcrypto >= 0.9.6], [have_openssl_crypto="yes"],
@@ -789,9 +796,11 @@ if test -z "${POLARSSL_LIBS}"; then [polarssl], [aes_crypt_cbc], , - [have_polarssl_crypto="no"] + [have_polarssl_crypto="no"], + [${PKCS11_HELPER_LIBS}] ) - ] + ], + [${PKCS11_HELPER_LIBS}] ) fi
@@ -806,14 +815,44 @@ if test "${with_crypto_library}" = "polarssl" ; then ]], [[ #if POLARSSL_VERSION_NUMBER < 0x01020500 -#error invalid version PolarSSL-1.2.5 or newer required +#error invalid version #endif ]] )], [AC_MSG_RESULT([ok])], - [AC_MSG_ERROR([invalid polarssl version])] + [AC_MSG_ERROR([PolarSSL 1.2.5 or newer required])] ) CFLAGS="${old_CFLAGS}" + + polarssl_with_pkcs11="no" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include <polarssl/config.h> + ]], + [[ +#ifndef POLARSSL_PKCS11_C +#error pkcs11 wrapper missing +#endif + ]] + )], + polarssl_with_pkcs11="yes") + + AC_MSG_CHECKING([polarssl pkcs11 support]) + if test "${enable_pkcs11}" = "yes"; then + if test "${polarssl_with_pkcs11}" = "yes"; then + AC_MSG_RESULT([ok]) + else + AC_MSG_ERROR([polarssl has no pkcs11 wrapper compiled in]) + fi + else + if test "${polarssl_with_pkcs11}" != "yes"; then + AC_MSG_RESULT([ok]) + else + AC_MSG_ERROR([PolarSSL compiled with PKCS11, while OpenVPN is not]) + fi + fi + fi AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
@@ -856,13 +895,6 @@ if test "${have_lzo}" = "yes"; then CFLAGS="${saved_CFLAGS}" fi -PKG_CHECK_MODULES( - [PKCS11_HELPER], - [libpkcs11-helper-1 >= 1.02], - [have_pkcs11_helper="yes"], - [] -) - AC_MSG_CHECKING([git checkout]) GIT_CHECKOUT="no" if test -n "${GIT}" -a -d "${srcdir}/.git"; then
Signature · 1 line
1.7.9.5
Re: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
Ack, I think this solves the PolarSSL with/without PKCS11-helper problem.
Quoted 71 lines
-----Original Message-----
From: Steffan Karger [mailto:[email protected]...]
Sent: woensdag 20 maart 2013 19:53
To: Gert Doering
Cc: [email protected]
Subject: Re: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 supportHi,
Attached a patch for the second point you make. It was a pre-existing bug where the autoconf script was not equipped to detect incorrectly compiled polarssl builds, e.g. without pkcs11 support.
I'm still working on the first (polarssl-blowfish) point, need to do some more testing first on that one.
Regards,
-Steffan-----Original Message-----
From: Gert Doering [mailto:[email protected]...]
Sent: dinsdag 19 maart 2013 15:27
To: Steffan Karger
Cc: [email protected]
Subject: Re: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 supportHi,
Quoted 3 lines · On Mon, Mar 18, 2013 at 05:37:28PM +0100, [email protected]... wrote:
From: Steffan Karger <[email protected]...>
Add support for PolarSSL-1.2, which has changed the API in several
places.
Quoted 4 lines
This is a minimal port, new features have not been enabled. Only PolarSSL
1.2.5 and newer are accepted, as earlier versions contain unresolved (security) issues.NAK, actually, for two reasons:
- there is "something wrong" with the blowfish support - patching release/2.3 in git with these 5 patches and compiling with polar
1.2.5
creates a binary that is not interoperating with openssl-compiled openvpn (cipher blowfish-cbc on the polar side, bf-cbc on openssl) -
it
negotiates just fine, but data packets cannot be decrypted14:23 <@dazo> Tue Mar 19 14:16:08 2013 Authenticate/Decrypt packet error:
cipher final failed- when configuring with --enable-pkcs11, compilation fails
14:17 <@dazo> ssl_polarssl.h:69:5: error: expected specifier-qualifier- list
before \u2018pkcs11_context\u2019(I'm just relaying, David did the actual testing... my buildbot box is still busy trying to compile polar 1.2.6...)
gert
--
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]...
muenchen.de
Steffan Karger
NAKRe: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
In reply to Steffan KargerHi,
Attached an updated version, which will not fail when polarssl is not installed in some system library path.
Sorry for the spam!
-Steffan
-----Original Message-----
From: Steffan Karger [mailto:[email protected]...]
Sent: woensdag 20 maart 2013 19:53
To: Gert Doering
Cc: [email protected]
Subject: Re: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
Hi,
Attached a patch for the second point you make. It was a pre-existing bug where the autoconf script was not equipped to detect incorrectly compiled polarssl builds, e.g. without pkcs11 support.
I'm still working on the first (polarssl-blowfish) point, need to do some more testing first on that one.
Regards,
-Steffan
-----Original Message-----
From: Gert Doering [mailto:[email protected]...]
Sent: dinsdag 19 maart 2013 15:27
To: Steffan Karger
Cc: [email protected]
Subject: Re: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
Hi,
Quoted 7 lines · On Mon, Mar 18, 2013 at 05:37:28PM +0100, [email protected]... wrote:
From: Steffan Karger <[email protected]...>
Add support for PolarSSL-1.2, which has changed the API in several places. This is a minimal port, new features have not been enabled. Only PolarSSL
1.2.5 and newer are accepted, as earlier versions contain unresolved (security) issues.
NAK, actually, for two reasons:
- there is "something wrong" with the blowfish support - patching release/2.3 in git with these 5 patches and compiling with polar 1.2.5 creates a binary that is not interoperating with openssl-compiled openvpn (cipher blowfish-cbc on the polar side, bf-cbc on openssl) - it negotiates just fine, but data packets cannot be decrypted
14:23 <@dazo> Tue Mar 19 14:16:08 2013 Authenticate/Decrypt packet error:
cipher final failed
- when configuring with --enable-pkcs11, compilation fails
14:17 <@dazo> ssl_polarssl.h:69:5: error: expected specifier-qualifier-list
before \u2018pkcs11_context\u2019
(I'm just relaying, David did the actual testing... my buildbot box is still busy trying to compile polar 1.2.6...)
gert
--
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 605700d761b26a69a7c856bb14e5184a902e2308 Mon Sep 17 00:00:00 2001
From: Steffan Karger <[email protected]>
Date: Thu, 21 Mar 2013 18:16:39 +0100
Subject: [PATCH 6/6] Fixed autoconf script to properly detect missing pkcs11
with polarssl.
When polarssl is compiled without pkcs11 support, or a required pkcs11-helper library is missing, configure will now issue an error.
--- configure.ac | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 11 deletions(-)
configure.ac +43 -11
@@ -726,6 +726,13 @@ case "${with_mem_check}" in esac PKG_CHECK_MODULES( + [PKCS11_HELPER], + [libpkcs11-helper-1 >= 1.02], + [have_pkcs11_helper="yes"], + [] +) + +PKG_CHECK_MODULES( [OPENSSL_CRYPTO], [libcrypto >= 0.9.6], [have_openssl_crypto="yes"],
@@ -789,9 +796,11 @@ if test -z "${POLARSSL_LIBS}"; then [polarssl], [aes_crypt_cbc], , - [have_polarssl_crypto="no"] + [have_polarssl_crypto="no"], + [${PKCS11_HELPER_LIBS}] ) - ] + ], + [${PKCS11_HELPER_LIBS}] ) fi
@@ -806,14 +815,44 @@ if test "${with_crypto_library}" = "polarssl" ; then ]], [[ #if POLARSSL_VERSION_NUMBER < 0x01020500 -#error invalid version PolarSSL-1.2.5 or newer required +#error invalid version #endif ]] )], [AC_MSG_RESULT([ok])], - [AC_MSG_ERROR([invalid polarssl version])] + [AC_MSG_ERROR([PolarSSL 1.2.5 or newer required])] ) + + polarssl_with_pkcs11="no" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include <polarssl/config.h> + ]], + [[ +#ifndef POLARSSL_PKCS11_C +#error pkcs11 wrapper missing +#endif + ]] + )], + polarssl_with_pkcs11="yes") CFLAGS="${old_CFLAGS}" + + AC_MSG_CHECKING([polarssl pkcs11 support]) + if test "${enable_pkcs11}" = "yes"; then + if test "${polarssl_with_pkcs11}" = "yes"; then + AC_MSG_RESULT([ok]) + else + AC_MSG_ERROR([polarssl has no pkcs11 wrapper compiled in]) + fi + else + if test "${polarssl_with_pkcs11}" != "yes"; then + AC_MSG_RESULT([ok]) + else + AC_MSG_ERROR([PolarSSL compiled with PKCS11, while OpenVPN is not]) + fi + fi + fi AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
@@ -856,13 +895,6 @@ if test "${have_lzo}" = "yes"; then CFLAGS="${saved_CFLAGS}" fi -PKG_CHECK_MODULES( - [PKCS11_HELPER], - [libpkcs11-helper-1 >= 1.02], - [have_pkcs11_helper="yes"], - [] -) - AC_MSG_CHECKING([git checkout]) GIT_CHECKOUT="no" if test -n "${GIT}" -a -d "${srcdir}/.git"; then
Signature · 1 line
1.7.9.5
Steffan Karger
NAKRe: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
In reply to Gert DoeringHi,
Attached a new version of the patch. It partly resolves the first issue, as it overrides the 32-bit default blowfish keysize with a sane 128 bit value. However, the options strings between openssl and polarssl still differ. That is fixed in an updated patch 4/5 which I will send shortly.
-Steffan
-----Original Message-----
From: Gert Doering [mailto:[email protected]...]
Sent: dinsdag 19 maart 2013 15:27
To: Steffan Karger
Cc: [email protected]
Subject: Re: [Openvpn-devel] [PATCH 1/5] PolarSSL-1.2 support
Hi,
Quoted 7 lines · On Mon, Mar 18, 2013 at 05:37:28PM +0100, [email protected]... wrote:
From: Steffan Karger <[email protected]...>
Add support for PolarSSL-1.2, which has changed the API in several places. This is a minimal port, new features have not been enabled. Only PolarSSL
1.2.5 and newer are accepted, as earlier versions contain unresolved (security) issues.
NAK, actually, for two reasons:
- there is "something wrong" with the blowfish support - patching release/2.3 in git with these 5 patches and compiling with polar 1.2.5 creates a binary that is not interoperating with openssl-compiled openvpn (cipher blowfish-cbc on the polar side, bf-cbc on openssl) - it negotiates just fine, but data packets cannot be decrypted
14:23 <@dazo> Tue Mar 19 14:16:08 2013 Authenticate/Decrypt packet error:
cipher final failed
- when configuring with --enable-pkcs11, compilation fails
14:17 <@dazo> ssl_polarssl.h:69:5: error: expected specifier-qualifier-list
before \u2018pkcs11_context\u2019
(I'm just relaying, David did the actual testing... my buildbot box is still busy trying to compile polar 1.2.6...)
gert
--
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 764dfc52e59af1de283a1d702904dba7caa58a26 Mon Sep 17 00:00:00 2001
From: Steffan Karger <[email protected]>
Date: Thu, 21 Mar 2013 11:16:29 +0100
Subject: [PATCH 1/6] PolarSSL-1.2 support
Add support for PolarSSL-1.2, which has changed the API in several places. This is a minimal port, new features have not been enabled. Only PolarSSL 1.2.5 and newer are accepted, as earlier versions contain unresolved (security) issues.
--- configure.ac | 4 ++-- src/openvpn/crypto_polarssl.c | 5 ++++- src/openvpn/crypto_polarssl.h | 3 +-- src/openvpn/ssl_polarssl.c | 33 +++++---------------------------- src/openvpn/ssl_polarssl.h | 1 - src/openvpn/ssl_verify_polarssl.c | 21 +++++++++------------ src/openvpn/ssl_verify_polarssl.h | 22 ++++++++++------------ 7 files changed, 31 insertions(+), 58 deletions(-)
configure.ac +2 -2
@@ -805,8 +805,8 @@ if test "${with_crypto_library}" = "polarssl" ; then #include <polarssl/version.h> ]], [[ -#if POLARSSL_VERSION_NUMBER < 0x01010000 -#error invalid version +#if POLARSSL_VERSION_NUMBER < 0x01020500 +#error invalid version PolarSSL-1.2.5 or newer required #endif ]] )],
src/openvpn/crypto_polarssl.c +4 -1
@@ -114,7 +114,7 @@ show_available_ciphers ()if (info && info->mode ==POLARSSL_MODE_CBC )printf ("%s %d bit default key\n" , - info->name, info->key_length); + info->name,cipher_kt_key_size (info) *8 ); ciphers++; }
@@ -339,6 +339,9 @@ cipher_kt_key_size (const cipher_info_t *cipher_kt) {if (NULL == cipher_kt)return 0 ; +if (POLARSSL_CIPHER_ID_BLOWFISH == cipher_kt->base->cipher) +return 128 /8 ;/* Override PolarSSL 32 bit default key size with sane 128 bit default */ +return cipher_kt->key_length/8 ; }
src/openvpn/crypto_polarssl.h +1 -2
@@ -30,7 +30,6 @@#ifndef CRYPTO_POLARSSL_H_ #define CRYPTO_POLARSSL_H_ -#include <polarssl/version.h> #include <polarssl/cipher.h> #include <polarssl/md.h> #include <polarssl/ctr_drbg.h>
@@ -60,7 +59,7 @@ typedef md_context_t hmac_ctx_t;#define OPENVPN_MODE_OFB POLARSSL_MODE_OFB/** Cipher is in CFB mode */ -#define OPENVPN_MODE_CFB POLARSSL_MODE_CFB128 +#define OPENVPN_MODE_CFB POLARSSL_MODE_CFB/** Cipher should encrypt */ #define OPENVPN_OP_ENCRYPT POLARSSL_ENCRYPT
src/openvpn/ssl_polarssl.c +5 -28
@@ -65,23 +65,6 @@ tls_clear_error() { } -static int default_ciphersuites[] = -{ -SSL_EDH_RSA_AES_256_SHA , -SSL_EDH_RSA_CAMELLIA_256_SHA , -SSL_EDH_RSA_AES_128_SHA , -SSL_EDH_RSA_CAMELLIA_128_SHA , -SSL_EDH_RSA_DES_168_SHA , -SSL_RSA_AES_256_SHA , -SSL_RSA_CAMELLIA_256_SHA , -SSL_RSA_AES_128_SHA , -SSL_RSA_CAMELLIA_128_SHA , -SSL_RSA_DES_168_SHA , -SSL_RSA_RC4_128_SHA , -SSL_RSA_RC4_128_MD5 , -0 -}; -void tls_ctx_server_new (struct tls_root_ctx *ctx) {
@@ -514,20 +497,17 @@ void key_state_ssl_init(struct key_state_ssl *ks_ssl,ssl_set_rng (ks_ssl->ctx, ctr_drbg_random,rand_ctx_get ()); -ALLOC_OBJ_CLEAR (ks_ssl->ssn, ssl_session); -ssl_set_session (ks_ssl->ctx,0 ,0 , ks_ssl->ssn );if (ssl_ctx->allowed_ciphers)ssl_set_ciphersuites (ks_ssl->ctx, ssl_ctx->allowed_ciphers); -else -ssl_set_ciphersuites (ks_ssl->ctx, default_ciphersuites);/* Initialise authentication information */ if (is_server)ssl_set_dh_param_ctx (ks_ssl->ctx, ssl_ctx->dhm_ctx );#if defined(ENABLE_PKCS11 )if (ssl_ctx->priv_key_pkcs11 !=NULL ) -ssl_set_own_cert_pkcs11 ( ks_ssl->ctx, ssl_ctx->crt_chain, - ssl_ctx->priv_key_pkcs11 ); +ssl_set_own_cert_alt ( ks_ssl->ctx, ssl_ctx->crt_chain, + ssl_ctx->priv_key_pkcs11, ssl_pkcs11_decrypt, ssl_pkcs11_sign, + ssl_pkcs11_key_len ); else#endif ssl_set_own_cert ( ks_ssl->ctx, ssl_ctx->crt_chain, ssl_ctx->priv_key );
@@ -543,7 +523,6 @@ void key_state_ssl_init(struct key_state_ssl *ks_ssl,ALLOC_OBJ_CLEAR (ks_ssl->ct_out, endless_buffer);ssl_set_bio (ks_ssl->ctx, endless_buf_read, ks_ssl->ct_in, endless_buf_write, ks_ssl->ct_out); - } }
@@ -556,8 +535,6 @@ key_state_ssl_free(struct key_state_ssl *ks_ssl)ssl_free (ks_ssl->ctx);free (ks_ssl->ctx); } -if (ks_ssl->ssn) -free (ks_ssl->ssn);if (ks_ssl->ct_in) {buf_free_entries (ks_ssl->ct_in);free (ks_ssl->ct_in);
@@ -818,7 +795,7 @@ key_state_read_plaintext (struct key_state_ssl *ks, struct buffer *buf,void print_details (struct key_state_ssl * ks_ssl,const char *prefix) { -x509_cert *cert; +const x509_cert *cert;char s1[256 ];char s2[256 ];
@@ -828,7 +805,7 @@ print_details (struct key_state_ssl * ks_ssl, const char *prefix)ssl_get_version (ks_ssl->ctx), ssl_get_ciphersuite(ks_ssl->ctx)); - cert = ks_ssl->ctx->peer_cert; + cert =ssl_get_peer_cert (ks_ssl->ctx);if (cert !=NULL ) {openvpn_snprintf (s2,sizeof (s2),", " counter_format" bit RSA" , (counter_type ) cert->rsa.len *8 );
src/openvpn/ssl_polarssl.h +0 -1
@@ -73,7 +73,6 @@ struct tls_root_ctx {struct key_state_ssl {ssl_context *ctx; -ssl_session *ssn;endless_buffer *ct_in;endless_buffer *ct_out; };
src/openvpn/ssl_verify_polarssl.c +9 -12
@@ -44,11 +44,10 @@int verify_callback (void *session_obj,x509_cert *cert,int cert_depth, -int preverify_ok) +int *flags) {struct tls_session *session = (struct tls_session *) session_obj;struct gc_arena gc =gc_new (); -int ret =1 ;ASSERT (cert);ASSERT (session);
@@ -59,7 +58,7 @@ verify_callback (void *session_obj, x509_cert *cert, int cert_depth,cert_hash_remember (session, cert_depth,x509_get_sha1_hash (cert, &gc));/* did peer present cert which was signed by our root cert? */ -if (!preverify_ok) +if (*flags !=0 ) {char *subject =x509_get_subject (cert, &gc);
@@ -69,21 +68,19 @@ verify_callback (void *session_obj, x509_cert *cert, int cert_depth,msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, could not extract X509 " "subject string from certificate" , cert_depth); - goto cleanup; +/* Leave flags set to non-zero to indicate that the cert is not ok */ + } +else if (SUCCESS !=verify_cert (session, cert, cert_depth)) + { + *flags |=BADCERT_OTHER ; } -if (SUCCESS !=verify_cert (session, cert, cert_depth)) - goto cleanup; - - ret =0 ; - -cleanup:gc_free (&gc);/* -* PolarSSL expects 1 on failure, 0 on success +* PolarSSL-1.2.0+ expects 0 on anything except fatal errors. */ -return ret; +return 0 ; }#ifdef ENABLE_X509ALTUSERNAME
src/openvpn/ssl_verify_polarssl.h +10 -12
@@ -55,27 +55,25 @@ typedef x509_cert openvpn_x509_cert_t;* calls the PolarSSL library's \c ssl_set_verify_callback() function with \c * verify_callback() as its callback argument. * -* It checks preverify_ok, and registers the certificate hash. If these steps -* succeed, it calls the \c verify_cert() function, which performs -* OpenVPN-specific verification. +* It checks *flags and registers the certificate hash. If these steps succeed, +* it calls the \c verify_cert() function, which performs OpenVPN-specific +* verification. * * @param session_obj - The OpenVPN \c tls_session associated with this object, * as set during SSL session setup. * @param cert - The certificate used by PolarSSL. * @param cert_depth - The depth of the current certificate in the chain, with * 0 being the actual certificate. -* @param preverify_ok - Whether the remote OpenVPN peer's certificate -* past verification. A value of 1 means it -* verified successfully, 0 means it failed. +* @param flags - Whether the remote OpenVPN peer's certificate +* passed verification. A value of 0 means it +* verified successfully, any other value means it +* failed. \c verify_callback() is considered to have +* ok'ed this certificate if flags is 0 when it returns. * -* @return The return value indicates whether the supplied certificate is -* allowed to set up a VPN tunnel. The following values can be -* returned: -* - \c 0: failure, this certificate is not allowed to connect. -* - \c 1: success, this certificate is allowed to connect. +* @return The return value is 0 unless a fatal error occurred. */ int verify_callback (void *session_obj,x509_cert *cert,int cert_depth, -int preverify_ok); +int *flags);/** @} name Function for authenticating a new connection from a remote OpenVPN peer */
Signature · 1 line
1.7.9.5
PATCH 2/5 Improve PolarSSL key_state_read_{cipher, plain}text messages
In reply to [email protected]...From: Steffan Karger <[email protected]...>
Instead of logging the fact that an error occured, log the error code and description (when available in the PolarSSL build).
--- src/openvpn/ssl_polarssl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
src/openvpn/ssl_polarssl.c +6 -2
@@ -643,6 +643,7 @@ key_state_read_ciphertext (struct key_state_ssl *ks, struct buffer *buf, {int retval =0 ;int len =0 ; +char error_message[1024 ];perf_push (PERF_BIO_READ_CIPHERTEXT );
@@ -668,7 +669,8 @@ key_state_read_ciphertext (struct key_state_ssl *ks, struct buffer *buf,perf_pop ();if (POLARSSL_ERR_NET_WANT_WRITE == retval ||POLARSSL_ERR_NET_WANT_READ == retval)return 0 ; -msg (D_TLS_ERRORS ,"TLS_ERROR: read tls_read_plaintext error" ); +error_strerror (retval, error_message,sizeof (error_message)); +msg (D_TLS_ERRORS ,"TLS_ERROR: read tls_read_ciphertext error: %d %s" , retval, error_message); buf->len =0 ;return -1 ; }
@@ -740,6 +742,7 @@ key_state_read_plaintext (struct key_state_ssl *ks, struct buffer *buf, {int retval =0 ;int len =0 ; +char error_message[1024 ];perf_push (PERF_BIO_READ_PLAINTEXT );
@@ -764,7 +767,8 @@ key_state_read_plaintext (struct key_state_ssl *ks, struct buffer *buf, {if (POLARSSL_ERR_NET_WANT_WRITE == retval ||POLARSSL_ERR_NET_WANT_READ == retval)return 0 ; -msg (D_TLS_ERRORS ,"TLS_ERROR: read tls_read_plaintext error" ); +error_strerror (retval, error_message,sizeof (error_message)); +msg (D_TLS_ERRORS ,"TLS_ERROR: read tls_read_plaintext error: %d %s" , retval, error_message); buf->len =0 ;perf_pop ();return -1 ;
Signature · 1 line
1.7.9.5
PATCH 3/5 Improve verify_callback messages
In reply to [email protected]...From: Steffan Karger <[email protected]...>
Print the *flags argument, which - for PolarSSL-1.2 - contains the reasons that the certificate failed (pre-)verification.
--- src/openvpn/ssl_verify_polarssl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
src/openvpn/ssl_verify_polarssl.c +3 -3
@@ -63,10 +63,10 @@ verify_callback (void *session_obj, x509_cert *cert, int cert_depth,char *subject =x509_get_subject (cert, &gc);if (subject) -msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, %s" , cert_depth, subject); +msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, flags=%0x, %s" , cert_depth, *flags, subject);else -msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, could not extract X509 " -"subject string from certificate" , cert_depth); +msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, flags=%0x, could not extract X509 " +"subject string from certificate" , *flags, cert_depth);/* Leave flags set to non-zero to indicate that the cert is not ok */ }
Signature · 1 line
1.7.9.5
Re: [Openvpn-devel] [PATCH 3/5] Improve verify_callback messages
Hi,
Attached an updated patch, which removes the stale 0 from %0x in the printf format string.
-Steffan
-----Original Message-----
From: Steffan Karger
Sent: maandag 18 maart 2013 17:38
To: [email protected]
Cc: Steffan Karger
Subject: [PATCH 3/5] Improve verify_callback messages
From: Steffan Karger <[email protected]...>
Print the *flags argument, which - for PolarSSL-1.2 - contains the reasons that the certificate failed (pre-)verification.
--- src/openvpn/ssl_verify_polarssl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
src/openvpn/ssl_verify_polarssl.c +4 -3
@@ -63,10 +63,10 @@ verify_callback (void *session_obj, x509_cert *cert, int cert_depth,char *subject =x509_get_subject (cert, &gc);if (subject) -msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, %s" , cert_depth, subject); +msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, flags=%0x, %s" , +cert_depth, *flags, subject);else -msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, could not extract X509 " -"subject string from certificate" , cert_depth); +msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, flags=%0x, could not extract X509 " +"subject string from certificate" , *flags, cert_depth);/* Leave flags set to non-zero to indicate that the cert is not ok */
}
--
1.7.9.5
From 876ffa01be12f57f77370283de6c4502496d3513 Mon Sep 17 00:00:00 2001
From: Steffan Karger <[email protected]>
Date: Tue, 19 Mar 2013 12:39:49 +0100
Subject: [PATCH 3/6] Improve verify_callback messages
Print the *flags argument, which - for PolarSSL-1.2 - contains the reasons that the certificate failed (pre-)verification.
--- src/openvpn/ssl_verify_polarssl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
src/openvpn/ssl_verify_polarssl.c +3 -3
@@ -63,10 +63,10 @@ verify_callback (void *session_obj, x509_cert *cert, int cert_depth,char *subject =x509_get_subject (cert, &gc);if (subject) -msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, %s" , cert_depth, subject); +msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, flags=%x, %s" , cert_depth, *flags, subject);else -msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, could not extract X509 " -"subject string from certificate" , cert_depth); +msg (D_TLS_ERRORS ,"VERIFY ERROR: depth=%d, flags=%x, could not extract X509 " +"subject string from certificate" , *flags, cert_depth);/* Leave flags set to non-zero to indicate that the cert is not ok */ }
Signature · 1 line
1.7.9.5
PATCH 4/5 Config compatibility patch. Added translate_cipher_name.
In reply to [email protected]...From: Steffan Karger <[email protected]...>
Added translate_cipher name to crypto_openssl.c and crypto_polarssl.c to translate between OpenVPN(/OpenSSL) and PolarSSL data channel cipher algorithm names. OpenSSL does not require any translating, PolarSSL does for a small number of algorithms. This improves on config file compatibility between the OpenSSL and PolarSSL builds.
--- src/openvpn/crypto_backend.h | 6 ++++++ src/openvpn/crypto_openssl.c | 6 ++++++ src/openvpn/crypto_polarssl.c | 26 ++++++++++++++++++++++++++ src/openvpn/options.c | 2 +- 4 files changed, 39 insertions(+), 1 deletion(-)
src/openvpn/crypto_backend.h +6 -0
@@ -63,6 +63,12 @@ void crypto_init_lib_engine (const char *engine_name);void crypto_init_dmalloc (void );#endif /* DMALLOC */ +/** +* Translate a data channel cipher name from the OpenVPN config file +* 'language' to the crypto library specific name. +*/ +const char *translate_cipher_name (const char *cipher_name); +void show_available_ciphers (void );void show_available_digests (void );
src/openvpn/crypto_openssl.c +6 -0
@@ -281,6 +281,12 @@ crypto_init_dmalloc (void) }#endif /* DMALLOC */ +const char * +translate_cipher_name (const char *cipher_name) { +// OpenSSL doesn't require any translation +return cipher_name; +} +void show_available_ciphers () {
src/openvpn/crypto_polarssl.c +26 -0
@@ -94,6 +94,32 @@ crypto_init_dmalloc (void) }#endif /* DMALLOC */ +typedef struct {const char * openvpn_name;const char * polarssl_name; }cipher_name_pair ; +cipher_name_pair cipher_name_translation_table[] = { + {"BF-CBC" ,"BLOWFISH-CBC" }, + {"BF-CFB" ,"BLOWFISH-CFB64" }, + {"CAMELLIA-128-CFB" ,"CAMELLIA-128-CFB128" }, + {"CAMELLIA-192-CFB" ,"CAMELLIA-192-CFB128" }, + {"CAMELLIA-256-CFB" ,"CAMELLIA-256-CFB128" } +}; + +const char * +translate_cipher_name (const char *cipher_name) { +cipher_name_pair pair; +size_t i =0 ; + +/* Search for a cipher name translation */ +for (; i <sizeof (cipher_name_translation_table) /sizeof (*cipher_name_translation_table); i++) + { + pair = cipher_name_translation_table[i]; +if (0 ==strcmp (cipher_name, pair.openvpn_name)) +return pair.polarssl_name;/* Translation found, return polarssl name */ + } + +/* No translation found, return original */ +return cipher_name; +} +void show_available_ciphers () {
src/openvpn/options.c +1 -1
@@ -6223,7 +6223,7 @@ add_option (struct options *options, {VERIFY_PERMISSION (OPT_P_CRYPTO ); options->ciphername_defined = true; - options->ciphername = p[1 ]; + options->ciphername =translate_cipher_name (p[1 ]);if (streq (options->ciphername,"none" )) { options->ciphername_defined = false;
Signature · 1 line
1.7.9.5
Re: [Openvpn-devel] [PATCH 4/5] Config compatibility patch. Added translate_cipher_name.
Hi,
src/openvpn/options.c add_option (struct options *options, · line 6229
Quoted 11 lines · On Mon, Mar 18, 2013 at 05:37:31PM +0100, [email protected]... wrote:
src/openvpn/options.c +1
-1@@ -6223,7 +6223,7 @@ add_option (struct options *options, {VERIFY_PERMISSION (OPT_P_CRYPTO ); options->ciphername_defined = true; - options->ciphername = p[1 ]; + options->ciphername =translate_cipher_name (p[1 ]);if (streq (options->ciphername,"none" )) { options->ciphername_defined = false;
Uh. NAK, unfortunately, because while this should work for the actual cipher translation, it fails OCC...
Tue Mar 19 15:45:01 2013 WARNING: 'cipher' is used inconsistently, local='cipher BLOWFISH-CBC', remote='cipher BF-CBC'
... incidentially, OCC also gives a hint why the interop test failed...
Tue Mar 19 15:45:01 2013 WARNING: 'keysize' is used inconsistently, local='keysize 32', remote='keysize 128' Tue Mar 19 15:45:01 2013 Data Channel Encrypt: Cipher 'BLOWFISH-CBC' initialized with 32 bit key
"wut?"
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]...Re: [Openvpn-devel] [PATCH 4/5] Config compatibility patch. Added translate_cipher_name.
Wow, 32 bit. I clearly did not put enough effort in testing polar's newly supported ciphers. I'll take a good look at this.
-Steffan
-----Original Message-----
From: Gert Doering [mailto:[email protected]...]
Sent: woensdag 20 maart 2013 9:53
To: Steffan Karger
Cc: [email protected]
Subject: Re: [Openvpn-devel] [PATCH 4/5] Config compatibility patch. Added translate_cipher_name.
Hi,
src/openvpn/options.c add_option (struct options *options, · line 6229
Quoted 11 lines · On Mon, Mar 18, 2013 at 05:37:31PM +0100, [email protected]... wrote:
src/openvpn/options.c +1
-1@@ -6223,7 +6223,7 @@ add_option (struct options *options, {VERIFY_PERMISSION (OPT_P_CRYPTO ); options->ciphername_defined = true; - options->ciphername = p[1 ]; + options->ciphername =translate_cipher_name (p[1 ]);if (streq (options->ciphername,"none" )) { options->ciphername_defined = false;
Uh. NAK, unfortunately, because while this should work for the actual cipher translation, it fails OCC...
Tue Mar 19 15:45:01 2013 WARNING: 'cipher' is used inconsistently, local='cipher BLOWFISH-CBC', remote='cipher BF-CBC'
... incidentially, OCC also gives a hint why the interop test failed...
Tue Mar 19 15:45:01 2013 WARNING: 'keysize' is used inconsistently, local='keysize 32', remote='keysize 128' Tue Mar 19 15:45:01 2013 Data Channel Encrypt: Cipher 'BLOWFISH-CBC' initialized with 32 bit key
"wut?"
gert
--
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]...
Re: [Openvpn-devel] [PATCH 4/5] Config compatibility patch. Added translate_cipher_name.
In reply to Gert DoeringHi,
Attached an updated version of the patch, which should resolve the issue. It passes t_client tests.
-Steffan
-----Original Message-----
From: Gert Doering [mailto:[email protected]...]
Sent: woensdag 20 maart 2013 9:53
To: Steffan Karger
Cc: [email protected]
Subject: Re: [Openvpn-devel] [PATCH 4/5] Config compatibility patch. Added translate_cipher_name.
Hi,
src/openvpn/options.c add_option (struct options *options, · line 6229
Quoted 11 lines · On Mon, Mar 18, 2013 at 05:37:31PM +0100, [email protected]... wrote:
src/openvpn/options.c +1
-1@@ -6223,7 +6223,7 @@ add_option (struct options *options, {VERIFY_PERMISSION (OPT_P_CRYPTO ); options->ciphername_defined = true; - options->ciphername = p[1 ]; + options->ciphername =translate_cipher_name (p[1 ]);if (streq (options->ciphername,"none" )) { options->ciphername_defined = false;
Uh. NAK, unfortunately, because while this should work for the actual cipher translation, it fails OCC...
Tue Mar 19 15:45:01 2013 WARNING: 'cipher' is used inconsistently, local='cipher BLOWFISH-CBC', remote='cipher BF-CBC'
... incidentially, OCC also gives a hint why the interop test failed...
Tue Mar 19 15:45:01 2013 WARNING: 'keysize' is used inconsistently, local='keysize 32', remote='keysize 128' Tue Mar 19 15:45:01 2013 Data Channel Encrypt: Cipher 'BLOWFISH-CBC' initialized with 32 bit key
"wut?"
gert
--
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 ef931c4136eddca407e7a224ea169e6a036fb63b Mon Sep 17 00:00:00 2001
From: Steffan Karger <[email protected]>
Date: Thu, 21 Mar 2013 12:53:14 +0100
Subject: [PATCH 4/6] Config compatibility patch. Added translate_cipher_name.
Added translate_cipher name to crypto_openssl.c and crypto_polarssl.c to translate between OpenVPN(/OpenSSL) and PolarSSL data channel cipher algorithm names. OpenSSL does not require any translating, PolarSSL does for a small number of algorithms. This improves on config file compatibility between the OpenSSL and PolarSSL builds.
--- src/openvpn/crypto.c | 2 +- src/openvpn/crypto_backend.h | 12 ++++++++++ src/openvpn/crypto_openssl.c | 12 ++++++++++ src/openvpn/crypto_polarssl.c | 52 +++++++++++++++++++++++++++++++++++++++-- 4 files changed, 75 insertions(+), 3 deletions(-)
src/openvpn/crypto.c +1 -1
@@ -401,7 +401,7 @@ init_key_type (struct key_type *kt, const char *ciphername,CLEAR (*kt);if (ciphername && ciphername_defined) { - kt->cipher =cipher_kt_get (ciphername); + kt->cipher =cipher_kt_get (translate_cipher_name_from_openvpn (ciphername)); kt->cipher_length =cipher_kt_key_size (kt->cipher);if (keysize >0 && keysize <=MAX_CIPHER_KEY_LENGTH ) kt->cipher_length = keysize;
src/openvpn/crypto_backend.h +12 -0
@@ -63,6 +63,18 @@ void crypto_init_lib_engine (const char *engine_name);void crypto_init_dmalloc (void );#endif /* DMALLOC */ +/** +* Translate a data channel cipher name from the OpenVPN config file +* 'language' to the crypto library specific name. +*/ +const char *translate_cipher_name_from_openvpn (const char *cipher_name); + +/** +* Translate a data channel cipher name from the crypto library specific name +* to the OpenVPN config file 'language'. +*/ +const char *translate_cipher_name_from_openvpn (const char *cipher_name); +void show_available_ciphers (void );void show_available_digests (void );
src/openvpn/crypto_openssl.c +12 -0
@@ -281,6 +281,18 @@ crypto_init_dmalloc (void) }#endif /* DMALLOC */ +const char * +translate_cipher_name_from_openvpn (const char *cipher_name) { +// OpenSSL doesn't require any translation +return cipher_name; +} + +const char * +translate_cipher_name_to_openvpn (const char *cipher_name) { +// OpenSSL doesn't require any translation +return cipher_name; +} +void show_available_ciphers () {
src/openvpn/crypto_polarssl.c +50 -2
70 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [Openvpn-devel] [PATCH 4/5] Config compatibility patch. Added translate_cipher_name.
Hi,
Quoted 1 line · Steffan Karger
Attached an updated version of the patch, which should resolve the issue. It passes
t_clienttests.
It does! OCC is happy now, keysize defaults to 128 bits now, so I am happy to report that
"release/2.3 plus your most recent patches 1-6"
will a) compile with polar 1.2.6 (on FreeBSD), and b) pass all my t_client tests as well with all cipher/crypto related options "at default", talking to an openssl-openvpn server, also "all options at default":
Test sets succeded: 1 1a 2 2a 2b 3 4 4a 5.
Test sets failed: none.
So there's an ACK from me as well (tested and stared at the code).
Now, due to adding a "patch 6/5" to the series afterwards, and sending new versions of patch 1 and patch 4, the whole mail thread is a bit confusing now. Since we're aiming for maximum transparency regarding "which bits go in the tree and why", may I ask you to "git send-email" these 6 patches in their most recent version in one new thread again (and Adriaan to ACK *those* as well)?
That way we'll have a definite patch set in one single thread, and I can merge that with less chance of accident.
thanks in advance, and for the work done this week!
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]...PATCH 5/5 Switch to IANA names for TLS ciphers.
In reply to [email protected]...From: Steffan Karger <[email protected]...>
Added translation table and functions to translate between TLS OpenSSL and IANA (IETF) cipher suite names. The previously used OpenSSL names are still accepted, but a deprecation warning is issued.
--- src/openvpn/ssl.c | 147 ++++++++++++++++++++++++++++++++++++++++++++ src/openvpn/ssl_backend.h | 9 +++ src/openvpn/ssl_openssl.c | 77 ++++++++++++++++++++++- src/openvpn/ssl_polarssl.c | 22 ++++++- 4 files changed, 251 insertions(+), 4 deletions(-)
src/openvpn/ssl.c +147 -0
@@ -113,6 +113,153 @@ show_tls_performance_stats(void)#endif +/** +* SSL/TLS Cipher suite name translation table +*/ +static const tls_cipher_name_pair tls_cipher_name_translation_table[] = { + {"ADH-SEED-SHA" ,"TLS-DH-anon-WITH-SEED-CBC-SHA" }, + {"AES128-GCM-SHA256" ,"TLS-RSA-WITH-AES-128-GCM-SHA256" }, + {"AES128-SHA256" ,"TLS-RSA-WITH-AES-128-CBC-SHA256" }, + {"AES128-SHA" ,"TLS-RSA-WITH-AES-128-CBC-SHA" }, + {"AES256-GCM-SHA384" ,"TLS-RSA-WITH-AES-256-GCM-SHA384" }, + {"AES256-SHA256" ,"TLS-RSA-WITH-AES-256-CBC-SHA256" }, + {"AES256-SHA" ,"TLS-RSA-WITH-AES-256-CBC-SHA" }, + {"CAMELLIA128-SHA256" ,"TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256" }, + {"CAMELLIA128-SHA" ,"TLS-RSA-WITH-CAMELLIA-128-CBC-SHA" }, + {"CAMELLIA256-SHA256" ,"TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256" }, + {"CAMELLIA256-SHA" ,"TLS-RSA-WITH-CAMELLIA-256-CBC-SHA" }, + {"DES-CBC3-SHA" ,"TLS-RSA-WITH-3DES-EDE-CBC-SHA" }, + {"DES-CBC-SHA" ,"TLS-RSA-WITH-DES-CBC-SHA" }, + {"DH-DSS-SEED-SHA" ,"TLS-DH-DSS-WITH-SEED-CBC-SHA" }, + {"DHE-DSS-AES128-GCM-SHA256" ,"TLS-DHE-DSS-WITH-AES-128-GCM-SHA256" }, + {"DHE-DSS-AES128-SHA256" ,"TLS-DHE-DSS-WITH-AES-128-CBC-SHA256" }, + {"DHE-DSS-AES128-SHA" ,"TLS-DHE-DSS-WITH-AES-128-CBC-SHA" }, + {"DHE-DSS-AES256-GCM-SHA384" ,"TLS-DHE-DSS-WITH-AES-256-GCM-SHA384" }, + {"DHE-DSS-AES256-SHA256" ,"TLS-DHE-DSS-WITH-AES-256-CBC-SHA256" }, + {"DHE-DSS-AES256-SHA" ,"TLS-DHE-DSS-WITH-AES-256-CBC-SHA" }, + {"DHE-DSS-CAMELLIA128-SHA256" ,"TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256" }, + {"DHE-DSS-CAMELLIA128-SHA" ,"TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA" }, + {"DHE-DSS-CAMELLIA256-SHA256" ,"TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256" }, + {"DHE-DSS-CAMELLIA256-SHA" ,"TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA" }, + {"DHE-DSS-DES-CBC3-SHA" ,"TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA" }, + {"DHE-DSS-DES-CBC-SHA" ,"TLS-DHE-DSS-WITH-DES-CBC-SHA" }, + {"DHE-DSS-SEED-SHA" ,"TLS-DHE-DSS-WITH-SEED-CBC-SHA" }, + {"DHE-RSA-AES128-GCM-SHA256" ,"TLS-DHE-RSA-WITH-AES-128-GCM-SHA256" }, + {"DHE-RSA-AES128-SHA256" ,"TLS-DHE-RSA-WITH-AES-128-CBC-SHA256" }, + {"DHE-RSA-AES128-SHA" ,"TLS-DHE-RSA-WITH-AES-128-CBC-SHA" }, + {"DHE-RSA-AES256-GCM-SHA384" ,"TLS-DHE-RSA-WITH-AES-256-GCM-SHA384" }, + {"DHE-RSA-AES256-SHA256" ,"TLS-DHE-RSA-WITH-AES-256-CBC-SHA256" }, + {"DHE-RSA-AES256-SHA" ,"TLS-DHE-RSA-WITH-AES-256-CBC-SHA" }, + {"DHE-RSA-CAMELLIA128-SHA256" ,"TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256" }, + {"DHE-RSA-CAMELLIA128-SHA" ,"TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA" }, + {"DHE-RSA-CAMELLIA256-SHA256" ,"TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256" }, + {"DHE-RSA-CAMELLIA256-SHA" ,"TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA" }, + {"DHE-RSA-DES-CBC3-SHA" ,"TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA" }, + {"DHE-RSA-DES-CBC-SHA" ,"TLS-DHE-RSA-WITH-DES-CBC-SHA" }, + {"DHE-RSA-SEED-SHA" ,"TLS-DHE-RSA-WITH-SEED-CBC-SHA" }, + {"DH-RSA-SEED-SHA" ,"TLS-DH-RSA-WITH-SEED-CBC-SHA" }, + {"ECDH-ECDSA-AES128-GCM-SHA256" ,"TLS-ECDH-ECDSA-WITH-AES-128-GCM-SHA256" }, + {"ECDH-ECDSA-AES128-SHA256" ,"TLS-ECDH-ECDSA-WITH-AES-128-CBC-SHA256" }, + {"ECDH-ECDSA-AES128-SHA" ,"TLS-ECDH-ECDSA-WITH-AES-128-CBC-SHA" }, + {"ECDH-ECDSA-AES256-GCM-SHA384" ,"TLS-ECDH-ECDSA-WITH-AES-256-GCM-SHA384" }, + {"ECDH-ECDSA-AES256-SHA256" ,"TLS-ECDH-ECDSA-WITH-AES-256-CBC-SHA256" }, + {"ECDH-ECDSA-AES256-SHA384" ,"TLS-ECDH-ECDSA-WITH-AES-256-CBC-SHA384" }, + {"ECDH-ECDSA-AES256-SHA" ,"TLS-ECDH-ECDSA-WITH-AES-256-CBC-SHA" }, + {"ECDH-ECDSA-CAMELLIA128-SHA256" ,"TLS-ECDH-ECDSA-WITH-CAMELLIA-128-CBC-SHA256" }, + {"ECDH-ECDSA-CAMELLIA128-SHA" ,"TLS-ECDH-ECDSA-WITH-CAMELLIA-128-CBC-SHA" }, + {"ECDH-ECDSA-CAMELLIA256-SHA256" ,"TLS-ECDH-ECDSA-WITH-CAMELLIA-256-CBC-SHA256" }, + {"ECDH-ECDSA-CAMELLIA256-SHA" ,"TLS-ECDH-ECDSA-WITH-CAMELLIA-256-CBC-SHA" }, + {"ECDH-ECDSA-DES-CBC3-SHA" ,"TLS-ECDH-ECDSA-WITH-3DES-EDE-CBC-SHA" }, + {"ECDH-ECDSA-DES-CBC-SHA" ,"TLS-ECDH-ECDSA-WITH-DES-CBC-SHA" }, + {"ECDH-ECDSA-RC4-SHA" ,"TLS-ECDH-ECDSA-WITH-RC4-128-SHA" }, + {"ECDHE-ECDSA-AES128-GCM-SHA256" ,"TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256" }, + {"ECDHE-ECDSA-AES128-SHA256" ,"TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256" }, + {"ECDHE-ECDSA-AES128-SHA384" ,"TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA384" }, + {"ECDHE-ECDSA-AES128-SHA" ,"TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA" }, + {"ECDHE-ECDSA-AES256-GCM-SHA384" ,"TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384" }, + {"ECDHE-ECDSA-AES256-SHA256" ,"TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA256" }, + {"ECDHE-ECDSA-AES256-SHA384" ,"TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384" }, + {"ECDHE-ECDSA-AES256-SHA" ,"TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA" }, + {"ECDHE-ECDSA-CAMELLIA128-SHA256" ,"TLS-ECDHE-ECDSA-WITH-CAMELLIA-128-CBC-SHA256" }, + {"ECDHE-ECDSA-CAMELLIA128-SHA" ,"TLS-ECDHE-ECDSA-WITH-CAMELLIA-128-CBC-SHA" }, + {"ECDHE-ECDSA-CAMELLIA256-SHA256" ,"TLS-ECDHE-ECDSA-WITH-CAMELLIA-256-CBC-SHA256" }, + {"ECDHE-ECDSA-CAMELLIA256-SHA" ,"TLS-ECDHE-ECDSA-WITH-CAMELLIA-256-CBC-SHA" }, + {"ECDHE-ECDSA-DES-CBC3-SHA" ,"TLS-ECDHE-ECDSA-WITH-3DES-EDE-CBC-SHA" }, + {"ECDHE-ECDSA-DES-CBC-SHA" ,"TLS-ECDHE-ECDSA-WITH-DES-CBC-SHA" }, + {"ECDHE-ECDSA-RC4-SHA" ,"TLS-ECDHE-ECDSA-WITH-RC4-128-SHA" }, + {"ECDHE-RSA-AES128-GCM-SHA256" ,"TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256" }, + {"ECDHE-RSA-AES128-SHA256" ,"TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256" }, + {"ECDHE-RSA-AES128-SHA384" ,"TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA384" }, + {"ECDHE-RSA-AES128-SHA" ,"TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA" }, + {"ECDHE-RSA-AES256-GCM-SHA384" ,"TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384" }, + {"ECDHE-RSA-AES256-SHA256" ,"TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA256" }, + {"ECDHE-RSA-AES256-SHA384" ,"TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384" }, + {"ECDHE-RSA-AES256-SHA" ,"TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA" }, + {"ECDHE-RSA-CAMELLIA128-SHA256" ,"TLS-ECDHE-RSA-WITH-CAMELLIA-128-CBC-SHA256" }, + {"ECDHE-RSA-CAMELLIA128-SHA" ,"TLS-ECDHE-RSA-WITH-CAMELLIA-128-CBC-SHA" }, + {"ECDHE-RSA-CAMELLIA256-SHA256" ,"TLS-ECDHE-RSA-WITH-CAMELLIA-256-CBC-SHA256" }, + {"ECDHE-RSA-CAMELLIA256-SHA" ,"TLS-ECDHE-RSA-WITH-CAMELLIA-256-CBC-SHA" }, + {"ECDHE-RSA-DES-CBC3-SHA" ,"TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA" }, + {"ECDHE-RSA-DES-CBC-SHA" ,"TLS-ECDHE-RSA-WITH-DES-CBC-SHA" }, + {"ECDHE-RSA-RC4-SHA" ,"TLS-ECDHE-RSA-WITH-RC4-128-SHA" }, + {"ECDH-RSA-AES128-GCM-SHA256" ,"TLS-ECDH-RSA-WITH-AES-128-GCM-SHA256" }, + {"ECDH-RSA-AES128-SHA256" ,"TLS-ECDH-RSA-WITH-AES-128-CBC-SHA256" }, + {"ECDH-RSA-AES128-SHA384" ,"TLS-ECDH-RSA-WITH-AES-128-CBC-SHA384" }, + {"ECDH-RSA-AES128-SHA" ,"TLS-ECDH-RSA-WITH-AES-128-CBC-SHA" }, + {"ECDH-RSA-AES256-GCM-SHA384" ,"TLS-ECDH-RSA-WITH-AES-256-GCM-SHA384" }, + {"ECDH-RSA-AES256-SHA256" ,"TLS-ECDH-RSA-WITH-AES-256-CBC-SHA256" }, + {"ECDH-RSA-AES256-SHA384" ,"TLS-ECDH-RSA-WITH-AES-256-CBC-SHA384" }, + {"ECDH-RSA-AES256-SHA" ,"TLS-ECDH-RSA-WITH-AES-256-CBC-SHA" }, + {"ECDH-RSA-CAMELLIA128-SHA256" ,"TLS-ECDH-RSA-WITH-CAMELLIA-128-CBC-SHA256" }, + {"ECDH-RSA-CAMELLIA128-SHA" ,"TLS-ECDH-RSA-WITH-CAMELLIA-128-CBC-SHA" }, + {"ECDH-RSA-CAMELLIA256-SHA256" ,"TLS-ECDH-RSA-WITH-CAMELLIA-256-CBC-SHA256" }, + {"ECDH-RSA-CAMELLIA256-SHA" ,"TLS-ECDH-RSA-WITH-CAMELLIA-256-CBC-SHA" }, + {"ECDH-RSA-DES-CBC3-SHA" ,"TLS-ECDH-RSA-WITH-3DES-EDE-CBC-SHA" }, + {"ECDH-RSA-DES-CBC-SHA" ,"TLS-ECDH-RSA-WITH-DES-CBC-SHA" }, + {"ECDH-RSA-RC4-SHA" ,"TLS-ECDH-RSA-WITH-RC4-128-SHA" }, + {"EDH-DSS-DES-CBC3-SHA" ,"TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA" }, + {"EDH-DSS-DES-CBC-SHA" ,"TLS-DHE-DSS-WITH-DES-CBC-SHA" }, + {"EDH-RSA-DES-CBC3-SHA" ,"TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA" }, + {"EDH-RSA-DES-CBC-SHA" ,"TLS-DHE-RSA-WITH-DES-CBC-SHA" }, + {"EXP-DES-CBC-SHA" ,"TLS-RSA-EXPORT-WITH-DES40-CBC-SHA" }, + {"EXP-EDH-DSS-DES-CBC-SHA" ,"TLS-DH-DSS-EXPORT-WITH-DES40-CBC-SHA" }, + {"EXP-EDH-RSA-DES-CBC-SHA" ,"TLS-DH-RSA-EXPORT-WITH-DES40-CBC-SHA" }, + {"EXP-RC2-CBC-MD5" ,"TLS-RSA-EXPORT-WITH-RC2-CBC-40-MD5" }, + {"EXP-RC4-MD5" ,"TLS-RSA-EXPORT-WITH-RC4-40-MD5" }, + {"NULL-MD5" ,"TLS-RSA-WITH-NULL-MD5" }, + {"NULL-SHA256" ,"TLS-RSA-WITH-NULL-SHA256" }, + {"NULL-SHA" ,"TLS-RSA-WITH-NULL-SHA" }, + {"PSK-3DES-EDE-CBC-SHA" ,"TLS-PSK-WITH-3DES-EDE-CBC-SHA" }, + {"PSK-AES128-CBC-SHA" ,"TLS-PSK-WITH-AES-128-CBC-SHA" }, + {"PSK-AES256-CBC-SHA" ,"TLS-PSK-WITH-AES-256-CBC-SHA" }, + {"PSK-RC4-SHA" ,"TLS-PSK-WITH-RC4-128-SHA" }, + {"RC4-MD5" ,"TLS-RSA-WITH-RC4-128-MD5" }, + {"RC4-SHA" ,"TLS-RSA-WITH-RC4-128-SHA" }, + {"SEED-SHA" ,"TLS-RSA-WITH-SEED-CBC-SHA" }, + {"SRP-DSS-3DES-EDE-CBC-SHA" ,"TLS-SRP-SHA-DSS-WITH-3DES-EDE-CBC-SHA" }, + {"SRP-DSS-AES-128-CBC-SHA" ,"TLS-SRP-SHA-DSS-WITH-AES-128-CBC-SHA" }, + {"SRP-DSS-AES-256-CBC-SHA" ,"TLS-SRP-SHA-DSS-WITH-AES-256-CBC-SHA" }, + {"SRP-RSA-3DES-EDE-CBC-SHA" ,"TLS-SRP-SHA-RSA-WITH-3DES-EDE-CBC-SHA" }, + {"SRP-RSA-AES-128-CBC-SHA" ,"TLS-SRP-SHA-RSA-WITH-AES-128-CBC-SHA" }, + {"SRP-RSA-AES-256-CBC-SHA" ,"TLS-SRP-SHA-RSA-WITH-AES-256-CBC-SHA" }, + {NULL ,NULL } +}; + +const tls_cipher_name_pair * +tls_get_cipher_name_pair (const char * cipher_name,size_t len) { +const tls_cipher_name_pair * pair = tls_cipher_name_translation_table; + +while (pair->openssl_name !=NULL ) { +if ((strlen (pair->openssl_name) == len &&0 ==memcmp (cipher_name, pair->openssl_name, len)) || + (strlen (pair->iana_name) == len &&0 ==memcmp (cipher_name, pair->iana_name, len))) { +return pair; + } + pair++; + } + +// No entry found, return NULL +return NULL ; +}/* * Max number of bytes we will add
src/openvpn/ssl_backend.h +9 -0
@@ -43,6 +43,15 @@#endif +/** +* Get a tls_cipher_name_pair containing OpenSSL and IANA names for supplied TLS cipher name +* +* @param cipher_name Can be either OpenSSL or IANA cipher name +* @return tls_cipher_name_pair* if found, NULL otherwise +*/ +typedef struct {const char *openssl_name;const char *iana_name; }tls_cipher_name_pair ; +const tls_cipher_name_pair *tls_get_cipher_name_pair (const char *cipher_name,size_t len); +/* * * Functions implemented in ssl.c for use by the backend SSL library
src/openvpn/ssl_openssl.c +74 -3
97 lines not on this page · raw message
src/openvpn/ssl_polarssl.c +21 -1
@@ -144,6 +144,25 @@ tls_ctx_set_options (struct tls_root_ctx *ctx, unsigned int ssl_flags) { } +static const char * +tls_translate_cipher_name (const char * cipher_name) { +const tls_cipher_name_pair * pair =tls_get_cipher_name_pair (cipher_name,strlen (cipher_name)); + +if (NULL == pair) + { +// No translation found, return original +return cipher_name; + } + +if (0 !=strcmp (cipher_name, pair->iana_name)) + { +// Deprecated name found, notify user +msg (M_WARN ,"Deprecated cipher suite name '%s', please use IANA name '%s'" , pair->openssl_name, pair->iana_name); + } + +return pair->iana_name; +} +void tls_ctx_restrict_ciphers (struct tls_root_ctx *ctx,const char *ciphers) {
@@ -169,7 +188,8 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers) token =strtok (tmp_ciphers,":" );while (token) { - ctx->allowed_ciphers[i] =ssl_get_ciphersuite_id (token); + ctx->allowed_ciphers[i] =ssl_get_ciphersuite_id ( +tls_translate_cipher_name (token));if (0 != ctx->allowed_ciphers[i]) i++; token =strtok (NULL ,":" );
Signature · 1 line
1.7.9.5
Ack on patches 1-5!
Quoted 37 lines
-----Original Message-----
From: [email protected]... [mailto:[email protected]...]
Sent: maandag 18 maart 2013 17:37
To: [email protected]
Subject: [Openvpn-devel] PolarSSL 1.2 support, while keeping config file compatibilityHi Everyone,
The attached patches add PolarSSL 1.2 support to OpenVPN 2.3, while maintaining OpenVPN configuration file compatibility between the OpenSSL and PolarSSL builds.
Patches 1-3 upgrade the supported PolarSSL versions to 1.2.5 or newer.
Patch 4 adds data channel cipher name compatibility.
Patch 5 adds TLS control channel cipher suite name compatibility as discussed at FOSDEM. It makes the IANA (IETF) cipher suite naming that PolarSSL uses since 1.2 the preferred format, but still accepts OpenSSL names. It attempts to tranlate cipher names in both directions whenever required.
Regards,
-Steffan-----------------------------------------------------------------------
-------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel