Skip to content

Commit b97af13

Browse files
committed
Fix resumption secret
(cherry picked from commit 16fafdf4e0ec6cddd5705f407e5dca26cb30914d)
1 parent 3b0bdf8 commit b97af13

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

ssl/tls13_enc.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,7 @@ static int quic_change_cipher_state(SSL *s, int which)
512512
|| !tls13_hkdf_expand(s, md, s->master_secret, server_application_traffic,
513513
sizeof(server_application_traffic)-1, hash, hashlen,
514514
s->server_app_traffic_secret, hashlen, 1)
515-
|| !ssl_log_secret(s, SERVER_APPLICATION_LABEL, s->server_app_traffic_secret, hashlen)
516-
|| !tls13_hkdf_expand(s, md, s->master_secret, resumption_master_secret,
517-
sizeof(resumption_master_secret)-1, hash, hashlen,
518-
s->resumption_master_secret, hashlen, 1)) {
515+
|| !ssl_log_secret(s, SERVER_APPLICATION_LABEL, s->server_app_traffic_secret, hashlen)) {
519516
/* SSLfatal() already called */
520517
goto err;
521518
}
@@ -529,6 +526,8 @@ static int quic_change_cipher_state(SSL *s, int which)
529526
else
530527
s->quic_read_level = level;
531528
} else {
529+
/* is_client_write || is_server_read */
530+
532531
if (is_early) {
533532
level = ssl_encryption_early_data;
534533

@@ -544,6 +543,16 @@ static int quic_change_cipher_state(SSL *s, int which)
544543
level = ssl_encryption_handshake;
545544
} else {
546545
level = ssl_encryption_application;
546+
/*
547+
* We also create the resumption master secret, but this time use the
548+
* hash for the whole handshake including the Client Finished
549+
*/
550+
if (!tls13_hkdf_expand(s, md, s->master_secret, resumption_master_secret,
551+
sizeof(resumption_master_secret)-1, hash, hashlen,
552+
s->resumption_master_secret, hashlen, 1)) {
553+
/* SSLfatal() already called */
554+
goto err;
555+
}
547556
}
548557

549558
if (s->server)

0 commit comments

Comments
 (0)