The code you've shown so far only consists of setup functions that
populate fields in the configuration structure, then in the context
structure. Communication has not started yet. mbedtls_ssl_set_bio in
particular is a very simple setter function.
Where does the code actually hang? Have some messages already been
exchanged on the network at that point? Can you get a stack trace?
--
Gilles Peskine
Mbed TLS developer
On 08/06/2021 02:30, Ron Eggler via mbed-tls wrote:
>
> On 2021-06-07 5:00 p.m., Ron Eggler via mbed-tls wrote:
>> Hi,
>>
>>
>> i'm in the process of wrioting an FTPS client for a system running on
>> uCOS.
>>
>> I've been able to setup the control channel fine and working on
>> setting up the data channel for a simple list command execution.
>>
>> It seems like I seem able to setup everything fine but the call to
>> mbedtls_ssl_set_bio() hangs even though I set it to execute the
>> timeout function like:
>>
>> mbedtls_ssl_set_bio( &ssl_d,
>> &data_fd,
>> mbedtls_tls_send,
>> NULL,
>> mbedtls_tls_recv_timeout);
>>
>> Where the mbed_tls_recv_timeout looks like:
>>
>>
https://pastebin.com/Jw3iLc0x
>>
>> The current connection uses ipv4, i.e. the select () branch is
>> active. I never see the timed out message. Any idea what may be going
>> on here?
>>
>> Thank you,
>>
>> Ron
>>
> A bit more detail: as for what comes before the mbedtls_ssl_set_bio()
> call:
>
> ret = mbedtls_ssl_config_defaults(&conf_d,
> MBEDTLS_SSL_IS_CLIENT,
> MBEDTLS_SSL_TRANSPORT_STREAM,
> MBEDTLS_SSL_PRESET_DEFAULT);
>
> mbedtls_ssl_conf_authmode( &conf_d, MBEDTLS_SSL_VERIFY_OPTIONAL);
> mbedtls_ssl_conf_ca_chain( &conf_d, &cacert_d, NULL );
> mbedtls_ssl_conf_rng(&conf_d, mbedtls_ctr_drbg_random, &ctr_drbg_d );
> mbedtls_ssl_conf_dbg(&conf_d, mydebug, stdout);
> ret = mbedtls_ssl_conf_own_cert( &conf_d, &clicert_d, &pkey_d);
>
> ret = mbedtls_ssl_setup( &ssl_d, &conf_d );
>
> mbedtls_ssl_set_bio( &ssl_d,
> &data_fd,
> mbedtls_tls_send,
> NULL,
> mbedtls_tls_recv_timeout);
>