mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 18:35:44 +00:00
Example apps: Don't use runtime IO config API if CBs are hardcoded
Multiple example applications still use mbedtls_ssl_set_bio() even if the I/O callbacks are hardcoded. This commit fixes this.
This commit is contained in:
parent
2a0cd5a031
commit
41e5a6871d
|
@ -305,8 +305,15 @@ reset:
|
|||
goto exit;
|
||||
}
|
||||
|
||||
#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 );
|
||||
mbedtls_net_send, mbedtls_net_recv,
|
||||
mbedtls_net_recv_timeout );
|
||||
#else
|
||||
mbedtls_ssl_set_bio_ctx( &ssl, &client_fd );
|
||||
#endif
|
||||
|
||||
printf( " ok\n" );
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) && \
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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" );
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" );
|
||||
|
||||
|
|
|
@ -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) && \
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue