Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -27549,6 +27549,9 @@ const char* wolfSSL_ERR_reason_error_string(unsigned long e)

case WOLFSSL_EVP_R_PRIVATE_KEY_DECODE_ERROR:
return "Private key decode error (EVP)";

case SESSION_TICKET_NONCE_OVERFLOW:
return "Session ticket nonce overflow";
}

return "unknown error number";
Expand Down
7 changes: 7 additions & 0 deletions src/tls13.c
Original file line number Diff line number Diff line change
Expand Up @@ -12159,6 +12159,13 @@ static int SendTls13NewSessionTicket(WOLFSSL* ssl)
if (ssl->error != WC_NO_ERR_TRACE(WC_PENDING_E))
#endif
{
if (ssl->session->ticketNonce.data[0] == 255) {
/* RFC8446 Section 4.6.1: Each ticket must have a unique nonce
* value. As the nonce is only a single byte, we have to prevent
* the overflow and abort. */
return SESSION_TICKET_NONCE_OVERFLOW;
}
else
ssl->session->ticketNonce.data[0]++;
Comment thread
Frauschi marked this conversation as resolved.
}

Expand Down
4 changes: 3 additions & 1 deletion wolfssl/error-ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ enum wolfSSL_ErrorCodes {
CRYPTO_POLICY_FORBIDDEN = -516, /* operation forbidden by system
* crypto-policy */

WOLFSSL_LAST_E = -516
SESSION_TICKET_NONCE_OVERFLOW = -517, /* Session ticket nonce overflow */

WOLFSSL_LAST_E = -517

/* codes -1000 to -1999 are reserved for wolfCrypt. */
};
Expand Down