From 0b2726732ea2e7cc607c86aa869f9d5636c40c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 15 Aug 2013 19:38:07 +0200 Subject: [PATCH] Fix ifdef conditions for EC-related extensions. Was alternatively ECP_C and ECDH_C. --- include/polarssl/ssl.h | 2 ++ library/ssl_cli.c | 14 +++++++------- library/ssl_srv.c | 14 +++++++------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h index 0e3047fea..7a468c46b 100644 --- a/include/polarssl/ssl.h +++ b/include/polarssl/ssl.h @@ -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 diff --git a/library/ssl_cli.c b/library/ssl_cli.c index 16d49f3ad..dcf5f5150 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c @@ -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)", diff --git a/library/ssl_srv.c b/library/ssl_srv.c index 7559bb90d..4bf68ae77 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c @@ -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