Skip to content

Commit c9c2376

Browse files
committed
TLS1.3: Improve session version handling for resumption
1 parent fb4600b commit c9c2376

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
@@ -12198,7 +12198,6 @@ static int TLSX_PreSharedKey_Parse(WOLFSSL* ssl, const byte* input,
1219812198
}
1219912199
list->chosen = 1;
1220012200

12201-
#ifdef HAVE_SESSION_TICKET
1220212201
if (list->resumption) {
1220312202
/* Check that the session's details are the same as the server's. */
1220412203
if (ssl->options.cipherSuite0 != ssl->session->cipherSuite0 ||
@@ -12209,7 +12208,6 @@ static int TLSX_PreSharedKey_Parse(WOLFSSL* ssl, const byte* input,
1220912208
return PSK_KEY_ERROR;
1221012209
}
1221112210
}
12212-
#endif
1221312211

1221412212
return 0;
1221512213
}

src/tls13.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4574,8 +4574,8 @@ int SendTls13ClientHello(WOLFSSL* ssl)
45744574
}
45754575
#endif /* WOLFSSL_DTLS */
45764576

4577-
#ifdef HAVE_SESSION_TICKET
45784577
if (ssl->options.resuming &&
4578+
ssl->session->version.major != 0 &&
45794579
(ssl->session->version.major != ssl->version.major ||
45804580
ssl->session->version.minor != ssl->version.minor)) {
45814581
#ifndef WOLFSSL_NO_TLS12
@@ -4594,7 +4594,6 @@ int SendTls13ClientHello(WOLFSSL* ssl)
45944594
return VERSION_ERROR;
45954595
}
45964596
}
4597-
#endif
45984597

45994598
suites = WOLFSSL_SUITES(ssl);
46004599
if (suites == NULL) {

0 commit comments

Comments
 (0)