diff options
author | David Benjamin <davidben@chromium.org> | 2014-11-26 08:29:45 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-12-02 22:31:57 +0300 |
commit | 8c88153465ed4eb657ffc8dedd9d37f72ad3d87d (patch) | |
tree | f110dcee908bfbffd06816eca1c229d21952538a /ssl/d1_srvr.c | |
parent | ff42cc1eac89e524ddd584c2f8d93a79257d6fe8 (diff) |
Remove a place where SSL_clear cleans up after client/server confusion.
SSL_clear sets s->state and dtls1_clear sets cookie_len on the server. Setting
cookie_len on the server seems to serve no purpose but to let the callback know
how large the buffer is. This can be done just before calling the callback.
It also avoids a bug where the cookie check can be bypassed, should the server
not specify an app_verify_cookie_cb, by supplying a cookie of all zeros of the
maximum size. (Zero is fine because an empty cookie is rejected.)
The goal here is to avoid needing the SSL_clear calls in the handshake
functions. They are currently needed to fix the cookie_len setting when using
the generic method. (They get set wrong and then flipped back.)
Change-Id: I5095891bc0f7df62d83a9c84312fcf0b84826faa
Reviewed-on: https://boringssl-review.googlesource.com/2435
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'ssl/d1_srvr.c')
-rw-r--r-- | ssl/d1_srvr.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ssl/d1_srvr.c b/ssl/d1_srvr.c index 17a9a89f..3b6170e8 100644 --- a/ssl/d1_srvr.c +++ b/ssl/d1_srvr.c @@ -640,6 +640,10 @@ int dtls1_send_hello_verify_request(SSL *s) *(p++) = DTLS1_VERSION >> 8; *(p++) = DTLS1_VERSION & 0xFF; + /* Inform the callback how much space is in the + * cookie's buffer. */ + s->d1->cookie_len = sizeof(s->d1->cookie); + if (s->ctx->app_gen_cookie_cb == NULL || s->ctx->app_gen_cookie_cb(s, s->d1->cookie, &(s->d1->cookie_len)) == 0) { |