Move srtp_profile to ssl->s3.

This too is connection-level state to be reset on SSL_clear.

Change-Id: I071c9431c28a7d0ff3eb20c679784d4aa4c236a5
Reviewed-on: https://boringssl-review.googlesource.com/27490
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
Reviewed-by: Steven Valdez <svaldez@google.com>
This commit is contained in:
David Benjamin 2018-04-12 16:37:19 -04:00 committed by CQ bot account: commit-bot@chromium.org
parent e28552dec8
commit fceca8e27b
3 changed files with 10 additions and 10 deletions

View File

@ -218,7 +218,7 @@ STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl) {
} }
const SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *ssl) { const SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *ssl) {
return ssl->srtp_profile; return ssl->s3->srtp_profile;
} }
int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles) { int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles) {

View File

@ -2449,6 +2449,10 @@ struct SSL3_STATE {
// Contains the QUIC transport params received by the peer. // Contains the QUIC transport params received by the peer.
Array<uint8_t> peer_quic_transport_params; Array<uint8_t> peer_quic_transport_params;
// srtp_profile is the selected SRTP protection profile for
// DTLS-SRTP.
const SRTP_PROTECTION_PROFILE *srtp_profile = nullptr;
}; };
// lengths of messages // lengths of messages
@ -2680,10 +2684,6 @@ struct SSLConnection {
// DTLS-SRTP. // DTLS-SRTP.
STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles; STACK_OF(SRTP_PROTECTION_PROFILE) *srtp_profiles;
// srtp_profile is the selected SRTP protection profile for
// DTLS-SRTP.
const SRTP_PROTECTION_PROFILE *srtp_profile;
// The client's Channel ID private key. // The client's Channel ID private key.
EVP_PKEY *tlsext_channel_id_private; EVP_PKEY *tlsext_channel_id_private;

View File

@ -1646,7 +1646,7 @@ static bool ext_channel_id_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
static void ext_srtp_init(SSL_HANDSHAKE *hs) { static void ext_srtp_init(SSL_HANDSHAKE *hs) {
hs->ssl->srtp_profile = NULL; hs->ssl->s3->srtp_profile = NULL;
} }
static bool ext_srtp_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) { static bool ext_srtp_add_clienthello(SSL_HANDSHAKE *hs, CBB *out) {
@ -1713,7 +1713,7 @@ static bool ext_srtp_parse_serverhello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
// offered). // offered).
for (const SRTP_PROTECTION_PROFILE *profile : profiles) { for (const SRTP_PROTECTION_PROFILE *profile : profiles) {
if (profile->id == profile_id) { if (profile->id == profile_id) {
ssl->srtp_profile = profile; ssl->s3->srtp_profile = profile;
return true; return true;
} }
} }
@ -1755,7 +1755,7 @@ static bool ext_srtp_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
} }
if (server_profile->id == profile_id) { if (server_profile->id == profile_id) {
ssl->srtp_profile = server_profile; ssl->s3->srtp_profile = server_profile;
return true; return true;
} }
} }
@ -1766,7 +1766,7 @@ static bool ext_srtp_parse_clienthello(SSL_HANDSHAKE *hs, uint8_t *out_alert,
static bool ext_srtp_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) { static bool ext_srtp_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
SSL *const ssl = hs->ssl; SSL *const ssl = hs->ssl;
if (ssl->srtp_profile == NULL) { if (ssl->s3->srtp_profile == NULL) {
return true; return true;
} }
@ -1774,7 +1774,7 @@ static bool ext_srtp_add_serverhello(SSL_HANDSHAKE *hs, CBB *out) {
if (!CBB_add_u16(out, TLSEXT_TYPE_srtp) || if (!CBB_add_u16(out, TLSEXT_TYPE_srtp) ||
!CBB_add_u16_length_prefixed(out, &contents) || !CBB_add_u16_length_prefixed(out, &contents) ||
!CBB_add_u16_length_prefixed(&contents, &profile_ids) || !CBB_add_u16_length_prefixed(&contents, &profile_ids) ||
!CBB_add_u16(&profile_ids, ssl->srtp_profile->id) || !CBB_add_u16(&profile_ids, ssl->s3->srtp_profile->id) ||
!CBB_add_u8(&contents, 0 /* empty MKI */) || !CBB_add_u8(&contents, 0 /* empty MKI */) ||
!CBB_flush(out)) { !CBB_flush(out)) {
return false; return false;