Hi, can anyone give me any advice on this?

I've updated our mbed library from 2.16.1 to 3.6.2 which was mostly a very smooth experience, thanks.

The one question in my mind relates to v3 making p_bio private in mbedtls_ssl_context

I used to free it before calling mbedtls_ssl_free - is it ok to skip this now? ie:
//mbedtls_net_free((mbedtls_net_context *) m_ssl.p_bio);
mbedtls_ssl_free(&m_ssl);


I also used to poll it before calling mbedtls_ssl_close_notify - is ok to skip this now? ie:
//if(mbedtls_net_poll((mbedtls_net_context *) m_ssl.p_bio, MBEDTLS_NET_POLL_WRITE, 0) < 0)
//  return;

int ret;
while((ret = mbedtls_ssl_close_notify(&m_ssl)) < 0)
{
  if(ret != MBEDTLS_ERR_SSL_WANT_READ &&
ret != MBEDTLS_ERR_SSL_WANT_WRITE)
    return;
}


It all seems to run just fine like this, but I could really do with some confidence boosting validation of my cavalier commenting. 

Best Regards

Daniel Webb



On Wed, 11 Dec 2024 at 16:44, Daniel Webb <dwebb@cobwebb.com> wrote:
Hi,
Can you give me a little advice on how v3 works?

I've updated our mbed library from 2.16.1 to 3.6.2 which was mostly a very smooth experience, thanks.

The one question in my mind relates to making p_bio private in mbedtls_ssl_context

I used to free it before calling mbedtls_ssl_free - is it ok to skip this now? ie:
//mbedtls_net_free((mbedtls_net_context *) m_ssl.p_bio);
mbedtls_ssl_free(&m_ssl);


I also used to poll it before calling mbedtls_ssl_close_notify - is ok to skip this now? ie:
//if(mbedtls_net_poll((mbedtls_net_context *) m_ssl.p_bio, MBEDTLS_NET_POLL_WRITE, 0) < 0)
//  return;

int ret;
while((ret = mbedtls_ssl_close_notify(&m_ssl)) < 0)
{
  if(ret != MBEDTLS_ERR_SSL_WANT_READ &&
ret != MBEDTLS_ERR_SSL_WANT_WRITE)
    return;
}


It all seems to run just fine like this, but I could really do with some confidence boosting validation of my cavalier commenting. 

Thank you 
Daniel