From e048b67d0a2f73166b405194d489ff9fa7ee2f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 19 Jul 2013 12:47:00 +0200 Subject: [PATCH] Misc minor fixes - avoid "multi-line comment" warning in ssl_client2.c - rm useless initialisation of mfl_code in ssl_init() - const-correctness of ssl_parse_*_ext() - a code formating issue --- include/polarssl/ssl.h | 2 +- library/ssl_cli.c | 4 ++-- library/ssl_srv.c | 3 ++- library/ssl_tls.c | 2 -- programs/ssl/ssl_client2.c | 7 ++++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h index e9e33e3578..4e1d25a833 100644 --- a/include/polarssl/ssl.h +++ b/include/polarssl/ssl.h @@ -118,7 +118,7 @@ #define SSL_MINOR_VERSION_3 3 /*!< TLS v1.2 */ /* RFC 6066 section 4, see also mfl_code_to_length in ssl_tls.c - * NONE must be zero so that memset()ing session to zero works */ + * NONE must be zero so that memset()ing structure to zero works */ #define SSL_MAX_FRAG_LEN_NONE 0 /*!< don't use this extension */ #define SSL_MAX_FRAG_LEN_512 1 /*!< MaxFragmentLength 2^9 */ #define SSL_MAX_FRAG_LEN_1024 2 /*!< MaxFragmentLength 2^10 */ diff --git a/library/ssl_cli.c b/library/ssl_cli.c index 9050edb845..c89bf0cb0d 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c @@ -488,7 +488,7 @@ static int ssl_write_client_hello( ssl_context *ssl ) } static int ssl_parse_renegotiation_info( ssl_context *ssl, - unsigned char *buf, + const unsigned char *buf, size_t len ) { int ret; @@ -527,7 +527,7 @@ static int ssl_parse_renegotiation_info( ssl_context *ssl, return( 0 ); } static int ssl_parse_max_fragment_length_ext( ssl_context *ssl, - unsigned char *buf, + const unsigned char *buf, size_t len ) { /* diff --git a/library/ssl_srv.c b/library/ssl_srv.c index abcc867ddb..3e1838667f 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c @@ -992,7 +992,8 @@ static void ssl_write_max_fragment_length_ext( ssl_context *ssl, { unsigned char *p = buf; - if( ssl->session_negotiate->mfl_code == SSL_MAX_FRAG_LEN_NONE ) { + if( ssl->session_negotiate->mfl_code == SSL_MAX_FRAG_LEN_NONE ) + { *olen = 0; return; } diff --git a/library/ssl_tls.c b/library/ssl_tls.c index a230dc9393..f701a8a1ff 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -2843,8 +2843,6 @@ int ssl_init( ssl_context *ssl ) memset( ssl-> in_ctr, 0, SSL_BUFFER_LEN ); memset( ssl->out_ctr, 0, SSL_BUFFER_LEN ); - ssl->mfl_code = SSL_MAX_FRAG_LEN_NONE; - ssl->hostname = NULL; ssl->hostname_len = 0; diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 0c770f6d96..56d0e91122 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -59,8 +59,7 @@ #define DFL_AUTH_MODE SSL_VERIFY_OPTIONAL #define DFL_MFL_CODE SSL_MAX_FRAG_LEN_NONE -/* Uncomment to test sending longer paquets (for fragmentation purposes) */ -#define LONG_HEADER // "User-agent: blah-blah-blah-blah-blah-blah-blah-" \ +#define LONG_HEADER "User-agent: blah-blah-blah-blah-blah-blah-blah-blah-" \ "-01--blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-" \ "-02--blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-" \ "-03--blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-" \ @@ -69,7 +68,9 @@ "-06--blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-" \ "-07--blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-blah-END\r\n" -#define GET_REQUEST "GET %s HTTP/1.0\r\n" LONG_HEADER "\r\n" +/* Uncomment LONG_HEADER in the definition of GET_REQUEST to test sending + * longer paquets (for fragmentation purposes) */ +#define GET_REQUEST "GET %s HTTP/1.0\r\n" /* LONG_HEADER */ "\r\n" /* * global options