From 9eaeef81fa2d4fd6246dc02b6203fa936a5eaf67 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Mon, 21 Jul 2014 22:22:02 -0400 Subject: [PATCH] Set s->hit when using tls_session_secret_cb. tls_session_secret_cb is used for EAP-FAST which computes the master secret externally and enters the abbreviated handshake. It appears to only have been working because ssl3_check_finished would drive it into the appropriate state afterwards. That, in turn, only has been working because EAP-FAST misuses the session ticket extension for some other field, so ssl3_check_finished isn't a no-op. Instead, set s->hit so it follows the abbreviated state machine directly. If we ever build wpa_supplicant with BoringSSL, this will require some testing. (And, if not, this API should be removed.) Change-Id: Ie2992a9bba049f7120522b996f739906e38a070e Reviewed-on: https://boringssl-review.googlesource.com/1294 Reviewed-by: Adam Langley --- ssl/s3_clnt.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c index f4da38fb4..45d51d4f8 100644 --- a/ssl/s3_clnt.c +++ b/ssl/s3_clnt.c @@ -939,6 +939,8 @@ int ssl3_get_server_hello(SSL *s) /* Copy over the server random. */ memcpy(s->s3->server_random, CBS_data(&server_random), SSL3_RANDOM_SIZE); + s->hit = 0; + /* check if we want to resume the session based on external pre-shared secret */ if (s->version >= TLS1_VERSION && s->tls_session_secret_cb) { @@ -955,10 +957,11 @@ int ssl3_get_server_hello(SSL *s) pref_cipher : ssl_get_cipher_by_char(s, CBS_data(&server_hello)); s->s3->flags |= SSL3_FLAGS_CCS_OK; + s->hit = 1; } } - if (CBS_len(&session_id) != 0 && + if (!s->hit && CBS_len(&session_id) != 0 && CBS_mem_equal(&session_id, s->session->session_id, s->session->session_id_length)) { @@ -973,11 +976,12 @@ int ssl3_get_server_hello(SSL *s) s->s3->flags |= SSL3_FLAGS_CCS_OK; s->hit = 1; } - else /* a miss or crap from the other end */ + + /* a miss or crap from the other end */ + if (!s->hit) { /* If we were trying for session-id reuse, make a new * SSL_SESSION so we don't stuff up other people */ - s->hit=0; if (s->session->session_id_length > 0) { if (!ssl_get_new_session(s,0))