forked from wolfSSL/wolfssl
TLS session tickets: cannot share between TLS 1.3 and TLS 1.2
When parsing ticket, check TLS version to see whether they are version compatible.
This commit is contained in:
@ -28401,6 +28401,13 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
|||||||
return VERSION_ERROR;
|
return VERSION_ERROR;
|
||||||
}
|
}
|
||||||
else if (ssl->version.minor > it.pv.minor) {
|
else if (ssl->version.minor > it.pv.minor) {
|
||||||
|
if (IsAtLeastTLSv1_3(it.pv) != IsAtLeastTLSv1_3(ssl->version)) {
|
||||||
|
ForceZero(&it, sizeof(it));
|
||||||
|
WOLFSSL_MSG("Tickets cannot be shared between "
|
||||||
|
"TLS 1.3 and TLS 1.2 and lower");
|
||||||
|
return VERSION_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ssl->options.downgrade) {
|
if (!ssl->options.downgrade) {
|
||||||
ForceZero(&it, sizeof(it));
|
ForceZero(&it, sizeof(it));
|
||||||
WOLFSSL_MSG("Ticket has lesser version");
|
WOLFSSL_MSG("Ticket has lesser version");
|
||||||
|
15
src/tls.c
15
src/tls.c
@ -5030,12 +5030,19 @@ static int TLSX_SessionTicket_Parse(WOLFSSL* ssl, byte* input, word16 length,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length == 0) {
|
if (length > SESSION_TICKET_LEN) {
|
||||||
|
ret = BAD_TICKET_MSG_SZ;
|
||||||
|
} else if (IsAtLeastTLSv1_3(ssl->version)) {
|
||||||
|
WOLFSSL_MSG("Process client ticket rejected, TLS 1.3 no support");
|
||||||
|
ssl->options.rejectTicket = 1;
|
||||||
|
ret = 0; /* not fatal */
|
||||||
|
} else if (length == 0) {
|
||||||
/* blank ticket */
|
/* blank ticket */
|
||||||
ret = TLSX_UseSessionTicket(&ssl->extensions, NULL, ssl->heap);
|
ret = TLSX_UseSessionTicket(&ssl->extensions, NULL, ssl->heap);
|
||||||
if (ret == WOLFSSL_SUCCESS) {
|
if (ret == WOLFSSL_SUCCESS) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
TLSX_SetResponse(ssl, TLSX_SESSION_TICKET); /* send blank ticket */
|
/* send blank ticket */
|
||||||
|
TLSX_SetResponse(ssl, TLSX_SESSION_TICKET);
|
||||||
ssl->options.createTicket = 1; /* will send ticket msg */
|
ssl->options.createTicket = 1; /* will send ticket msg */
|
||||||
ssl->options.useTicket = 1;
|
ssl->options.useTicket = 1;
|
||||||
ssl->options.resuming = 0; /* no standard resumption */
|
ssl->options.resuming = 0; /* no standard resumption */
|
||||||
@ -5063,6 +5070,10 @@ static int TLSX_SessionTicket_Parse(WOLFSSL* ssl, byte* input, word16 length,
|
|||||||
WOLFSSL_MSG("Process client ticket rejected, not using");
|
WOLFSSL_MSG("Process client ticket rejected, not using");
|
||||||
ssl->options.rejectTicket = 1;
|
ssl->options.rejectTicket = 1;
|
||||||
ret = 0; /* not fatal */
|
ret = 0; /* not fatal */
|
||||||
|
} else if (ret == VERSION_ERROR) {
|
||||||
|
WOLFSSL_MSG("Process client ticket rejected, bad TLS version");
|
||||||
|
ssl->options.rejectTicket = 1;
|
||||||
|
ret = 0; /* not fatal */
|
||||||
} else if (ret == WOLFSSL_TICKET_RET_FATAL || ret < 0) {
|
} else if (ret == WOLFSSL_TICKET_RET_FATAL || ret < 0) {
|
||||||
WOLFSSL_MSG("Process client ticket fatal error, not using");
|
WOLFSSL_MSG("Process client ticket fatal error, not using");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user