Fix ifdef conditions for EC-related extensions.

Was alternatively ECP_C and ECDH_C.
This commit is contained in:
Manuel Pégourié-Gonnard 2013-08-15 19:38:07 +02:00 committed by Paul Bakker
parent 5734b2d358
commit 0b2726732e
3 changed files with 16 additions and 14 deletions

View file

@ -428,7 +428,9 @@ struct _ssl_handshake_params
#if defined(POLARSSL_ECDH_C)
ecdh_context ecdh_ctx; /*!< ECDH key exchange */
#endif
#if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C)
int ec_curve; /*!< Selected elliptic curve */
#endif
/*
* Checksum contexts

View file

@ -199,7 +199,7 @@ static void ssl_write_signature_algorithms_ext( ssl_context *ssl,
*olen = 6 + sig_alg_len;
}
#if defined(POLARSSL_ECDH_C)
#if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C)
static void ssl_write_supported_elliptic_curves_ext( ssl_context *ssl,
unsigned char *buf,
size_t *olen )
@ -273,7 +273,7 @@ static void ssl_write_supported_point_formats_ext( ssl_context *ssl,
*olen = 6;
}
#endif /* POLARSSL_ECDH_C */
#endif /* POLARSSL_ECDH_C || POLARSSL_ECDSA_C */
#if defined(POLARSSL_SSL_MAX_FRAGMENT_LENGTH)
static void ssl_write_max_fragment_length_ext( ssl_context *ssl,
@ -541,7 +541,7 @@ static int ssl_write_client_hello( ssl_context *ssl )
ssl_write_signature_algorithms_ext( ssl, p + 2 + ext_len, &olen );
ext_len += olen;
#if defined(POLARSSL_ECDH_C)
#if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C)
ssl_write_supported_elliptic_curves_ext( ssl, p + 2 + ext_len, &olen );
ext_len += olen;
@ -686,7 +686,7 @@ static int ssl_parse_session_ticket_ext( ssl_context *ssl,
}
#endif /* POLARSSL_SSL_SESSION_TICKETS */
#if defined(POLARSSL_ECP_C)
#if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C)
static int ssl_parse_supported_point_formats_ext( ssl_context *ssl,
const unsigned char *buf,
size_t len )
@ -718,7 +718,7 @@ static int ssl_parse_supported_point_formats_ext( ssl_context *ssl,
return( 0 );
}
#endif /* POLARSSL_ECP_C */
#endif /* POLARSSL_ECDH_C || POLARSSL_ECDSA_C */
static int ssl_parse_server_hello( ssl_context *ssl )
{
@ -975,7 +975,7 @@ static int ssl_parse_server_hello( ssl_context *ssl )
break;
#endif /* POLARSSL_SSL_SESSION_TICKETS */
#if defined(POLARSSL_ECP_C)
#if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C)
case TLS_EXT_SUPPORTED_POINT_FORMATS:
SSL_DEBUG_MSG( 3, ( "found supported_point_formats extension" ) );
@ -986,7 +986,7 @@ static int ssl_parse_server_hello( ssl_context *ssl )
}
break;
#endif /* POLARSSL_ECP_C */
#endif /* POLARSSL_ECDH_C || POLARSSL_ECDSA_C */
default:
SSL_DEBUG_MSG( 3, ( "unknown extension found: %d (ignoring)",

View file

@ -470,7 +470,7 @@ static int ssl_parse_signature_algorithms_ext( ssl_context *ssl,
return( 0 );
}
#if defined(POLARSSL_ECP_C)
#if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C)
static int ssl_parse_supported_elliptic_curves( ssl_context *ssl,
const unsigned char *buf,
size_t len )
@ -563,7 +563,7 @@ static int ssl_parse_supported_point_formats( ssl_context *ssl,
return( 0 );
}
#endif /* POLARSSL_ECP_C */
#endif /* POLARSSL_ECDH_C || POLARSSL_ECDSA_C */
#if defined(POLARSSL_SSL_MAX_FRAGMENT_LENGTH)
static int ssl_parse_max_fragment_length_ext( ssl_context *ssl,
@ -1161,7 +1161,7 @@ static int ssl_parse_client_hello( ssl_context *ssl )
return( ret );
break;
#if defined(POLARSSL_ECP_C)
#if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C)
case TLS_EXT_SUPPORTED_ELLIPTIC_CURVES:
SSL_DEBUG_MSG( 3, ( "found supported elliptic curves extension" ) );
@ -1177,7 +1177,7 @@ static int ssl_parse_client_hello( ssl_context *ssl )
if( ret != 0 )
return( ret );
break;
#endif /* POLARSSL_ECP_C */
#endif /* POLARSSL_ECDH_C || POLARSSL_ECDSA_C */
#if defined(POLARSSL_SSL_MAX_FRAGMENT_LENGTH)
case TLS_EXT_MAX_FRAGMENT_LENGTH:
@ -1424,7 +1424,7 @@ static void ssl_write_max_fragment_length_ext( ssl_context *ssl,
}
#endif /* POLARSSL_SSL_MAX_FRAGMENT_LENGTH */
#if defined(POLARSSL_ECDH_C)
#if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C)
static void ssl_write_supported_point_formats_ext( ssl_context *ssl,
unsigned char *buf,
size_t *olen )
@ -1447,7 +1447,7 @@ static void ssl_write_supported_point_formats_ext( ssl_context *ssl,
*olen = 6;
}
#endif /* POLARSSL_ECDH_C */
#endif /* POLARSSL_ECDH_C || POLARSSL_ECDSA_C */
static int ssl_write_server_hello( ssl_context *ssl )
{
@ -1604,7 +1604,7 @@ static int ssl_write_server_hello( ssl_context *ssl )
ext_len += olen;
#endif
#if defined(POLARSSL_ECDH_C)
#if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C)
ssl_write_supported_point_formats_ext( ssl, p + 2 + ext_len, &olen );
ext_len += olen;
#endif