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 <agl@google.com>
This commit is contained in:
David Benjamin 2017-03-30 15:45:21 -05:00 committed by Adam Langley
parent 76feb1f97f
commit bf833c346d
3 changed files with 12 additions and 10 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;