Avoid nested if's without braces.

Creates a potential for confusing code if we later want to add an else clause.
This commit is contained in:
Manuel Pégourié-Gonnard 2015-01-22 11:06:40 +00:00
parent 5d9cde25da
commit 59c6f2ef21
2 changed files with 19 additions and 13 deletions

View File

@ -605,6 +605,7 @@ static int ssl_write_client_hello( ssl_context *ssl )
*/ */
#if defined(POLARSSL_SSL_RENEGOTIATION) #if defined(POLARSSL_SSL_RENEGOTIATION)
if( ssl->renegotiation == SSL_INITIAL_HANDSHAKE ) if( ssl->renegotiation == SSL_INITIAL_HANDSHAKE )
{
#endif #endif
if( ssl->session_negotiate->ticket != NULL && if( ssl->session_negotiate->ticket != NULL &&
ssl->session_negotiate->ticket_len != 0 ) ssl->session_negotiate->ticket_len != 0 )
@ -616,6 +617,7 @@ static int ssl_write_client_hello( ssl_context *ssl )
ssl->session_negotiate->length = n = 32; ssl->session_negotiate->length = n = 32;
} }
}
#endif /* POLARSSL_SSL_SESSION_TICKETS */ #endif /* POLARSSL_SSL_SESSION_TICKETS */
*p++ = (unsigned char) n; *p++ = (unsigned char) n;

View File

@ -1248,11 +1248,13 @@ static int ssl_parse_client_hello( ssl_context *ssl )
#if defined(POLARSSL_SSL_RENEGOTIATION) #if defined(POLARSSL_SSL_RENEGOTIATION)
if( ssl->renegotiation == SSL_INITIAL_HANDSHAKE ) if( ssl->renegotiation == SSL_INITIAL_HANDSHAKE )
#endif #endif
{
if( ( ret = ssl_fetch_input( ssl, 5 ) ) != 0 ) if( ( ret = ssl_fetch_input( ssl, 5 ) ) != 0 )
{ {
SSL_DEBUG_RET( 1, "ssl_fetch_input", ret ); SSL_DEBUG_RET( 1, "ssl_fetch_input", ret );
return( ret ); return( ret );
} }
}
buf = ssl->in_hdr; buf = ssl->in_hdr;
@ -1301,11 +1303,13 @@ static int ssl_parse_client_hello( ssl_context *ssl )
#if defined(POLARSSL_SSL_RENEGOTIATION) #if defined(POLARSSL_SSL_RENEGOTIATION)
if( ssl->renegotiation == SSL_INITIAL_HANDSHAKE ) if( ssl->renegotiation == SSL_INITIAL_HANDSHAKE )
#endif #endif
{
if( ( ret = ssl_fetch_input( ssl, 5 + n ) ) != 0 ) if( ( ret = ssl_fetch_input( ssl, 5 + n ) ) != 0 )
{ {
SSL_DEBUG_RET( 1, "ssl_fetch_input", ret ); SSL_DEBUG_RET( 1, "ssl_fetch_input", ret );
return( ret ); return( ret );
} }
}
buf = ssl->in_msg; buf = ssl->in_msg;
#if defined(POLARSSL_SSL_RENEGOTIATION) #if defined(POLARSSL_SSL_RENEGOTIATION)