Skip to content

Commit ede8cde

Browse files
committed
dtls: Increment sequence number in SendAlert
1 parent e428c28 commit ede8cde

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/internal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24894,6 +24894,11 @@ static int SendAlert_ex(WOLFSSL* ssl, int severity, int type)
2489424894
#endif /* WOLFSSL_DTLS13 */
2489524895
{
2489624896
AddRecordHeader(output, ALERT_SIZE, alert, ssl, CUR_ORDER);
24897+
#ifdef WOLFSSL_DTLS
24898+
/* AddRecordHeader doesn't increment the seq number */
24899+
if (ssl->options.dtls)
24900+
DtlsSEQIncrement(ssl, CUR_ORDER);
24901+
#endif
2489724902
}
2489824903

2489924904
output += RECORD_HEADER_SZ;

tests/api.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72699,7 +72699,7 @@ static int test_wolfSSL_SendUserCanceled(void)
7269972699
struct test_memio_ctx test_ctx;
7270072700
WOLFSSL_ALERT_HISTORY h;
7270172701

72702-
printf("Testing %s", params[i].tls_version);
72702+
printf("Testing %s\n", params[i].tls_version);
7270372703

7270472704
XMEMSET(&h, 0, sizeof(h));
7270572705
XMEMSET(&test_ctx, 0, sizeof(test_ctx));
@@ -72719,8 +72719,8 @@ static int test_wolfSSL_SendUserCanceled(void)
7271972719
/* Last alert will be close notify because user_canceled should be
7272072720
* followed by a close_notify */
7272172721
ExpectIntEQ(wolfSSL_get_alert_history(ssl_c, &h), WOLFSSL_SUCCESS);
72722-
AssertIntEQ(h.last_rx.code, close_notify);
72723-
AssertIntEQ(h.last_rx.level, alert_warning);
72722+
ExpectIntEQ(h.last_rx.code, close_notify);
72723+
ExpectIntEQ(h.last_rx.level, alert_warning);
7272472724

7272572725
wolfSSL_free(ssl_c);
7272672726
wolfSSL_free(ssl_s);

0 commit comments

Comments
 (0)