Rename the master_key field in SSL_SESSION to secret.
It's not even accurate. The term "master key" dates to SSL 2, which we
do not implement. (Starting SSL 3, "key" was replaced with "secret".)
The field stores, at various points, the TLS 1.2 master secret, the TLS
1.3 resumption master secret, and the TLS 1.3 resumption PSK. Simply
rename the field to 'secret', which is as descriptive of a name as we
can get at this point.
I've left SSL_SESSION_get_master_key alone for now, as it's there for
OpenSSL compatibility, as well as references to the various TLS secrets
since those refer to concepts in the spec. (When the dust settles a bit
on rfc8446bis, we can fix those.)
Change-Id: I3c1007eb7982788789cc5db851de8724c7f35baf
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44144
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/ssl_session.cc b/ssl/ssl_session.cc
index 7538a72..91b2fff 100644
--- a/ssl/ssl_session.cc
+++ b/ssl/ssl_session.cc
@@ -202,9 +202,8 @@
OPENSSL_memcpy(new_session->sid_ctx, session->sid_ctx, session->sid_ctx_length);
// Copy the key material.
- new_session->master_key_length = session->master_key_length;
- OPENSSL_memcpy(new_session->master_key, session->master_key,
- session->master_key_length);
+ new_session->secret_length = session->secret_length;
+ OPENSSL_memcpy(new_session->secret, session->secret, session->secret_length);
new_session->cipher = session->cipher;
// Copy authentication state.
@@ -963,14 +962,14 @@
size_t SSL_SESSION_get_master_key(const SSL_SESSION *session, uint8_t *out,
size_t max_out) {
- // TODO(davidben): Fix master_key_length's type and remove these casts.
+ // TODO(davidben): Fix secret_length's type and remove these casts.
if (max_out == 0) {
- return (size_t)session->master_key_length;
+ return (size_t)session->secret_length;
}
- if (max_out > (size_t)session->master_key_length) {
- max_out = (size_t)session->master_key_length;
+ if (max_out > (size_t)session->secret_length) {
+ max_out = (size_t)session->secret_length;
}
- OPENSSL_memcpy(out, session->master_key, max_out);
+ OPENSSL_memcpy(out, session->secret, max_out);
return max_out;
}