Clear existing extension state.

When parsing ClientHello clear any existing extension state from
SRP login and SRTP profile.

(Imported from upstream's 4f605ccb779e32a770093d687e0554e0bbb137d3)

More state that should be systematically reset across handshakes. Add a reset
on the ServerHello end too since that was missed.

Change-Id: Ibb4549acddfd87caf7b6ff853e2adbfa4b7e7856
Reviewed-on: https://boringssl-review.googlesource.com/2838
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2015-01-11 20:30:21 -05:00 committed by Adam Langley
parent 39507745e3
commit d1d7d3d26a

View File

@ -1394,6 +1394,7 @@ static int ssl_scan_clienthello_tlsext(SSL *s, CBS *cbs, int *out_alert) {
CBS extensions; CBS extensions;
s->should_ack_sni = 0; s->should_ack_sni = 0;
s->srtp_profile = NULL;
s->s3->next_proto_neg_seen = 0; s->s3->next_proto_neg_seen = 0;
s->s3->tmp.certificate_status_expected = 0; s->s3->tmp.certificate_status_expected = 0;
s->s3->tmp.extended_master_secret = 0; s->s3->tmp.extended_master_secret = 0;
@ -1746,10 +1747,10 @@ static int ssl_scan_serverhello_tlsext(SSL *s, CBS *cbs, int *out_alert) {
* systematically reset on a new handshake; perhaps allocate it fresh each * systematically reset on a new handshake; perhaps allocate it fresh each
* time so it's not even kept around post-handshake. */ * time so it's not even kept around post-handshake. */
s->s3->next_proto_neg_seen = 0; s->s3->next_proto_neg_seen = 0;
s->tlsext_ticket_expected = 0; s->tlsext_ticket_expected = 0;
s->s3->tmp.certificate_status_expected = 0; s->s3->tmp.certificate_status_expected = 0;
s->s3->tmp.extended_master_secret = 0; s->s3->tmp.extended_master_secret = 0;
s->srtp_profile = NULL;
if (s->s3->alpn_selected) { if (s->s3->alpn_selected) {
OPENSSL_free(s->s3->alpn_selected); OPENSSL_free(s->s3->alpn_selected);