From bf833c346d532558a4c1c98940fa42e4e80a0a02 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Thu, 30 Mar 2017 15:45:21 -0500 Subject: [PATCH] Rename hs->public_key. This is an unhelpfully generic name. Rename it to match SSL_ECDH_CTX. Unqualified "public key" is typically assumed to be the certificate. Change-Id: I8ba8c3f2bb1343d1c006845a1110e833451c5a56 Reviewed-on: https://boringssl-review.googlesource.com/14564 Reviewed-by: Adam Langley --- ssl/internal.h | 8 ++++---- ssl/s3_both.c | 2 +- ssl/t1_lib.c | 12 +++++++----- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ssl/internal.h b/ssl/internal.h index 2504ca09..a6375a67 100644 --- a/ssl/internal.h +++ b/ssl/internal.h @@ -1014,10 +1014,10 @@ struct ssl_handshake_st { uint8_t *key_share_bytes; size_t key_share_bytes_len; - /* public_key, for servers, is the key share to be sent to the client in TLS - * 1.3. */ - uint8_t *public_key; - size_t public_key_len; + /* ecdh_public_key, for servers, is the key share to be sent to the client in + * TLS 1.3. */ + uint8_t *ecdh_public_key; + size_t ecdh_public_key_len; /* peer_sigalgs are the signature algorithms that the peer supports. These are * taken from the contents of the signature algorithms extension for a server diff --git a/ssl/s3_both.c b/ssl/s3_both.c index 7ef400a8..aff21542 100644 --- a/ssl/s3_both.c +++ b/ssl/s3_both.c @@ -166,7 +166,7 @@ void ssl_handshake_free(SSL_HANDSHAKE *hs) { SSL_TRANSCRIPT_cleanup(&hs->transcript); OPENSSL_free(hs->cookie); OPENSSL_free(hs->key_share_bytes); - OPENSSL_free(hs->public_key); + OPENSSL_free(hs->ecdh_public_key); SSL_SESSION_free(hs->new_session); OPENSSL_free(hs->peer_sigalgs); OPENSSL_free(hs->peer_supported_group_list); diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 793e2d78..2acd4229 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -2336,7 +2336,8 @@ int ssl_ext_key_share_parse_clienthello(SSL_HANDSHAKE *hs, int *out_found, !SSL_ECDH_CTX_init(&group, group_id) || !SSL_ECDH_CTX_accept(&group, &public_key, &secret, &secret_len, out_alert, CBS_data(&peer_key), CBS_len(&peer_key)) || - !CBB_finish(&public_key, &hs->public_key, &hs->public_key_len)) { + !CBB_finish(&public_key, &hs->ecdh_public_key, + &hs->ecdh_public_key_len)) { OPENSSL_free(secret); SSL_ECDH_CTX_cleanup(&group); CBB_cleanup(&public_key); @@ -2360,14 +2361,15 @@ int ssl_ext_key_share_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) { !CBB_add_u16_length_prefixed(out, &kse_bytes) || !CBB_add_u16(&kse_bytes, group_id) || !CBB_add_u16_length_prefixed(&kse_bytes, &public_key) || - !CBB_add_bytes(&public_key, hs->public_key, hs->public_key_len) || + !CBB_add_bytes(&public_key, hs->ecdh_public_key, + hs->ecdh_public_key_len) || !CBB_flush(out)) { return 0; } - OPENSSL_free(hs->public_key); - hs->public_key = NULL; - hs->public_key_len = 0; + OPENSSL_free(hs->ecdh_public_key); + hs->ecdh_public_key = NULL; + hs->ecdh_public_key_len = 0; hs->new_session->group_id = group_id; return 1;