Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile when few options are set #292

Open
wants to merge 14 commits into
base: tls13-prototype
Choose a base branch
from
15 changes: 9 additions & 6 deletions library/ssl_tls13_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,12 @@ static int ssl_write_early_data_postprocess( mbedtls_ssl_context* ssl );
int ssl_write_early_data_process( mbedtls_ssl_context* ssl )
{
int ret;
#if defined(MBEDTLS_SSL_USE_MPS)
#if defined(MBEDTLS_SSL_USE_MPS) & defined(MBEDTLS_ZERO_RTT)
mbedtls_writer *msg;
unsigned char *buf;
mbedtls_mps_size_t buf_len, msg_len;
#endif /* MBEDTLS_SSL_USE_MPS */
#endif /* MBEDTLS_SSL_USE_MPS & MBEDTLS_ZERO_RTT */

MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write early data" ) );

MBEDTLS_SSL_PROC_CHK_NEG( ssl_write_early_data_coordinate( ssl ) );
Expand Down Expand Up @@ -176,10 +177,7 @@ int ssl_write_early_data_process( mbedtls_ssl_context* ssl )
#endif /* MBEDTLS_SSL_USE_MPS */

#else /* MBEDTLS_ZERO_RTT */
((void) buf);
((void) buf_len);
((void) msg);
((void) msg_len);

/* Should never happen */
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );

Expand Down Expand Up @@ -2725,6 +2723,11 @@ static int ssl_encrypted_extensions_parse( mbedtls_ssl_context* ssl,
size_t ext_len;
const unsigned char *ext;

#if !( defined(MBEDTLS_SSL_ALPN) || defined(MBEDTLS_ZERO_RTT) || \
defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) )
((void) ssl);
#endif /* ! (MBEDTLS_SSL_ALPN || MBEDTLS_ZERO_RTT || MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) */

if( buflen < 2 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "EncryptedExtension message too short" ) );
Expand Down
14 changes: 12 additions & 2 deletions library/ssl_tls13_keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,19 +871,24 @@ int mbedtls_ssl_tls1_3_generate_resumption_master_secret(
int ret = 0;

mbedtls_md_type_t md_type;

#if defined(MBEDTLS_DEBUG_C)
mbedtls_md_info_t const *md_info;
size_t md_size;

#endif /* MBEDTLS_DEBUG_C */

unsigned char transcript[MBEDTLS_MD_MAX_SIZE];
size_t transcript_len;

MBEDTLS_SSL_DEBUG_MSG( 2,
( "=> mbedtls_ssl_tls1_3_generate_resumption_master_secret" ) );

md_type = ssl->handshake->ciphersuite_info->mac;
#if defined(MBEDTLS_DEBUG_C)
md_info = mbedtls_md_info_from_type( md_type );
md_size = mbedtls_md_get_size( md_info );

#endif /* MBEDTLS_DEBUG_C */

ret = mbedtls_ssl_get_handshake_transcript( ssl, md_type,
transcript, sizeof( transcript ),
&transcript_len );
Expand Down Expand Up @@ -1153,6 +1158,11 @@ int mbedtls_ssl_tls1_3_create_psk_binder( mbedtls_ssl_context *ssl,
mbedtls_md_info_t const *md_info = mbedtls_md_info_from_type( md_type );
size_t const md_size = mbedtls_md_get_size( md_info );

#if !defined(MBEDTLS_DEBUG_C)
hannestschofenig marked this conversation as resolved.
Show resolved Hide resolved
ssl = NULL;
((void) ssl);
hanno-becker marked this conversation as resolved.
Show resolved Hide resolved
#endif /* MBEDTLS_DEBUG_C */

ret = mbedtls_ssl_tls1_3_evolve_secret( md_type,
NULL, /* Old secret */
psk, psk_len, /* Input */
Expand Down
7 changes: 7 additions & 0 deletions library/ssl_tls13_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2267,6 +2267,12 @@ static int ssl_client_hello_fetch( mbedtls_ssl_context* ssl,

#endif /* MBEDTLS_SSL_USE_MPS */

#if !defined(MBEDTLS_DEBUG_C)
static void ssl_debug_print_client_hello_exts( mbedtls_ssl_context *ssl )
{
((void) ssl);
}
#else
static void ssl_debug_print_client_hello_exts( mbedtls_ssl_context *ssl )
{
MBEDTLS_SSL_DEBUG_MSG( 3, ( "Supported Extensions:" ) );
Expand Down Expand Up @@ -2314,6 +2320,7 @@ static void ssl_debug_print_client_hello_exts( mbedtls_ssl_context *ssl )
"TRUE" : "FALSE" ) );
#endif /* MBEDTLS_ZERO_RTT*/
}
#endif /* !MBEDTLS_DEBUG_C */

static int ssl_client_hello_has_psk_extensions( mbedtls_ssl_context *ssl )
{
Expand Down