Balanced braces across preprocessor conditionals
This is a cosmetic improvement to ease source code navigation only.
diff --git a/library/ssl_cli.c b/library/ssl_cli.c
index 223823b..24fc3fd 100644
--- a/library/ssl_cli.c
+++ b/library/ssl_cli.c
@@ -264,11 +264,12 @@
#if defined(MBEDTLS_ECP_C)
for( grp_id = ssl->conf->curve_list; *grp_id != MBEDTLS_ECP_DP_NONE; grp_id++ )
- {
- info = mbedtls_ecp_curve_info_from_grp_id( *grp_id );
#else
for( info = mbedtls_ecp_curve_list(); info->grp_id != MBEDTLS_ECP_DP_NONE; info++ )
+#endif
{
+#if defined(MBEDTLS_ECP_C)
+ info = mbedtls_ecp_curve_info_from_grp_id( *grp_id );
#endif
if( info == NULL )
{
@@ -289,11 +290,12 @@
#if defined(MBEDTLS_ECP_C)
for( grp_id = ssl->conf->curve_list; *grp_id != MBEDTLS_ECP_DP_NONE; grp_id++ )
- {
- info = mbedtls_ecp_curve_info_from_grp_id( *grp_id );
#else
for( info = mbedtls_ecp_curve_list(); info->grp_id != MBEDTLS_ECP_DP_NONE; info++ )
+#endif
{
+#if defined(MBEDTLS_ECP_C)
+ info = mbedtls_ecp_curve_info_from_grp_id( *grp_id );
#endif
elliptic_curve_list[elliptic_curve_len++] = info->tls_id >> 8;
elliptic_curve_list[elliptic_curve_len++] = info->tls_id & 0xFF;
diff --git a/library/ssl_srv.c b/library/ssl_srv.c
index fc0d2d7..c9051a4 100644
--- a/library/ssl_srv.c
+++ b/library/ssl_srv.c
@@ -1002,11 +1002,9 @@
ciphersuite_info = NULL;
#if defined(MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE)
for( j = 0, p = buf + 6; j < ciph_len; j += 3, p += 3 )
- {
for( i = 0; ciphersuites[i] != 0; i++ )
#else
for( i = 0; ciphersuites[i] != 0; i++ )
- {
for( j = 0, p = buf + 6; j < ciph_len; j += 3, p += 3 )
#endif
{
@@ -1024,7 +1022,6 @@
if( ciphersuite_info != NULL )
goto have_ciphersuite_v2;
}
- }
if( got_common_suite )
{
@@ -1113,7 +1110,7 @@
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_STREAM )
#endif
if( ( buf[0] & 0x80 ) != 0 )
- return ssl_parse_client_hello_v2( ssl );
+ return( ssl_parse_client_hello_v2( ssl ) );
#endif
MBEDTLS_SSL_DEBUG_BUF( 4, "record header", buf, mbedtls_ssl_hdr_len( ssl ) );
@@ -1797,11 +1794,9 @@
ciphersuite_info = NULL;
#if defined(MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE)
for( j = 0, p = buf + ciph_offset + 2; j < ciph_len; j += 2, p += 2 )
- {
for( i = 0; ciphersuites[i] != 0; i++ )
#else
for( i = 0; ciphersuites[i] != 0; i++ )
- {
for( j = 0, p = buf + ciph_offset + 2; j < ciph_len; j += 2, p += 2 )
#endif
{
@@ -1818,7 +1813,6 @@
if( ciphersuite_info != NULL )
goto have_ciphersuite;
}
- }
if( got_common_suite )
{
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index d9ab832..fb68a1c 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -4057,6 +4057,7 @@
!defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) && \
!defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \
!defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
+/* No certificate support -> dummy functions */
int mbedtls_ssl_write_certificate( mbedtls_ssl_context *ssl )
{
const mbedtls_ssl_ciphersuite_t *ciphersuite_info = ssl->transform_negotiate->ciphersuite_info;
@@ -4096,7 +4097,10 @@
MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) );
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
+
#else
+/* Some certificate support -> implement write and parse */
+
int mbedtls_ssl_write_certificate( mbedtls_ssl_context *ssl )
{
int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE;