Author: schultz Date: Fri Oct 17 14:50:34 2014 New Revision: 1632595 URL: http://svn.apache.org/r1632595 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53952 Add support for TLSv1.2 and TLSv1.1.
Modified: tomcat/native/branches/1.1.x/native/include/ssl_private.h tomcat/native/branches/1.1.x/native/src/ssl.c tomcat/native/branches/1.1.x/native/src/sslcontext.c tomcat/native/branches/1.1.x/xdocs/miscellaneous/changelog.xml Modified: tomcat/native/branches/1.1.x/native/include/ssl_private.h URL: http://svn.apache.org/viewvc/tomcat/native/branches/1.1.x/native/include/ssl_private.h?rev=1632595&r1=1632594&r2=1632595&view=diff ============================================================================== --- tomcat/native/branches/1.1.x/native/include/ssl_private.h (original) +++ tomcat/native/branches/1.1.x/native/include/ssl_private.h Fri Oct 17 14:50:34 2014 @@ -117,7 +117,9 @@ #define SSL_PROTOCOL_SSLV2 (1<<0) #define SSL_PROTOCOL_SSLV3 (1<<1) #define SSL_PROTOCOL_TLSV1 (1<<2) -#define SSL_PROTOCOL_ALL (SSL_PROTOCOL_SSLV2|SSL_PROTOCOL_SSLV3|SSL_PROTOCOL_TLSV1) +#define SSL_PROTOCOL_TLSV1_1 (1<<3) +#define SSL_PROTOCOL_TLSV1_2 (1<<4) +#define SSL_PROTOCOL_ALL (SSL_PROTOCOL_SSLV2|SSL_PROTOCOL_SSLV3|SSL_PROTOCOL_TLSV1|SSL_PROTOCOL_TLSV1_1|SSL_PROTOCOL_TLSV1_2) #define SSL_MODE_CLIENT (0) #define SSL_MODE_SERVER (1) Modified: tomcat/native/branches/1.1.x/native/src/ssl.c URL: http://svn.apache.org/viewvc/tomcat/native/branches/1.1.x/native/src/ssl.c?rev=1632595&r1=1632594&r2=1632595&view=diff ============================================================================== --- tomcat/native/branches/1.1.x/native/src/ssl.c (original) +++ tomcat/native/branches/1.1.x/native/src/ssl.c Fri Oct 17 14:50:34 2014 @@ -190,6 +190,14 @@ static const jint supported_ssl_opts = 0 | SSL_OP_PKCS1_CHECK_2 #endif +#ifdef SSL_OP_NO_TLSv1_1 + | SSL_OP_NO_TLSv1_1 +#endif + +#ifdef SSL_OP_NO_TLSv1_2 + | SSL_OP_NO_TLSv1_2 +#endif + #ifdef SSL_OP_SINGLE_DH_USE | SSL_OP_SINGLE_DH_USE #endif Modified: tomcat/native/branches/1.1.x/native/src/sslcontext.c URL: http://svn.apache.org/viewvc/tomcat/native/branches/1.1.x/native/src/sslcontext.c?rev=1632595&r1=1632594&r2=1632595&view=diff ============================================================================== --- tomcat/native/branches/1.1.x/native/src/sslcontext.c (original) +++ tomcat/native/branches/1.1.x/native/src/sslcontext.c Fri Oct 17 14:50:34 2014 @@ -71,43 +71,64 @@ TCN_IMPLEMENT_CALL(jlong, SSLContext, ma SSL_CTX *ctx = NULL; UNREFERENCED(o); - switch (protocol) { - case SSL_PROTOCOL_SSLV2: - if (mode == SSL_MODE_CLIENT) - ctx = SSL_CTX_new(SSLv2_client_method()); - else if (mode == SSL_MODE_SERVER) - ctx = SSL_CTX_new(SSLv2_server_method()); - else - ctx = SSL_CTX_new(SSLv2_method()); - break; - case SSL_PROTOCOL_SSLV3: - if (mode == SSL_MODE_CLIENT) - ctx = SSL_CTX_new(SSLv3_client_method()); - else if (mode == SSL_MODE_SERVER) - ctx = SSL_CTX_new(SSLv3_server_method()); - else - ctx = SSL_CTX_new(SSLv3_method()); - break; - case SSL_PROTOCOL_SSLV2 | SSL_PROTOCOL_SSLV3: - case SSL_PROTOCOL_SSLV2 | SSL_PROTOCOL_TLSV1: - case SSL_PROTOCOL_ALL: - case SSL_PROTOCOL_SSLV3 | SSL_PROTOCOL_TLSV1: - if (mode == SSL_MODE_CLIENT) - ctx = SSL_CTX_new(SSLv23_client_method()); - else if (mode == SSL_MODE_SERVER) - ctx = SSL_CTX_new(SSLv23_server_method()); - else - ctx = SSL_CTX_new(SSLv23_method()); - break; - case SSL_PROTOCOL_TLSV1: - if (mode == SSL_MODE_CLIENT) - ctx = SSL_CTX_new(TLSv1_client_method()); - else if (mode == SSL_MODE_SERVER) - ctx = SSL_CTX_new(TLSv1_server_method()); - else - ctx = SSL_CTX_new(TLSv1_method()); - break; + if (protocol == SSL_PROTOCOL_TLSV1_2) { +#ifdef SSL_OP_NO_TLSv1_2 + if (mode == SSL_MODE_CLIENT) + ctx = SSL_CTX_new(TLSv1_2_client_method()); + else if (mode == SSL_MODE_SERVER) + ctx = SSL_CTX_new(TLSv1_2_server_method()); + else + ctx = SSL_CTX_new(TLSv1_2_method()); +#endif + } else if (protocol == SSL_PROTOCOL_TLSV1_1) { +#ifdef SSL_OP_NO_TLSv1_1 + if (mode == SSL_MODE_CLIENT) + ctx = SSL_CTX_new(TLSv1_1_client_method()); + else if (mode == SSL_MODE_SERVER) + ctx = SSL_CTX_new(TLSv1_1_server_method()); + else + ctx = SSL_CTX_new(TLSv1_1_method()); +#endif + } else if (protocol == SSL_PROTOCOL_TLSV1) { + if (mode == SSL_MODE_CLIENT) + ctx = SSL_CTX_new(TLSv1_client_method()); + else if (mode == SSL_MODE_SERVER) + ctx = SSL_CTX_new(TLSv1_server_method()); + else + ctx = SSL_CTX_new(TLSv1_method()); + } else if (protocol == SSL_PROTOCOL_SSLV3) { + if (mode == SSL_MODE_CLIENT) + ctx = SSL_CTX_new(SSLv3_client_method()); + else if (mode == SSL_MODE_SERVER) + ctx = SSL_CTX_new(SSLv3_server_method()); + else + ctx = SSL_CTX_new(SSLv3_method()); +#ifndef OPENSSL_NO_SSL2 + } else if (protocol == SSL_PROTOCOL_SSLV2) { + if (mode == SSL_MODE_CLIENT) + ctx = SSL_CTX_new(SSLv2_client_method()); + else if (mode == SSL_MODE_SERVER) + ctx = SSL_CTX_new(SSLv2_server_method()); + else + ctx = SSL_CTX_new(SSLv2_method()); +#endif +#ifndef SSL_OP_NO_TLSv1_2 + } else if (protocol & SSL_PROTOCOL_TLSV1_2) { + /* requested but not supported */ +#endif +#ifndef SSL_OP_NO_TLSv1_1 + } else if (protocol & SSL_PROTOCOL_TLSV1_1) { + /* requested but not supported */ +#endif + } else { + if (mode == SSL_MODE_CLIENT) + ctx = SSL_CTX_new(SSLv23_client_method()); + else if (mode == SSL_MODE_SERVER) + ctx = SSL_CTX_new(SSLv23_server_method()); + else + ctx = SSL_CTX_new(SSLv23_method()); } + if (!ctx) { char err[256]; ERR_error_string(ERR_get_error(), err); @@ -133,6 +154,14 @@ TCN_IMPLEMENT_CALL(jlong, SSLContext, ma SSL_CTX_set_options(c->ctx, SSL_OP_NO_SSLv3); if (!(protocol & SSL_PROTOCOL_TLSV1)) SSL_CTX_set_options(c->ctx, SSL_OP_NO_TLSv1); +#ifdef SSL_OP_NO_TLSv1_1 + if (!(protocol & SSL_PROTOCOL_TLSV1_1)) + SSL_CTX_set_options(c->ctx, SSL_OP_NO_TLSv1_1); +#endif +#ifdef SSL_OP_NO_TLSv1_2 + if (!(protocol & SSL_PROTOCOL_TLSV1_2)) + SSL_CTX_set_options(c->ctx, SSL_OP_NO_TLSv1_2); +#endif /* * Configure additional context ingredients */ Modified: tomcat/native/branches/1.1.x/xdocs/miscellaneous/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/native/branches/1.1.x/xdocs/miscellaneous/changelog.xml?rev=1632595&r1=1632594&r2=1632595&view=diff ============================================================================== --- tomcat/native/branches/1.1.x/xdocs/miscellaneous/changelog.xml (original) +++ tomcat/native/branches/1.1.x/xdocs/miscellaneous/changelog.xml Fri Oct 17 14:50:34 2014 @@ -36,6 +36,13 @@ new documentation project for Tomcat Native was started. </p> </section> +<section name="Changes between 1.1.31 and 1.1.32"> + <changelog> + <fix> + <bug>53952</bug>: Add support for TLSv1.2 and TLSv1.1. + Patch provided by Marcel Šebek. (schultz) + </changelog> +</section> <section name="Changes between 1.1.30 and 1.1.31"> <changelog> <fix> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org