DTLS/SCTP Finished Auth Bug
PR: 2808 With DTLS/SCTP the SCTP extension SCTP-AUTH is used to protect DATA and FORWARD-TSN chunks. The key for this extension is derived from the master secret and changed with the next ChangeCipherSpec, whenever a new key has been negotiated. The following Finished then already uses the new key. Unfortunately, the ChangeCipherSpec and Finished are part of the same flight as the ClientKeyExchange, which is necessary for the computation of the new secret. Hence, these messages are sent immediately following each other, leaving the server very little time to compute the new secret and pass it to SCTP before the finished arrives. So the Finished is likely to be discarded by SCTP and a retransmission becomes necessary. To prevent this issue, the Finished of the client is still sent with the old key. (cherry picked from commit9fb523adce
) (cherry picked from commitb9ef52b078
)
This commit is contained in:
parent
44f4934bde
commit
025f7dbdd1
@ -538,13 +538,6 @@ int dtls1_connect(SSL *s)
|
||||
SSL3_ST_CW_CHANGE_A,SSL3_ST_CW_CHANGE_B);
|
||||
if (ret <= 0) goto end;
|
||||
|
||||
#ifndef OPENSSL_NO_SCTP
|
||||
/* Change to new shared key of SCTP-Auth,
|
||||
* will be ignored if no SCTP used.
|
||||
*/
|
||||
BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL);
|
||||
#endif
|
||||
|
||||
s->state=SSL3_ST_CW_FINISHED_A;
|
||||
s->init_num=0;
|
||||
|
||||
@ -571,6 +564,16 @@ int dtls1_connect(SSL *s)
|
||||
goto end;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_SCTP
|
||||
if (s->hit)
|
||||
{
|
||||
/* Change to new shared key of SCTP-Auth,
|
||||
* will be ignored if no SCTP used.
|
||||
*/
|
||||
BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
dtls1_reset_seq_numbers(s, SSL3_CC_WRITE);
|
||||
break;
|
||||
|
||||
@ -613,6 +616,13 @@ int dtls1_connect(SSL *s)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef OPENSSL_NO_SCTP
|
||||
/* Change to new shared key of SCTP-Auth,
|
||||
* will be ignored if no SCTP used.
|
||||
*/
|
||||
BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_TLSEXT
|
||||
/* Allow NewSessionTicket if ticket expected */
|
||||
if (s->tlsext_ticket_expected)
|
||||
|
@ -722,10 +722,13 @@ int dtls1_accept(SSL *s)
|
||||
if (ret <= 0) goto end;
|
||||
|
||||
#ifndef OPENSSL_NO_SCTP
|
||||
/* Change to new shared key of SCTP-Auth,
|
||||
* will be ignored if no SCTP used.
|
||||
*/
|
||||
BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL);
|
||||
if (!s->hit)
|
||||
{
|
||||
/* Change to new shared key of SCTP-Auth,
|
||||
* will be ignored if no SCTP used.
|
||||
*/
|
||||
BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
s->state=SSL3_ST_SW_FINISHED_A;
|
||||
@ -750,7 +753,16 @@ int dtls1_accept(SSL *s)
|
||||
if (ret <= 0) goto end;
|
||||
s->state=SSL3_ST_SW_FLUSH;
|
||||
if (s->hit)
|
||||
{
|
||||
s->s3->tmp.next_state=SSL3_ST_SR_FINISHED_A;
|
||||
|
||||
#ifndef OPENSSL_NO_SCTP
|
||||
/* Change to new shared key of SCTP-Auth,
|
||||
* will be ignored if no SCTP used.
|
||||
*/
|
||||
BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY, 0, NULL);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
s->s3->tmp.next_state=SSL_ST_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user