dtls: Increment sequence number in SendAlert

This commit is contained in:
Juliusz Sosinowicz
2024-06-04 17:13:00 +02:00
parent e428c2833b
commit ede8cde8a7
2 changed files with 8 additions and 3 deletions

View File

@ -24894,6 +24894,11 @@ static int SendAlert_ex(WOLFSSL* ssl, int severity, int type)
#endif /* WOLFSSL_DTLS13 */
{
AddRecordHeader(output, ALERT_SIZE, alert, ssl, CUR_ORDER);
#ifdef WOLFSSL_DTLS
/* AddRecordHeader doesn't increment the seq number */
if (ssl->options.dtls)
DtlsSEQIncrement(ssl, CUR_ORDER);
#endif
}
output += RECORD_HEADER_SZ;

View File

@ -72699,7 +72699,7 @@ static int test_wolfSSL_SendUserCanceled(void)
struct test_memio_ctx test_ctx;
WOLFSSL_ALERT_HISTORY h;
printf("Testing %s", params[i].tls_version);
printf("Testing %s\n", params[i].tls_version);
XMEMSET(&h, 0, sizeof(h));
XMEMSET(&test_ctx, 0, sizeof(test_ctx));
@ -72719,8 +72719,8 @@ static int test_wolfSSL_SendUserCanceled(void)
/* Last alert will be close notify because user_canceled should be
* followed by a close_notify */
ExpectIntEQ(wolfSSL_get_alert_history(ssl_c, &h), WOLFSSL_SUCCESS);
AssertIntEQ(h.last_rx.code, close_notify);
AssertIntEQ(h.last_rx.level, alert_warning);
ExpectIntEQ(h.last_rx.code, close_notify);
ExpectIntEQ(h.last_rx.level, alert_warning);
wolfSSL_free(ssl_c);
wolfSSL_free(ssl_s);