Fix compile bugs in examples with hardcoded I/O callbacks

These were found by `all.sh test_baremetal`, so no need for a new test.
This commit is contained in:
Manuel Pégourié-Gonnard 2019-07-30 17:07:38 +02:00
parent f1358acdc7
commit 2b29a37c91
2 changed files with 14 additions and 6 deletions

View File

@ -524,9 +524,6 @@ static int delayed_send( void *ctx, const unsigned char *buf, size_t len )
first_try = 1; /* Next call will be a new operation */
return( ret );
}
#endif /* MBEDTLS_SSL_CONF_RECV &&
MBEDTLS_SSL_CONF_SEND &&
MBEDTLS_SSL_CONF_RECV_TIMEOUT */
typedef struct
{
@ -658,6 +655,9 @@ static int send_cb( void *ctx, unsigned char const *buf, size_t len )
return( mbedtls_net_send( io_ctx->net, buf, len ) );
}
#endif /* !MBEDTLS_SSL_CONF_RECV &&
!MBEDTLS_SSL_CONF_SEND &&
!MBEDTLS_SSL_CONF_RECV_TIMEOUT */
#if defined(MBEDTLS_X509_CRT_PARSE_C)
static unsigned char peer_crt_info[1024];
@ -893,7 +893,11 @@ int main( int argc, char *argv[] )
{
int ret = 0, len, tail_len, i, written, frags, retry_left;
mbedtls_net_context server_fd;
#if !defined(MBEDTLS_SSL_CONF_RECV) && \
!defined(MBEDTLS_SSL_CONF_SEND) && \
!defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT)
io_ctx_t io_ctx;
#endif
unsigned char buf[MAX_REQUEST_SIZE + 1];

View File

@ -654,9 +654,6 @@ static int delayed_send( void *ctx, const unsigned char *buf, size_t len )
first_try = 1; /* Next call will be a new operation */
return( ret );
}
#endif /* MBEDTLS_SSL_CONF_RECV &&
MBEDTLS_SSL_CONF_SEND &&
MBEDTLS_SSL_CONF_RECV_TIMEOUT */
typedef struct
{
@ -790,6 +787,9 @@ static int send_cb( void *ctx, unsigned char const *buf, size_t len )
return( mbedtls_net_send( io_ctx->net, buf, len ) );
}
#endif /* !MBEDTLS_SSL_CONF_RECV &&
!MBEDTLS_SSL_CONF_SEND &&
!MBEDTLS_SSL_CONF_RECV_TIMEOUT */
#if defined(SNI_OPTION) || !defined(MBEDTLS_SSL_CONF_AUTHMODE)
/*
@ -1509,7 +1509,11 @@ int main( int argc, char *argv[] )
{
int ret = 0, len, written, frags, exchanges_left;
int version_suites[4][2];
#if !defined(MBEDTLS_SSL_CONF_RECV) && \
!defined(MBEDTLS_SSL_CONF_SEND) && \
!defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT)
io_ctx_t io_ctx;
#endif
unsigned char* buf = 0;
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
unsigned char psk[MBEDTLS_PSK_MAX_LEN];