From 53b3e0603b592c61d9c0a49a8082feb62e253856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 29 Oct 2013 18:16:38 +0100 Subject: [PATCH] Add code for testing client-initiated renegotiation --- programs/ssl/ssl_client2.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 247abbe05..6879f3e5b 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -71,6 +71,9 @@ * longer paquets (for fragmentation purposes) */ #define GET_REQUEST "GET %s HTTP/1.0\r\n" /* LONG_HEADER */ "\r\n" +/* Temporary, should become a runtime option later */ +// #define TEST_RENEGO + /* * global options */ @@ -792,6 +795,24 @@ int main( int argc, char *argv[] ) } #endif /* POLARSSL_X509_CRT_PARSE_C */ +#ifdef TEST_RENEGO + /* + * Perform renegotiation (this must be done when the server is waiting + * for input from our side). + */ + printf( " . Performing renegotiation..." ); + fflush( stdout ); + while( ( ret = ssl_renegotiate( &ssl ) ) != 0 ) + { + if( ret != POLARSSL_ERR_NET_WANT_READ && ret != POLARSSL_ERR_NET_WANT_WRITE ) + { + printf( " failed\n ! ssl_renegotiate returned %d\n\n", ret ); + goto exit; + } + } + printf( " ok\n" ); +#endif + /* * 6. Write the GET request */