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 /ssl/t1_srvr.c | |
parent | 756eff7a31b5b46577e8529645b254ccc256a8ae (diff) |
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 'ssl/t1_srvr.c')
-rw-r--r-- | ssl/t1_srvr.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ssl/t1_srvr.c b/ssl/t1_srvr.c index 8c6b3dff2f..451f384ecc 100644 --- a/ssl/t1_srvr.c +++ b/ssl/t1_srvr.c @@ -67,6 +67,8 @@ static const SSL_METHOD *tls1_get_server_method(int ver); static const SSL_METHOD *tls1_get_server_method(int ver) { + if (ver == TLS_ANY_VERSION) + return TLS_server_method(); if (ver == TLS1_2_VERSION) return TLSv1_2_server_method(); if (ver == TLS1_1_VERSION) @@ -76,17 +78,22 @@ static const SSL_METHOD *tls1_get_server_method(int ver) return NULL; } +IMPLEMENT_tls_meth_func(TLS_ANY_VERSION, TLS_server_method, + ssl3_accept, + ssl_undefined_function, + tls1_get_server_method, TLSv1_2_enc_data) + IMPLEMENT_tls_meth_func(TLS1_2_VERSION, TLSv1_2_server_method, ssl3_accept, ssl_undefined_function, tls1_get_server_method, TLSv1_2_enc_data) - IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_server_method, +IMPLEMENT_tls_meth_func(TLS1_1_VERSION, TLSv1_1_server_method, ssl3_accept, ssl_undefined_function, tls1_get_server_method, TLSv1_1_enc_data) - IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_server_method, +IMPLEMENT_tls_meth_func(TLS1_VERSION, TLSv1_server_method, ssl3_accept, ssl_undefined_function, tls1_get_server_method, TLSv1_enc_data) |