@@ -62854,6 +62854,94 @@ static int test_wolfSSL_configure_args(void)
6285462854#endif
6285562855 return EXPECT_RESULT();
6285662856}
62857+
62858+ static int test_dtls_no_extensions(void)
62859+ {
62860+ EXPECT_DECLS;
62861+ #if defined(WOLFSSL_DTLS) && !defined(NO_FILESYSTEM)
62862+ WOLFSSL *ssl_s = NULL;
62863+ WOLFSSL_CTX *ctx_s = NULL;
62864+ struct test_memio_ctx test_ctx;
62865+ const byte chNoExtensions[] = {
62866+ /* Handshake type */
62867+ 0x16,
62868+ /* Version */
62869+ 0xfe, 0xff,
62870+ /* Epoch */
62871+ 0x00, 0x00,
62872+ /* Seq number */
62873+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62874+ /* Length */
62875+ 0x00, 0x40,
62876+ /* CH type */
62877+ 0x01,
62878+ /* Length */
62879+ 0x00, 0x00, 0x34,
62880+ /* Msg Seq */
62881+ 0x00, 0x00,
62882+ /* Frag offset */
62883+ 0x00, 0x00, 0x00,
62884+ /* Frag length */
62885+ 0x00, 0x00, 0x34,
62886+ /* Version */
62887+ 0xfe, 0xff,
62888+ /* Random */
62889+ 0x62, 0xfe, 0xbc, 0xfe, 0x2b, 0xfe, 0x3f, 0xeb, 0x03, 0xc4, 0xea, 0x37,
62890+ 0xe7, 0x47, 0x7e, 0x8a, 0xd9, 0xbf, 0x77, 0x0f, 0x6c, 0xb6, 0x77, 0x0b,
62891+ 0x03, 0x3f, 0x82, 0x2b, 0x21, 0x64, 0x57, 0x1d,
62892+ /* Session Length */
62893+ 0x00,
62894+ /* Cookie Length */
62895+ 0x00,
62896+ /* CS Length */
62897+ 0x00, 0x0c,
62898+ /* CS */
62899+ 0xc0, 0x0a, 0xc0, 0x09, 0xc0, 0x14, 0xc0, 0x13, 0x00, 0x39, 0x00, 0x33,
62900+ /* Comp Meths Length */
62901+ 0x01,
62902+ /* Comp Meths */
62903+ 0x00
62904+ /* And finally... no extensions */
62905+ };
62906+ int i;
62907+ #ifdef OPENSSL_EXTRA
62908+ int repeats = 2;
62909+ #else
62910+ int repeats = 1;
62911+ #endif
62912+
62913+ for (i = 0; i < repeats; i++) {
62914+ XMEMSET(&test_ctx, 0, sizeof(test_ctx));
62915+ ssl_s = NULL;
62916+ ctx_s = NULL;
62917+
62918+ ExpectIntEQ(test_memio_setup(&test_ctx, NULL, &ctx_s, NULL, &ssl_s,
62919+ NULL, wolfDTLS_server_method), 0);
62920+
62921+ XMEMCPY(test_ctx.s_buff, chNoExtensions, sizeof(chNoExtensions));
62922+ test_ctx.s_len = sizeof(chNoExtensions);
62923+
62924+ #ifdef OPENSSL_EXTRA
62925+ if (i > 0) {
62926+ ExpectIntEQ(wolfSSL_set_max_proto_version(ssl_s, DTLS1_2_VERSION),
62927+ WOLFSSL_SUCCESS);
62928+ }
62929+ #endif
62930+
62931+ ExpectIntEQ(wolfSSL_accept(ssl_s), -1);
62932+ ExpectIntEQ(wolfSSL_get_error(ssl_s, -1), WOLFSSL_ERROR_WANT_READ);
62933+
62934+ /* Expecting a handshake msg. Either HVR or SH. */
62935+ ExpectIntGT(test_ctx.c_len, 0);
62936+ ExpectIntEQ(test_ctx.c_buff[0], 0x16);
62937+
62938+ wolfSSL_free(ssl_s);
62939+ wolfSSL_CTX_free(ctx_s);
62940+ }
62941+ #endif
62942+ return EXPECT_RESULT();
62943+ }
62944+
6285762945/*----------------------------------------------------------------------------*
6285862946 | Main
6285962947 *----------------------------------------------------------------------------*/
@@ -64103,6 +64191,7 @@ TEST_CASE testCases[] = {
6410364191 TEST_DECL(test_dtls_msg_from_other_peer),
6410464192 TEST_DECL(test_dtls_ipv6_check),
6410564193 TEST_DECL(test_wolfSSL_SCR_after_resumption),
64194+ TEST_DECL(test_dtls_no_extensions),
6410664195 /* This test needs to stay at the end to clean up any caches allocated. */
6410764196 TEST_DECL(test_wolfSSL_Cleanup)
6410864197};
0 commit comments