Server side version negotiation rewrite
authorMatt Caswell <matt@openssl.org>
Fri, 27 Mar 2015 23:01:51 +0000 (23:01 +0000)
committerMatt Caswell <matt@openssl.org>
Sat, 16 May 2015 08:19:56 +0000 (09:19 +0100)
commit32ec41539b5b23bc42503589fcc5be65d648d1f5
tree340cc1e0e9d83d0db3af099741fed33f94ce89df
parent756eff7a31b5b46577e8529645b254ccc256a8ae
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>
26 files changed:
apps/ciphers.c
apps/s_server.c
crypto/threads/mttest.c
demos/bio/saccept.c
demos/bio/server-arg.c
demos/bio/server-conf.c
demos/easy_tls/easy-tls.c
demos/ssl/serv.cpp
demos/state_machine/state_machine.c
include/openssl/ssl.h
include/openssl/tls1.h
ssl/record/rec_layer_s3.c
ssl/record/record.h
ssl/record/record_locl.h
ssl/record/ssl3_record.c
ssl/s23_meth.c
ssl/s23_srvr.c
ssl/s3_both.c
ssl/s3_lib.c
ssl/s3_srvr.c
ssl/ssl_lib.c
ssl/ssl_locl.h
ssl/t1_meth.c
ssl/t1_srvr.c
test/ssltest.c
util/ssleay.num