Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2014-11-30 10:49:50 +0300
committerAdam Langley <agl@google.com>2014-12-02 22:35:27 +0300
commit8c6fe45c2f678041f5150460a0efc5e9ce5cda8a (patch)
treebe11a618d0987a3170fb84bd86cc3d40bb8182d5 /ssl/s3_srvr.c
parentcde8abae14da0cf7d7047974246df5f0ccf4ca4d (diff)
Replace s->first_packet with a s->s3->have_version bit.
first_packet is a temporary connection-global flag set for the duration of some call and then queried from other code. This kind of logic is too difficult to reason through. It also incorrectly treats renegotiate ClientHellos as pre-version-negotiation records. This eliminates the need to query enc_write_ctx (which wasn't EVP_AEAD-aware anyway). Instead, take a leaf from Go TLS's book and add a have_version bit. This is placed on s->s3 as it is connection state; s->s3 automatically gets reset on SSL_clear while s doesn't. This new flag will also be used to determine whether to do the V2ClientHello sniff when the version-locked methods merge into SSLv23_method. It will also replace needing to condition s->method against a dummy DTLS_ANY_VERSION value to determine whether DTLS version negotiation has happened yet. Change-Id: I5c8bc6258b182ba4ab175a48a84eab6d3a001333 Reviewed-on: https://boringssl-review.googlesource.com/2442 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'ssl/s3_srvr.c')
-rw-r--r--ssl/s3_srvr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c
index 5ba5b42e..527850be 100644
--- a/ssl/s3_srvr.c
+++ b/ssl/s3_srvr.c
@@ -715,7 +715,6 @@ int ssl3_get_client_hello(SSL *s)
switch (s->state) {
case SSL3_ST_SR_CLNT_HELLO_A:
case SSL3_ST_SR_CLNT_HELLO_B:
- s->first_packet=1;
n=s->method->ssl_get_message(s,
SSL3_ST_SR_CLNT_HELLO_A,
SSL3_ST_SR_CLNT_HELLO_B,
@@ -725,7 +724,6 @@ int ssl3_get_client_hello(SSL *s)
&ok);
if (!ok) return((int)n);
- s->first_packet=0;
/* If we require cookies and this ClientHello doesn't
* contain one, just return since we do not want to
@@ -814,7 +812,7 @@ int ssl3_get_client_hello(SSL *s)
{
OPENSSL_PUT_ERROR(SSL, ssl3_get_client_hello, SSL_R_WRONG_VERSION_NUMBER);
if ((s->client_version>>8) == SSL3_VERSION_MAJOR &&
- !s->enc_write_ctx && !s->write_hash)
+ !s->s3->have_version)
{
/* similar to ssl3_get_record, send alert using remote version number */
s->version = s->client_version;
@@ -890,6 +888,12 @@ int ssl3_get_client_hello(SSL *s)
}
}
+ /* At this point, the connection's version is known and s->version is
+ * fixed. Begin enforcing the record-layer version. Note: SSLv23_method
+ * currently determines its version sooner, but it will later be moved
+ * to this point. */
+ s->s3->have_version = 1;
+
s->hit=0;
/* Versions before 0.9.7 always allow clients to resume sessions in renegotiation.
* 0.9.7 and later allow this by default, but optionally ignore resumption requests