Skip to content

Commit d8fd19f

Browse files
committed
DTLS SRTP should also do a cookie exchange since it uses UDP
1 parent eda6c18 commit d8fd19f

4 files changed

Lines changed: 41 additions & 2 deletions

File tree

src/ssl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10836,8 +10836,7 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl,
1083610836
ssl->options.dtls = 1;
1083710837
ssl->options.tls = 1;
1083810838
ssl->options.tls1_1 = 1;
10839-
if (!IsDtlsNotSctpMode(ssl) || !IsDtlsNotSrtpMode(ssl) ||
10840-
IsSCR(ssl))
10839+
if (!IsDtlsNotSctpMode(ssl) || IsSCR(ssl))
1084110840
ssl->options.dtlsStateful = 1;
1084210841
}
1084310842
#endif

tests/api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51226,6 +51226,7 @@ TEST_DECL(test_wc_RsaPSS_DigitalSignVerify),
5122651226
TEST_DECL(test_dtls_rtx_across_epoch_change),
5122751227
TEST_DECL(test_dtls_drop_client_ack),
5122851228
TEST_DECL(test_dtls_replay),
51229+
TEST_DECL(test_dtls_srtp),
5122951230
TEST_DECL(test_dtls13_ack_order),
5123051231
TEST_DECL(test_dtls_version_checking),
5123151232
TEST_DECL(test_ocsp_status_callback),

tests/api/test_dtls.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,3 +1525,41 @@ int test_dtls_replay(void)
15251525
#endif
15261526
return EXPECT_RESULT();
15271527
}
1528+
1529+
#if defined(WOLFSSL_DTLS13) && defined(HAVE_SSL_MEMIO_TESTS_DEPENDENCIES) && \
1530+
defined(WOLFSSL_SRTP)
1531+
static int test_dtls_srtp_ctx_ready(WOLFSSL_CTX* ctx)
1532+
{
1533+
EXPECT_DECLS;
1534+
ExpectIntEQ(wolfSSL_CTX_set_tlsext_use_srtp(ctx, "SRTP_AEAD_AES_256_GCM:"
1535+
"SRTP_AEAD_AES_128_GCM:SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32"),
1536+
0);
1537+
return EXPECT_RESULT();
1538+
}
1539+
1540+
int test_dtls_srtp(void)
1541+
{
1542+
EXPECT_DECLS;
1543+
test_ssl_cbf client_cbf;
1544+
test_ssl_cbf server_cbf;
1545+
1546+
XMEMSET(&client_cbf, 0, sizeof(client_cbf));
1547+
XMEMSET(&server_cbf, 0, sizeof(server_cbf));
1548+
1549+
client_cbf.method = wolfDTLSv1_3_client_method;
1550+
client_cbf.ctx_ready = test_dtls_srtp_ctx_ready;
1551+
server_cbf.method = wolfDTLSv1_3_server_method;
1552+
server_cbf.ctx_ready = test_dtls_srtp_ctx_ready;
1553+
1554+
ExpectIntEQ(test_wolfSSL_client_server_nofail_memio(&client_cbf,
1555+
&server_cbf, NULL), TEST_SUCCESS);
1556+
1557+
return EXPECT_RESULT();
1558+
}
1559+
#else
1560+
int test_dtls_srtp(void)
1561+
{
1562+
EXPECT_DECLS;
1563+
return EXPECT_RESULT();
1564+
}
1565+
#endif

tests/api/test_dtls.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ int test_dtls_record_cross_boundaries(void);
3939
int test_dtls_rtx_across_epoch_change(void);
4040
int test_dtls_drop_client_ack(void);
4141
int test_dtls_replay(void);
42+
int test_dtls_srtp(void);
4243
#endif /* TESTS_API_DTLS_H */

0 commit comments

Comments
 (0)