3838
3939#include <wolfssl/ssl.h>
4040
41- #ifdef WOLFSSL_DTLS
42- #include <wolfssl/error-ssl.h>
43- #endif
44-
4541#if defined(WOLFSSL_MDK_ARM ) || defined(WOLFSSL_KEIL_TCP_NET )
4642 #include <stdio.h>
4743 #include <string.h>
@@ -94,7 +90,6 @@ void echoclient_test(void* args)
9490 SSL * ssl = 0 ;
9591
9692 int ret = 0 , err = 0 ;
97- int doDTLS = 0 ;
9893 int doPSK = 0 ;
9994 int sendSz ;
10095#ifndef WOLFSSL_MDK_SHELL
@@ -123,10 +118,6 @@ void echoclient_test(void* args)
123118 if (!fin ) err_sys ("can't open input file" );
124119 if (!fout ) err_sys ("can't open output file" );
125120
126- #ifdef WOLFSSL_DTLS
127- doDTLS = 1 ;
128- #endif
129-
130121#ifdef WOLFSSL_LEANPSK
131122 doPSK = 1 ;
132123#endif
@@ -142,13 +133,7 @@ void echoclient_test(void* args)
142133 port = wolfSSLPort ;
143134#endif
144135
145- #if defined(WOLFSSL_DTLS )
146- #ifdef WOLFSSL_DTLS13
147- method = wolfDTLSv1_3_client_method ();
148- #elif !defined(WOLFSSL_NO_TLS12 )
149- method = DTLSv1_2_client_method ();
150- #endif
151- #elif !defined(NO_TLS )
136+ #if !defined(NO_TLS )
152137 #if defined(WOLFSSL_TLS13 ) && defined(WOLFSSL_SNIFFER )
153138 method = wolfTLSv1_2_client_method ();
154139 #else
@@ -239,13 +224,9 @@ void echoclient_test(void* args)
239224#endif /* WOLFSSL_ASYNC_CRYPT */
240225
241226 ssl = SSL_new (ctx );
242- tcp_connect (& sockfd , wolfSSLIP , port , doDTLS , 0 , ssl );
227+ tcp_connect (& sockfd , wolfSSLIP , port , 0 , 0 , ssl );
243228
244229 SSL_set_fd (ssl , sockfd );
245- #if defined(USE_WINDOWS_API ) && defined(WOLFSSL_DTLS ) && defined(NO_MAIN_DRIVER )
246- /* let echoserver bind first, TODO: add Windows signal like pthreads does */
247- Sleep (100 );
248- #endif
249230
250231 do {
251232 err = 0 ; /* Reset error */
@@ -324,16 +305,6 @@ void echoclient_test(void* args)
324305 LIBCALL_CHECK_RET (fflush (fout ));
325306 sendSz -= ret ;
326307 }
327- #ifdef WOLFSSL_DTLS
328- else if (wolfSSL_dtls (ssl ) &&
329- err == WC_NO_ERR_TRACE (DECRYPT_ERROR ))
330- {
331- /* This condition is OK. The packet should be dropped
332- * silently when there is a decrypt or MAC error on
333- * a DTLS record. */
334- sendSz = 0 ;
335- }
336- #endif
337308 else {
338309 fprintf (stderr , "SSL_read msg error %d, %s\n" , err ,
339310 ERR_error_string ((unsigned long )err , buffer ));
@@ -342,27 +313,7 @@ void echoclient_test(void* args)
342313 }
343314 }
344315
345-
346- #ifdef WOLFSSL_DTLS
347- strncpy (msg , "break" , 6 );
348- sendSz = (int )strlen (msg );
349- /* try to tell server done */
350- do {
351- err = 0 ; /* reset error */
352- ret = SSL_write (ssl , msg , sendSz );
353- if (ret <= 0 ) {
354- err = SSL_get_error (ssl , 0 );
355- #ifdef WOLFSSL_ASYNC_CRYPT
356- if (err == WC_NO_ERR_TRACE (WC_PENDING_E )) {
357- ret = wolfSSL_AsyncPoll (ssl , WOLF_POLL_FLAG_CHECK_HW );
358- if (ret < 0 ) break ;
359- }
360- #endif
361- }
362- } while (err == WC_NO_ERR_TRACE (WC_PENDING_E ));
363- #else
364316 SSL_shutdown (ssl );
365- #endif
366317
367318 SSL_free (ssl );
368319 SSL_CTX_free (ctx );
0 commit comments