Updated PolarSSL 1.2 support patch set
Hi,
This patch set replaces the earlier PolarSSL 1.2 support patches. It contains all the changes in response to feedback on the previous versions, and should be ready to be merged.
-Steffan
PATCH 1/6 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.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/6 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/6 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=%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/6 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.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
PATCH 5/6 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
PATCH 6/6 Fixed autoconf script to properly detect missing pkcs11 with polarssl.
In reply to [email protected]...From: Steffan Karger <[email protected]...>
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
Ack from my side on the patch set. I've looked at them and haven't found any issues.
Quoted 25 lines
-----Original Message-----
From: [email protected]... [mailto:[email protected]...]
Sent: vrijdag 22 maart 2013 9:54
To: [email protected]
Subject: [Openvpn-devel] Updated PolarSSL 1.2 support patch setHi,
This patch set replaces the earlier PolarSSL 1.2 support patches. It contains all the changes in response to feedback on the previous versions, and should be ready to be merged.
-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
Hi,
Quoted 1 line · On Fri, Mar 22, 2013 at 09:54:19AM +0100, [email protected]... wrote:
This patch set replaces the earlier PolarSSL 1.2 support patches. It contains all the changes in response to feedback on the previous versions, and should be ready to be merged.
Thanks.
I did review the patches again. The code is fully identical to the last set of patches in "the big thread", so nothing new in here. The only place where I'm not exactly sure what the code does is patch 1/6, understanding that would need more detailed study of the polarssl 1.1 and 1.2 APIs (which I trust Adriaan to have done).
Compile and t_client tests on FreeBSD 7.4 succeeded, with default cipher and default keysize, so with these we now have full compatibility in default cipher mode between openssl-openvpn and polarssl-openvpn.
-> ACK!
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]...[Openvpn-devel] [PATCH applied] Re: PolarSSL-1.2 support
In reply to [email protected]...Your patch has been applied to the master and release/2.3 branch.
commit 4a56d19fc3aa59d0eebd99f102ecaaa3665c5088 (master) commit c5857cd49d17ec5ebe027ef94231312087a9c306 (master)
Author: Steffan Karger Date: Fri Mar 22 09:54:20 2013 +0100
PolarSSL-1.2 support
Signed-off-by: Joachim Schipper <[email protected]...>
Signed-off-by: Steffan Karger <[email protected]...>
Acked-by: Adriaan de Jong <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7436
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
[Openvpn-devel] [PATCH applied] Re: Improve PolarSSL key_state_read_{cipher, plain}text messages
In reply to [email protected]...Your patch has been applied to the master and release/2.3 branch.
commit 0219f115f3a2711d5c51457d6e97d6930916653b (master) commit bf71c15a2f3ccb0acc6360dfbe071f6bcbf71538 (release/2.3)
Author: Steffan Karger Date: Fri Mar 22 09:54:21 2013 +0100
Improve PolarSSL key_state_read_{cipher, plain}text messages
Signed-off-by: Joachim Schipper <[email protected]...>
Acked-by: Adriaan de Jong <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7440
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
[Openvpn-devel] [PATCH applied] Re: Improve verify_callback messages
In reply to [email protected]...Your patch has been applied to the master and release/2.3 branch.
commit d572959d35e8920efb8d95d253ededee5d8a34bd (master) commit b3ac0bc2ad962b2968939e0e03e888c0d4193114 (master)
Author: Steffan Karger Date: Fri Mar 22 09:54:22 2013 +0100
Improve verify_callback messages
Signed-off-by: Joachim Schipper <[email protected]...>
Acked-by: Adriaan de Jong <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7437
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
[Openvpn-devel] [PATCH applied] Re: Config compatibility patch. Added translate_cipher_name.
In reply to [email protected]...Your patch has been applied to the master and release/2.3 branch.
commit f499b921344272eec6405955b9bad2f162f7a2f9 (master) commit e659a8d04171583fecf9760fb73fd9031fe948be (release/2.3)
Author: Steffan Karger Date: Fri Mar 22 09:54:23 2013 +0100
Config compatibility patch. Added translate_cipher_name.
Signed-off-by: Steffan Karger <[email protected]...>
Acked-by: Adriaan de Jong <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7435
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
[Openvpn-devel] [PATCH applied] Re: Switch to IANA names for TLS ciphers.
In reply to [email protected]...Your patch has been applied to the master and release/2.30 branch.
commit 3b23b18dddb8f8f4a6ac6959b844b63356b59e87 (master) commit 030c7b05d01b5a9a4db5bfc2169ce9e80737656a (release/2.3)
Author: Steffan Karger Date: Fri Mar 22 09:54:24 2013 +0100
Switch to IANA names for TLS ciphers.
Signed-off-by: Steffan Karger <[email protected]...>
Acked-by: Adriaan de Jong <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7439
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
[Openvpn-devel] [PATCH applied] Re: Fixed autoconf script to properly detect missing pkcs11 with polarssl.
In reply to [email protected]...Your patch has been applied to the master and release/2.3 branch.
commit 9a3f670248d6f519a399e65a7232e2196b5115db (master) commit 9a3f670248d6f519a399e65a7232e2196b5115db (release/2.3)
Author: Steffan Karger Date: Fri Mar 22 09:54:25 2013 +0100
Fixed autoconf script to properly detect missing pkcs11 with polarssl.
Signed-off-by: Steffan Karger <[email protected]...>
Acked-by: Adriaan de Jong <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/7441
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering