Replace hash_current_message with get_current_message.
For TLS 1.3 draft 18, it will be useful to get at the full current
message and not just the body. Add a hook to expose it and replace
hash_current_message with a wrapper over it.
BUG=112
Change-Id: Ib9e00dd1b78e8b72e12409d85c80e96c5b411a8b
Reviewed-on: https://boringssl-review.googlesource.com/12238
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/s3_both.c b/ssl/s3_both.c
index 9f9dfad..98ebf17 100644
--- a/ssl/s3_both.c
+++ b/ssl/s3_both.c
@@ -320,7 +320,7 @@
size_t finished_len =
ssl->s3->enc_method->final_finish_mac(ssl, !ssl->server, finished);
if (finished_len == 0 ||
- !ssl->method->hash_current_message(ssl)) {
+ !ssl_hash_current_message(ssl)) {
return -1;
}
@@ -660,16 +660,21 @@
}
/* Feed this message into MAC computation. */
- if (hash_message == ssl_hash_message && !ssl3_hash_current_message(ssl)) {
+ if (hash_message == ssl_hash_message && !ssl_hash_current_message(ssl)) {
return -1;
}
return 1;
}
-int ssl3_hash_current_message(SSL *ssl) {
- return ssl3_update_handshake_hash(ssl, (uint8_t *)ssl->init_buf->data,
- ssl->init_buf->length);
+void ssl3_get_current_message(const SSL *ssl, CBS *out) {
+ CBS_init(out, (uint8_t *)ssl->init_buf->data, ssl->init_buf->length);
+}
+
+int ssl_hash_current_message(SSL *ssl) {
+ CBS cbs;
+ ssl->method->get_current_message(ssl, &cbs);
+ return ssl3_update_handshake_hash(ssl, CBS_data(&cbs), CBS_len(&cbs));
}
void ssl3_release_current_message(SSL *ssl, int free_buffer) {