Clear init_msg/init_num whenever we clear the backing store.

This API needs to be improved but, for the time being, keep the
invariant reasonable.

Change-Id: If94d41e7e7936e44de5ecb36da45f89f80df7784
Reviewed-on: https://boringssl-review.googlesource.com/8984
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
David Benjamin 2016-07-27 13:51:01 -04:00 committed by CQ bot account: commit-bot@chromium.org
parent bd4679d133
commit 49054544d3
3 changed files with 7 additions and 1 deletions

View File

@ -100,6 +100,8 @@ static void dtls1_finish_handshake(SSL *ssl) {
ssl->d1->handshake_read_seq = 0;
ssl->d1->handshake_write_seq = 0;
dtls_clear_incoming_messages(ssl);
ssl->init_msg = NULL;
ssl->init_num = 0;
}
static int dtls1_set_read_state(SSL *ssl, SSL_AEAD_CTX *aead_ctx) {

View File

@ -2824,6 +2824,8 @@ int SSL_clear(SSL *ssl) {
BUF_MEM_free(ssl->init_buf);
ssl->init_buf = NULL;
ssl->init_msg = NULL;
ssl->init_num = 0;
/* The ssl->d1->mtu is simultaneously configuration (preserved across
* clear) and connection-specific state (gets reset).

View File

@ -81,13 +81,15 @@ static int ssl3_begin_handshake(SSL *ssl) {
}
ssl->init_buf = buf;
ssl->init_num = 0;
return 1;
}
static void ssl3_finish_handshake(SSL *ssl) {
BUF_MEM_free(ssl->init_buf);
ssl->init_buf = NULL;
ssl->s3->tmp.message_complete = 0;
ssl->init_msg = NULL;
ssl->init_num = 0;
}