mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-11 06:25:31 +00:00
Change requirements for setting timer callback
The code wants timer callbacks to be set (checked in fetch_input()), and can't easily check whether we're using nbio, so it seems easier to require the callbacks to be always set rather than only with nbio as was previously done.
This commit is contained in:
parent
138079d7d6
commit
86dfa0cfc9
|
@ -3977,15 +3977,12 @@ int mbedtls_ssl_context_save( mbedtls_ssl_context *ssl,
|
||||||
* (unless they were already set before calling
|
* (unless they were already set before calling
|
||||||
* mbedtls_ssl_session_reset() and the values are suitable for
|
* mbedtls_ssl_session_reset() and the values are suitable for
|
||||||
* the present connection). Specifically, you want to call
|
* the present connection). Specifically, you want to call
|
||||||
* at least mbedtls_ssl_set_bio(). If you're using a read
|
* at least mbedtls_ssl_set_bio() and
|
||||||
* timeout (that is, you called
|
* mbedtls_ssl_set_timer_cb(). All other SSL setter functions
|
||||||
* mbedtls_ssl_conf_read_timeout() with a non-zero timeout)
|
* are not necessary to call, either because they're only used
|
||||||
* and non-blocking I/O, you also need to set timer callbacks
|
* in handshakes, or because the setting is already saved. You
|
||||||
* by calling mbedtls_ssl_set_timer_cb(). All other SSL setter
|
* might choose to call them anyway, for example in order to
|
||||||
* functions are not necessary to call, either because they're
|
* share code between the cases of establishing a new
|
||||||
* only used in handshakes, or because the setting is already
|
|
||||||
* saved. You might choose to call them anyway, for example in
|
|
||||||
* order to share code between the cases of establishing a new
|
|
||||||
* connection and the case of loading an already-established
|
* connection and the case of loading an already-established
|
||||||
* connection.
|
* connection.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2563,17 +2563,14 @@ send_request:
|
||||||
opt.nbio == 0 ? mbedtls_net_recv_timeout : NULL );
|
opt.nbio == 0 ? mbedtls_net_recv_timeout : NULL );
|
||||||
|
|
||||||
#if defined(MBEDTLS_TIMING_C)
|
#if defined(MBEDTLS_TIMING_C)
|
||||||
if( opt.nbio != 0 && opt.read_timeout != 0 )
|
|
||||||
{
|
|
||||||
#if !defined(MBEDTLS_SSL_CONF_SET_TIMER) && \
|
#if !defined(MBEDTLS_SSL_CONF_SET_TIMER) && \
|
||||||
!defined(MBEDTLS_SSL_CONF_GET_TIMER)
|
!defined(MBEDTLS_SSL_CONF_GET_TIMER)
|
||||||
mbedtls_ssl_set_timer_cb( &ssl, &timer,
|
mbedtls_ssl_set_timer_cb( &ssl, &timer,
|
||||||
mbedtls_timing_set_delay,
|
mbedtls_timing_set_delay,
|
||||||
mbedtls_timing_get_delay );
|
mbedtls_timing_get_delay );
|
||||||
#else
|
#else
|
||||||
mbedtls_ssl_set_timer_cb_ctx( &ssl, &timer );
|
mbedtls_ssl_set_timer_cb_ctx( &ssl, &timer );
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#endif /* MBEDTLS_TIMING_C */
|
#endif /* MBEDTLS_TIMING_C */
|
||||||
|
|
||||||
mbedtls_printf( " ok\n" );
|
mbedtls_printf( " ok\n" );
|
||||||
|
|
|
@ -3600,17 +3600,14 @@ data_exchange:
|
||||||
opt.nbio == 0 ? mbedtls_net_recv_timeout : NULL );
|
opt.nbio == 0 ? mbedtls_net_recv_timeout : NULL );
|
||||||
|
|
||||||
#if defined(MBEDTLS_TIMING_C)
|
#if defined(MBEDTLS_TIMING_C)
|
||||||
if( opt.nbio != 0 && opt.read_timeout != 0 )
|
|
||||||
{
|
|
||||||
#if !defined(MBEDTLS_SSL_CONF_SET_TIMER) && \
|
#if !defined(MBEDTLS_SSL_CONF_SET_TIMER) && \
|
||||||
!defined(MBEDTLS_SSL_CONF_GET_TIMER)
|
!defined(MBEDTLS_SSL_CONF_GET_TIMER)
|
||||||
mbedtls_ssl_set_timer_cb( &ssl, &timer,
|
mbedtls_ssl_set_timer_cb( &ssl, &timer,
|
||||||
mbedtls_timing_set_delay,
|
mbedtls_timing_set_delay,
|
||||||
mbedtls_timing_get_delay );
|
mbedtls_timing_get_delay );
|
||||||
#else
|
#else
|
||||||
mbedtls_ssl_set_timer_cb_ctx( &ssl, &timer );
|
mbedtls_ssl_set_timer_cb_ctx( &ssl, &timer );
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#endif /* MBEDTLS_TIMING_C */
|
#endif /* MBEDTLS_TIMING_C */
|
||||||
|
|
||||||
mbedtls_printf( " ok\n" );
|
mbedtls_printf( " ok\n" );
|
||||||
|
|
Loading…
Reference in a new issue