@@ -2567,117 +2567,3 @@ int test_dtls13_min_rtx_interval(void)
25672567#endif
25682568 return EXPECT_RESULT ();
25692569}
2570-
2571- /* DTLS stateless API handling multiple CHs with different HRR groups */
2572- int test_dtls_stateless_hrr_group (void )
2573- {
2574- EXPECT_DECLS ;
2575- #if defined(HAVE_MANUAL_MEMIO_TESTS_DEPENDENCIES ) && defined(WOLFSSL_DTLS )
2576- size_t i ;
2577- struct {
2578- method_provider client_meth ;
2579- method_provider server_meth ;
2580- } params [] = {
2581- #if defined(WOLFSSL_TLS13 ) && defined (WOLFSSL_DTLS13 )
2582- { wolfDTLSv1_3_client_method , wolfDTLSv1_3_server_method },
2583- #endif
2584- #if !defined (WOLFSSL_NO_TLS12 ) && defined (WOLFSSL_DTLS )
2585- { wolfDTLSv1_2_client_method , wolfDTLSv1_2_server_method },
2586- #endif
2587- };
2588- XMEMSET (& test_memio_wolfio_ctx , 0 , sizeof (test_memio_wolfio_ctx ));
2589- for (i = 0 ; i < XELEM_CNT (params ) && !EXPECT_FAIL (); i ++ ) {
2590- WOLFSSL_CTX * ctx_s = NULL , * ctx_c = NULL ;
2591- WOLFSSL * ssl_s = NULL , * ssl_c1 = NULL , * ssl_c2 = NULL ;
2592- struct test_memio_ctx test_ctx ;
2593- int groups_1 [] = {
2594- WOLFSSL_ECC_SECP256R1 ,
2595- WOLFSSL_ECC_SECP384R1 ,
2596- WOLFSSL_ECC_SECP521R1
2597- };
2598- int groups_2 [] = {
2599- WOLFSSL_ECC_SECP384R1 ,
2600- WOLFSSL_ECC_SECP521R1
2601- };
2602- char hrrBuf [1000 ];
2603- int hrrSz = sizeof (hrrBuf );
2604-
2605- XMEMSET (& test_ctx , 0 , sizeof (test_ctx ));
2606-
2607- ExpectIntEQ (test_memio_setup (& test_ctx , & ctx_c , & ctx_s , & ssl_c1 , & ssl_s ,
2608- params [i ].client_meth , params [i ].server_meth ), 0 );
2609-
2610- ExpectIntEQ (test_memio_setup (& test_ctx , & ctx_c , NULL , & ssl_c2 , NULL ,
2611- params [i ].client_meth , params [i ].server_meth ), 0 );
2612-
2613- test_memio_wolfio_ctx .test_ctx = & test_ctx ;
2614- test_memio_wolfio_ctx .ssl_s = ssl_s ;
2615- /* Large number to error out if any syscalls are called with it */
2616- test_memio_wolfio_ctx .fd = 6000 ;
2617- XMEMSET (& test_memio_wolfio_ctx .peer_addr , 0 ,
2618- sizeof (test_memio_wolfio_ctx .peer_addr ));
2619- test_memio_wolfio_ctx .peer_addr .ss_family = AF_INET ;
2620-
2621- wolfSSL_SetLoggingPrefix ("server" );
2622- wolfSSL_dtls_set_using_nonblock (ssl_s , 1 );
2623- wolfSSL_SetRecvFrom (ssl_s , test_memio_wolfio_recvfrom );
2624- /* Restore default functions */
2625- wolfSSL_SSLSetIORecv (ssl_s , EmbedReceiveFrom );
2626- ExpectIntEQ (wolfSSL_set_read_fd (ssl_s , test_memio_wolfio_ctx .fd ),
2627- WOLFSSL_SUCCESS );
2628-
2629- /* Set groups and disable key shares. This ensures that only the given
2630- * groups are in the SupportedGroups extension and that an empty key
2631- * share extension is sent in the initial ClientHello of each session.
2632- * This triggers the server to send a HelloRetryRequest with the first
2633- * group in the SupportedGroups extension selected. */
2634- wolfSSL_SetLoggingPrefix ("client1" );
2635- ExpectIntEQ (wolfSSL_set_groups (ssl_c1 , groups_1 , 3 ), WOLFSSL_SUCCESS );
2636- ExpectIntEQ (wolfSSL_NoKeyShares (ssl_c1 ), WOLFSSL_SUCCESS );
2637-
2638- wolfSSL_SetLoggingPrefix ("client2" );
2639- ExpectIntEQ (wolfSSL_set_groups (ssl_c2 , groups_2 , 2 ), WOLFSSL_SUCCESS );
2640- ExpectIntEQ (wolfSSL_NoKeyShares (ssl_c2 ), WOLFSSL_SUCCESS );
2641-
2642- /* Start handshake, send first ClientHello */
2643- wolfSSL_SetLoggingPrefix ("client1" );
2644- ExpectIntEQ (wolfSSL_connect (ssl_c1 ), -1 );
2645- ExpectIntEQ (wolfSSL_get_error (ssl_c1 , -1 ), WOLFSSL_ERROR_WANT_READ );
2646-
2647- /* Read first ClientHello, send HRR with WOLFSSL_ECC_SECP256R1 */
2648- wolfSSL_SetLoggingPrefix ("server" );
2649- ExpectIntEQ (wolfDTLS_accept_stateless (ssl_s ), 0 );
2650- ExpectIntEQ (test_memio_copy_message (& test_ctx , 1 , hrrBuf , & hrrSz , 0 ), 0 );
2651- ExpectIntGT (hrrSz , 0 );
2652- test_memio_clear_buffer (& test_ctx , 1 );
2653-
2654- /* Send second ClientHello */
2655- wolfSSL_SetLoggingPrefix ("client2" );
2656- ExpectIntEQ (wolfSSL_connect (ssl_c2 ), -1 );
2657- ExpectIntEQ (wolfSSL_get_error (ssl_c2 , -1 ), WOLFSSL_ERROR_WANT_READ );
2658-
2659- /* Read second ClientHello, send HRR now with WOLFSSL_ECC_SECP384R1 */
2660- wolfSSL_SetLoggingPrefix ("server" );
2661- ExpectIntEQ (wolfDTLS_accept_stateless (ssl_s ), 0 );
2662- test_memio_clear_buffer (& test_ctx , 1 );
2663-
2664- /* Complete first handshake with WOLFSSL_ECC_SECP256R1 */
2665- wolfSSL_SetLoggingPrefix ("client1" );
2666- ExpectIntEQ (test_memio_inject_message (& test_ctx , 1 , hrrBuf , hrrSz ), 0 );
2667- ExpectIntEQ (wolfSSL_connect (ssl_c1 ), -1 );
2668- ExpectIntEQ (wolfSSL_get_error (ssl_c1 , -1 ), WOLFSSL_ERROR_WANT_READ );
2669-
2670- wolfSSL_SetLoggingPrefix ("server" );
2671- ExpectIntEQ (wolfDTLS_accept_stateless (ssl_s ), WOLFSSL_SUCCESS );
2672-
2673- ExpectIntEQ (test_memio_do_handshake (ssl_c1 , ssl_s , 10 , NULL ), 0 );
2674-
2675- wolfSSL_free (ssl_s );
2676- wolfSSL_free (ssl_c1 );
2677- wolfSSL_free (ssl_c2 );
2678- wolfSSL_CTX_free (ctx_s );
2679- wolfSSL_CTX_free (ctx_c );
2680- }
2681- #endif
2682- return EXPECT_RESULT ();
2683- }
0 commit comments