Skip to content

Commit 2059d64

Browse files
committed
TLS1.3: Improve session version handling for resumption
1 parent 298f6bd commit 2059d64

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

src/ssl_sess.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,12 +1551,11 @@ int wolfSSL_SetSession(WOLFSSL* ssl, WOLFSSL_SESSION* session)
15511551
ssl->options.resuming = 1;
15521552
ssl->options.haveEMS = (ssl->session->haveEMS) ? 1 : 0;
15531553

1554-
#if defined(SESSION_CERTS) || (defined(WOLFSSL_TLS13) && \
1555-
defined(HAVE_SESSION_TICKET))
1556-
ssl->version = ssl->session->version;
1557-
if (IsAtLeastTLSv1_3(ssl->version))
1558-
ssl->options.tls1_3 = 1;
1559-
#endif
1554+
if (ssl->session->version.major != 0) {
1555+
ssl->version = ssl->session->version;
1556+
if (IsAtLeastTLSv1_3(ssl->version))
1557+
ssl->options.tls1_3 = 1;
1558+
}
15601559
#if defined(SESSION_CERTS) || !defined(NO_RESUME_SUITE_CHECK) || \
15611560
(defined(WOLFSSL_TLS13) && defined(HAVE_SESSION_TICKET))
15621561
ssl->options.cipherSuite0 = ssl->session->cipherSuite0;

src/tls.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12173,7 +12173,6 @@ static int TLSX_PreSharedKey_Parse(WOLFSSL* ssl, const byte* input,
1217312173
}
1217412174
list->chosen = 1;
1217512175

12176-
#ifdef HAVE_SESSION_TICKET
1217712176
if (list->resumption) {
1217812177
/* Check that the session's details are the same as the server's. */
1217912178
if (ssl->options.cipherSuite0 != ssl->session->cipherSuite0 ||
@@ -12184,7 +12183,6 @@ static int TLSX_PreSharedKey_Parse(WOLFSSL* ssl, const byte* input,
1218412183
return PSK_KEY_ERROR;
1218512184
}
1218612185
}
12187-
#endif
1218812186

1218912187
return 0;
1219012188
}

src/tls13.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4570,8 +4570,8 @@ int SendTls13ClientHello(WOLFSSL* ssl)
45704570
}
45714571
#endif /* WOLFSSL_DTLS */
45724572

4573-
#ifdef HAVE_SESSION_TICKET
45744573
if (ssl->options.resuming &&
4574+
ssl->session->version.major != 0 &&
45754575
(ssl->session->version.major != ssl->version.major ||
45764576
ssl->session->version.minor != ssl->version.minor)) {
45774577
#ifndef WOLFSSL_NO_TLS12
@@ -4590,7 +4590,6 @@ int SendTls13ClientHello(WOLFSSL* ssl)
45904590
return VERSION_ERROR;
45914591
}
45924592
}
4593-
#endif
45944593

45954594
suites = WOLFSSL_SUITES(ssl);
45964595
if (suites == NULL) {

0 commit comments

Comments
 (0)