diff options
author | David Benjamin <davidben@chromium.org> | 2014-12-08 07:56:19 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-12-14 01:35:52 +0300 |
commit | ceb6f2880feb600ff76604db6deae15dc2e93899 (patch) | |
tree | 757d3e122941f94d3b776ace3cb931274dae0cf7 /ssl/s3_srvr.c | |
parent | 69b9e597ae5c16ece1ce919b45e845f7a5433b90 (diff) |
Factor out remaining version-related functions.
Now SSLv23 and DTLS_ANY_VERSION share version-related helper functions.
ssl3_get_method is temporary until the method switch is no longer necessary.
Put them all together so there's one place to refactor them when we add a new
version or implement min_version/max_version controls.
Change-Id: Ic28a145cad22db08a87fdb854480b22886c451c6
Reviewed-on: https://boringssl-review.googlesource.com/2580
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'ssl/s3_srvr.c')
-rw-r--r-- | ssl/s3_srvr.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c index 86e87440..8a204cec 100644 --- a/ssl/s3_srvr.c +++ b/ssl/s3_srvr.c @@ -854,25 +854,17 @@ int ssl3_get_client_hello(SSL *s) if (s->method->version == DTLS_ANY_VERSION) { /* Select version to use */ - if (s->client_version <= DTLS1_2_VERSION && - !(s->options & SSL_OP_NO_DTLSv1_2)) - { - s->version = DTLS1_2_VERSION; - s->method = DTLSv1_2_server_method(); - } - else if (s->client_version <= DTLS1_VERSION && - !(s->options & SSL_OP_NO_DTLSv1)) - { - s->version = DTLS1_VERSION; - s->method = DTLSv1_server_method(); - } - else + uint16_t version = ssl3_get_mutual_version(s, client_version); + if (version == 0) { OPENSSL_PUT_ERROR(SSL, ssl3_get_client_hello, SSL_R_WRONG_VERSION_NUMBER); s->version = s->client_version; al = SSL_AD_PROTOCOL_VERSION; goto f_err; } + s->version = version; + s->method = ssl3_get_method(version); + assert(s->method != NULL); } } |