diff --git a/programs/ssl/dtls_server.c b/programs/ssl/dtls_server.c index f2dcd2f88..ad3a70aa2 100644 --- a/programs/ssl/dtls_server.c +++ b/programs/ssl/dtls_server.c @@ -305,8 +305,15 @@ reset: goto exit; } - mbedtls_ssl_set_bio( &ssl, &client_fd, - mbedtls_net_send, mbedtls_net_recv, mbedtls_net_recv_timeout ); +#if !defined(MBEDTLS_SSL_CONF_RECV) && \ + !defined(MBEDTLS_SSL_CONF_SEND) && \ + !defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) + mbedtls_ssl_set_bio( &ssl, &client_fd, + mbedtls_net_send, mbedtls_net_recv, + mbedtls_net_recv_timeout ); +#else + mbedtls_ssl_set_bio_ctx( &ssl, &client_fd ); +#endif printf( " ok\n" ); diff --git a/programs/ssl/ssl_client1.c b/programs/ssl/ssl_client1.c index 2554946a8..6a4bf5e0a 100644 --- a/programs/ssl/ssl_client1.c +++ b/programs/ssl/ssl_client1.c @@ -196,7 +196,14 @@ int main( void ) goto exit; } - mbedtls_ssl_set_bio( &ssl, &server_fd, mbedtls_net_send, mbedtls_net_recv, NULL ); +#if !defined(MBEDTLS_SSL_CONF_RECV) && \ + !defined(MBEDTLS_SSL_CONF_SEND) && \ + !defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) + mbedtls_ssl_set_bio( &ssl, &server_fd, + mbedtls_net_send, mbedtls_net_recv, NULL ); +#else + mbedtls_ssl_set_bio_ctx( &ssl, &server_fd ); +#endif /* * 4. Handshake diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index f6bdc567d..1beb17cc7 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -2681,8 +2681,14 @@ send_request: goto exit; } +#if !defined(MBEDTLS_SSL_CONF_RECV) && \ + !defined(MBEDTLS_SSL_CONF_SEND) && \ + !defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) mbedtls_ssl_set_bio( &ssl, &io_ctx, send_cb, recv_cb, opt.nbio == 0 ? recv_timeout_cb : NULL ); +#else + mbedtls_ssl_set_bio_ctx( &ssl, &server_fd ); +#endif #if defined(MBEDTLS_TIMING_C) #if !defined(MBEDTLS_SSL_CONF_SET_TIMER) && \ diff --git a/programs/ssl/ssl_fork_server.c b/programs/ssl/ssl_fork_server.c index c716ca9ef..098761cc9 100644 --- a/programs/ssl/ssl_fork_server.c +++ b/programs/ssl/ssl_fork_server.c @@ -300,7 +300,14 @@ int main( void ) goto exit; } - mbedtls_ssl_set_bio( &ssl, &client_fd, mbedtls_net_send, mbedtls_net_recv, NULL ); +#if !defined(MBEDTLS_SSL_CONF_RECV) && \ + !defined(MBEDTLS_SSL_CONF_SEND) && \ + !defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) + mbedtls_ssl_set_bio( &ssl, &client_fd, + mbedtls_net_send, mbedtls_net_recv, NULL ); +#else + mbedtls_ssl_set_bio_ctx( &ssl, &client_fd ); +#endif mbedtls_printf( "pid %d: SSL setup ok\n", pid ); diff --git a/programs/ssl/ssl_mail_client.c b/programs/ssl/ssl_mail_client.c index 11b682cad..3812dd332 100644 --- a/programs/ssl/ssl_mail_client.c +++ b/programs/ssl/ssl_mail_client.c @@ -649,7 +649,14 @@ int main( int argc, char *argv[] ) goto exit; } - mbedtls_ssl_set_bio( &ssl, &server_fd, mbedtls_net_send, mbedtls_net_recv, NULL ); +#if !defined(MBEDTLS_SSL_CONF_RECV) && \ + !defined(MBEDTLS_SSL_CONF_SEND) && \ + !defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) + mbedtls_ssl_set_bio( &ssl, &server_fd, + mbedtls_net_send, mbedtls_net_recv, NULL ); +#else + mbedtls_ssl_set_bio_ctx( &ssl, &server_fd ); +#endif mbedtls_printf( " ok\n" ); diff --git a/programs/ssl/ssl_pthread_server.c b/programs/ssl/ssl_pthread_server.c index 6ce4faaca..fd6ca2613 100644 --- a/programs/ssl/ssl_pthread_server.c +++ b/programs/ssl/ssl_pthread_server.c @@ -149,7 +149,14 @@ static void *handle_ssl_connection( void *data ) goto thread_exit; } - mbedtls_ssl_set_bio( &ssl, client_fd, mbedtls_net_send, mbedtls_net_recv, NULL ); +#if !defined(MBEDTLS_SSL_CONF_RECV) && \ + !defined(MBEDTLS_SSL_CONF_SEND) && \ + !defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) + mbedtls_ssl_set_bio( &ssl, &client_fd, + mbedtls_net_send, mbedtls_net_recv, NULL ); +#else + mbedtls_ssl_set_bio_ctx( &ssl, &client_fd ); +#endif /* * 5. Handshake diff --git a/programs/ssl/ssl_server.c b/programs/ssl/ssl_server.c index 849c14d95..bf502a5a3 100644 --- a/programs/ssl/ssl_server.c +++ b/programs/ssl/ssl_server.c @@ -265,7 +265,14 @@ reset: goto exit; } - mbedtls_ssl_set_bio( &ssl, &client_fd, mbedtls_net_send, mbedtls_net_recv, NULL ); +#if !defined(MBEDTLS_SSL_CONF_RECV) && \ + !defined(MBEDTLS_SSL_CONF_SEND) && \ + !defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) + mbedtls_ssl_set_bio( &ssl, &client_fd, + mbedtls_net_send, mbedtls_net_recv, NULL ); +#else + mbedtls_ssl_set_bio_ctx( &ssl, &client_fd ); +#endif mbedtls_printf( " ok\n" ); diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index 2cd00fa39..cb62b528c 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -3714,12 +3714,19 @@ data_exchange: /* * This illustrates the minimum amount of things you need to set - * up, however you could set up much more if desired, for example - * if you want to share your set up code between the case of - * establishing a new connection and this case. + * up: I/O and timer callbacks/contexts; however you could set up + * much more if desired, for example if you want to share your set + * up code between the case of establishing a new connection and + * this case. */ +#if !defined(MBEDTLS_SSL_CONF_RECV) && \ + !defined(MBEDTLS_SSL_CONF_SEND) && \ + !defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) mbedtls_ssl_set_bio( &ssl, &io_ctx, send_cb, recv_cb, opt.nbio == 0 ? recv_timeout_cb : NULL ); +#else + mbedtls_ssl_set_bio_ctx( &ssl, &client_fd ); +#endif #if defined(MBEDTLS_TIMING_C) #if !defined(MBEDTLS_SSL_CONF_SET_TIMER) && \ diff --git a/programs/x509/cert_app.c b/programs/x509/cert_app.c index 0656ce768..cdd77f273 100644 --- a/programs/x509/cert_app.c +++ b/programs/x509/cert_app.c @@ -441,7 +441,14 @@ int main( int argc, char *argv[] ) goto ssl_exit; } - mbedtls_ssl_set_bio( &ssl, &server_fd, mbedtls_net_send, mbedtls_net_recv, NULL ); +#if !defined(MBEDTLS_SSL_CONF_RECV) && \ + !defined(MBEDTLS_SSL_CONF_SEND) && \ + !defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) + mbedtls_ssl_set_bio( &ssl, &server_fd, + mbedtls_net_send, mbedtls_net_recv, NULL ); +#else + mbedtls_ssl_set_bio_ctx( &ssl, &server_fd ); +#endif /* * 4. Handshake