From 2f5a1b4e553f0aea23613db2f092bc3a106bcd58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 9 Mar 2015 11:12:32 +0000 Subject: [PATCH] Rename SSL_RENEGOTIATION macro - new name is more explicit - avoids collision with POLARSSL_SSL_RENEGOTIATION config flag when prefixing will be applied --- include/polarssl/ssl.h | 2 +- library/ssl_cli.c | 10 +++++----- library/ssl_srv.c | 12 ++++++------ library/ssl_tls.c | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h index 8c754ff14..ef1316473 100644 --- a/include/polarssl/ssl.h +++ b/include/polarssl/ssl.h @@ -236,7 +236,7 @@ #define SSL_VERIFY_REQUIRED 2 #define SSL_INITIAL_HANDSHAKE 0 -#define SSL_RENEGOTIATION 1 /* In progress */ +#define SSL_RENEGOTIATION_IN_PROGRESS 1 /* In progress */ #define SSL_RENEGOTIATION_DONE 2 /* Done or aborted */ #define SSL_RENEGOTIATION_PENDING 3 /* Requested (server only) */ diff --git a/library/ssl_cli.c b/library/ssl_cli.c index 1244435e5..ab9eeed87 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c @@ -120,7 +120,7 @@ static void ssl_write_renegotiation_ext( ssl_context *ssl, *olen = 0; - if( ssl->renegotiation != SSL_RENEGOTIATION ) + if( ssl->renegotiation != SSL_RENEGOTIATION_IN_PROGRESS ) return; SSL_DEBUG_MSG( 3, ( "client hello, adding renegotiation extension" ) ); @@ -1195,7 +1195,7 @@ static int ssl_parse_server_hello( ssl_context *ssl ) if( ssl->in_msgtype != SSL_MSG_HANDSHAKE ) { #if defined(POLARSSL_SSL_RENEGOTIATION) - if( ssl->renegotiation == SSL_RENEGOTIATION ) + if( ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS ) { ssl->renego_records_seen++; @@ -1581,21 +1581,21 @@ static int ssl_parse_server_hello( ssl_context *ssl ) handshake_failure = 1; } #if defined(POLARSSL_SSL_RENEGOTIATION) - else if( ssl->renegotiation == SSL_RENEGOTIATION && + else if( ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS && ssl->secure_renegotiation == SSL_SECURE_RENEGOTIATION && renegotiation_info_seen == 0 ) { SSL_DEBUG_MSG( 1, ( "renegotiation_info extension missing (secure)" ) ); handshake_failure = 1; } - else if( ssl->renegotiation == SSL_RENEGOTIATION && + else if( ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS && ssl->secure_renegotiation == SSL_LEGACY_RENEGOTIATION && ssl->allow_legacy_renegotiation == SSL_LEGACY_NO_RENEGOTIATION ) { SSL_DEBUG_MSG( 1, ( "legacy renegotiation not allowed" ) ); handshake_failure = 1; } - else if( ssl->renegotiation == SSL_RENEGOTIATION && + else if( ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS && ssl->secure_renegotiation == SSL_LEGACY_RENEGOTIATION && renegotiation_info_seen == 1 ) { diff --git a/library/ssl_srv.c b/library/ssl_srv.c index 59c1c1e77..499fe06e2 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c @@ -1189,7 +1189,7 @@ static int ssl_parse_client_hello_v2( ssl_context *ssl ) { SSL_DEBUG_MSG( 3, ( "received TLS_EMPTY_RENEGOTIATION_INFO " ) ); #if defined(POLARSSL_SSL_RENEGOTIATION) - if( ssl->renegotiation == SSL_RENEGOTIATION ) + if( ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS ) { SSL_DEBUG_MSG( 1, ( "received RENEGOTIATION SCSV " "during renegotiation" ) ); @@ -1805,7 +1805,7 @@ read_record_header: case TLS_EXT_SIG_ALG: SSL_DEBUG_MSG( 3, ( "found signature_algorithms extension" ) ); #if defined(POLARSSL_SSL_RENEGOTIATION) - if( ssl->renegotiation == SSL_RENEGOTIATION ) + if( ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS ) break; #endif @@ -1941,7 +1941,7 @@ read_record_header: if( p[0] == 0 && p[1] == SSL_EMPTY_RENEGOTIATION_INFO ) { SSL_DEBUG_MSG( 3, ( "received TLS_EMPTY_RENEGOTIATION_INFO " ) ); - if( ssl->renegotiation == SSL_RENEGOTIATION ) + if( ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS ) { SSL_DEBUG_MSG( 1, ( "received RENEGOTIATION SCSV during renegotiation" ) ); @@ -1965,21 +1965,21 @@ read_record_header: handshake_failure = 1; } #if defined(POLARSSL_SSL_RENEGOTIATION) - else if( ssl->renegotiation == SSL_RENEGOTIATION && + else if( ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS && ssl->secure_renegotiation == SSL_SECURE_RENEGOTIATION && renegotiation_info_seen == 0 ) { SSL_DEBUG_MSG( 1, ( "renegotiation_info extension missing (secure)" ) ); handshake_failure = 1; } - else if( ssl->renegotiation == SSL_RENEGOTIATION && + else if( ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS && ssl->secure_renegotiation == SSL_LEGACY_RENEGOTIATION && ssl->allow_legacy_renegotiation == SSL_LEGACY_NO_RENEGOTIATION ) { SSL_DEBUG_MSG( 1, ( "legacy renegotiation not allowed" ) ); handshake_failure = 1; } - else if( ssl->renegotiation == SSL_RENEGOTIATION && + else if( ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS && ssl->secure_renegotiation == SSL_LEGACY_RENEGOTIATION && renegotiation_info_seen == 1 ) { diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 5e9df52e0..d474ccdab 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -3206,7 +3206,7 @@ static int ssl_parse_record_header( ssl_context *ssl ) * except at the beginning of renegotiations */ if( ssl->in_msgtype == SSL_MSG_APPLICATION_DATA && ssl->state != SSL_HANDSHAKE_OVER && - ! ( ssl->renegotiation == SSL_RENEGOTIATION && + ! ( ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS && ssl->state == SSL_SERVER_HELLO ) ) { SSL_DEBUG_MSG( 1, ( "dropping unexpected ApplicationData" ) ); @@ -3942,7 +3942,7 @@ int ssl_parse_certificate( ssl_context *ssl ) */ #if defined(POLARSSL_SSL_RENEGOTIATION) && defined(POLARSSL_SSL_CLI_C) if( ssl->endpoint == SSL_IS_CLIENT && - ssl->renegotiation == SSL_RENEGOTIATION ) + ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS ) { if( ssl->session->peer_cert == NULL ) { @@ -4487,7 +4487,7 @@ void ssl_handshake_wrapup( ssl_context *ssl ) SSL_DEBUG_MSG( 3, ( "=> handshake wrapup" ) ); #if defined(POLARSSL_SSL_RENEGOTIATION) - if( ssl->renegotiation == SSL_RENEGOTIATION ) + if( ssl->renegotiation == SSL_RENEGOTIATION_IN_PROGRESS ) { ssl->renegotiation = SSL_RENEGOTIATION_DONE; ssl->renego_records_seen = 0; @@ -5979,7 +5979,7 @@ static int ssl_start_renegotiation( ssl_context *ssl ) #endif ssl->state = SSL_HELLO_REQUEST; - ssl->renegotiation = SSL_RENEGOTIATION; + ssl->renegotiation = SSL_RENEGOTIATION_IN_PROGRESS; if( ( ret = ssl_handshake( ssl ) ) != 0 ) { @@ -6022,7 +6022,7 @@ int ssl_renegotiate( ssl_context *ssl ) * On client, either start the renegotiation process or, * if already in progress, continue the handshake */ - if( ssl->renegotiation != SSL_RENEGOTIATION ) + if( ssl->renegotiation != SSL_RENEGOTIATION_IN_PROGRESS ) { if( ssl->state != SSL_HANDSHAKE_OVER ) return( POLARSSL_ERR_SSL_BAD_INPUT_DATA );