diff options
author | Matt Caswell <matt@openssl.org> | 2015-03-27 23:01:51 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-05-16 09:19:56 +0100 |
commit | 32ec41539b5b23bc42503589fcc5be65d648d1f5 (patch) | |
tree | 340cc1e0e9d83d0db3af099741fed33f94ce89df /include | |
parent | 756eff7a31b5b46577e8529645b254ccc256a8ae (diff) | |
download | openssl-32ec41539b5b23bc42503589fcc5be65d648d1f5.tar.gz |
Server side version negotiation rewrite
This commit changes the way that we do server side protocol version
negotiation. Previously we had a whole set of code that had an "up front"
state machine dedicated to the negotiating the protocol version. This adds
significant complexity to the state machine. Historically the justification
for doing this was the support of SSLv2 which works quite differently to
SSLv3+. However, we have now removed support for SSLv2 so there is little
reason to maintain this complexity.
The one slight difficulty is that, although we no longer support SSLv2, we
do still support an SSLv3+ ClientHello in an SSLv2 backward compatible
ClientHello format. This is generally only used by legacy clients. This
commit adds support within the SSLv3 code for these legacy format
ClientHellos.
Server side version negotiation now works in much the same was as DTLS,
i.e. we introduce the concept of TLS_ANY_VERSION. If s->version is set to
that then when a ClientHello is received it will work out the most
appropriate version to respond with. Also, SSLv23_method and
SSLv23_server_method have been replaced with TLS_method and
TLS_server_method respectively. The old SSLv23* names still exist as
macros pointing at the new name, although they are deprecated.
Subsequent commits will look at client side version negotiation, as well of
removal of the old s23* code.
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/openssl/ssl.h | 13 | ||||
-rw-r--r-- | include/openssl/tls1.h | 3 |
2 files changed, 12 insertions, 4 deletions
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h index 27e44cc20f..f169fcd2a9 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -1562,13 +1562,18 @@ __owur const SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */ __owur const SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */ # endif -__owur const SSL_METHOD *SSLv23_method(void); /* Negotiate highest available SSL/TLS - * version */ -__owur const SSL_METHOD *SSLv23_server_method(void); /* Negotiate highest available - * SSL/TLS version */ +#ifdef OPENSSL_USE_DEPRECATED +#define SSLv23_method TLS_method +#define SSLv23_server_method TLS_server_method +#endif +/* This next one will be deprecated in a subsequent commit */ __owur const SSL_METHOD *SSLv23_client_method(void); /* Negotiate highest available * SSL/TLS version */ +/* Negotiate highest available SSL/TLS version */ +__owur const SSL_METHOD *TLS_method(void); +__owur const SSL_METHOD *TLS_server_method(void); + __owur const SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */ __owur const SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */ __owur const SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */ diff --git a/include/openssl/tls1.h b/include/openssl/tls1.h index e1beaf3bbd..d10739690e 100644 --- a/include/openssl/tls1.h +++ b/include/openssl/tls1.h @@ -167,6 +167,9 @@ extern "C" { # define TLS1_2_VERSION 0x0303 # define TLS_MAX_VERSION TLS1_2_VERSION +/* Special value for method supporting multiple versions */ +# define TLS_ANY_VERSION 0x10000 + # define TLS1_VERSION_MAJOR 0x03 # define TLS1_VERSION_MINOR 0x01 |