Release TLS 1.3 key shares earlier in TLS 1.2.
This isn't hugely important since the hs object will actually be
released at the end of the handshake, but no sense in holding on to them
longer than needed.
Also release |public_key| when we no longer need it and document what
the fields mean.
Change-Id: If677cb4a915c75405dabe7135205630527afd8bc
Reviewed-on: https://boringssl-review.googlesource.com/10360
Reviewed-by: Steven Valdez <svaldez@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index 0febb1c..5871be2 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -2094,6 +2094,7 @@
}
OPENSSL_free(ssl->s3->hs->key_share_bytes);
ssl->s3->hs->key_share_bytes = NULL;
+ ssl->s3->hs->key_share_bytes_len = 0;
groups = &ssl->s3->hs->retry_group;
groups_len = 1;
@@ -2242,6 +2243,10 @@
return 0;
}
+ OPENSSL_free(ssl->s3->hs->public_key);
+ ssl->s3->hs->public_key = NULL;
+ ssl->s3->hs->public_key_len = 0;
+
ssl->s3->new_session->key_exchange_info = group_id;
return 1;
}