Skip to content

Commit 59ff71f

Browse files
committed
fixup! dtls13: move Dtls13NewEpoch into DeriveTls13Keys
1 parent c1c1929 commit 59ff71f

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/tls13.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,9 +1471,6 @@ int DeriveTls13Keys(WOLFSSL* ssl, int secret, int side, int store)
14711471
byte key_dig[MAX_PRF_DIG];
14721472
#endif
14731473
int provision;
1474-
#ifdef WOLFSSL_DTLS13
1475-
w64wrapper epochNumber;
1476-
#endif
14771474

14781475
#if defined(WOLFSSL_RENESAS_TSIP_TLS)
14791476
ret = tsip_Tls13DeriveKeys(ssl, secret, side);
@@ -1626,6 +1623,7 @@ int DeriveTls13Keys(WOLFSSL* ssl, int secret, int side, int store)
16261623
goto end;
16271624

16281625
if (ssl->options.dtls) {
1626+
w64wrapper epochNumber;
16291627
ret = Dtls13DeriveSnKeys(ssl, provision);
16301628
if (ret != 0)
16311629
return ret;
@@ -1652,7 +1650,9 @@ int DeriveTls13Keys(WOLFSSL* ssl, int secret, int side, int store)
16521650
return BAD_STATE_E;
16531651
}
16541652
w64Increment(&epochNumber);
1655-
break;
1653+
break;
1654+
default:
1655+
return BAD_STATE_E;
16561656
}
16571657
ret = Dtls13NewEpoch(ssl, epochNumber, side);
16581658
if (ret != 0)

tests/api/test_dtls.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ int test_dtls_rtx_across_epoch_change(void)
13351335
ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
13361336
ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), SSL_ERROR_WANT_READ);
13371337

1338-
/* SH */
1338+
/* HRR */
13391339
wolfSSL_SetLoggingPrefix("server:");
13401340
ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
13411341
ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), SSL_ERROR_WANT_READ);
@@ -1345,14 +1345,15 @@ int test_dtls_rtx_across_epoch_change(void)
13451345
ExpectIntEQ(wolfSSL_connect(ssl_c), -1);
13461346
ExpectIntEQ(wolfSSL_get_error(ssl_c, -1), SSL_ERROR_WANT_READ);
13471347

1348+
/* SH ... FINISHED */
13481349
wolfSSL_SetLoggingPrefix("server:");
13491350
ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
13501351
ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), SSL_ERROR_WANT_READ);
13511352

13521353
/* we should have now SH ... FINISHED messages in the buffer*/
13531354
ExpectIntGE(test_ctx.c_msg_count, 2);
13541355

1355-
/* now let's drop everything but the SH */
1356+
/* drop everything but the SH */
13561357
while (test_ctx.c_msg_count > 1 && EXPECT_SUCCESS()) {
13571358
ExpectIntEQ(test_memio_drop_message(&test_ctx, 1, test_ctx.c_msg_count - 1), 0);
13581359
}

0 commit comments

Comments
 (0)