PolarSSL is now part of ARM Official announcement and rebranded as mbed TLS.

difference mbedtls_ssl_read and mbedtls_net_read


Sep 7, 2017 15:35
Yum

What is the difference between these two functions? mbedtls_ssl_read & mbedtls_net_read

Also, is it possible to read the incoming buffer in two reads - just like normal recv(). For example, server sent 100 bytes, is it possible to to call mbedtls_ssl_read with 10 bytes buffer first and then read 90 bytes in second read?

Thanks

 
Sep 7, 2017 15:36
Yum

I meant mbedtls_net_recv

 
Sep 7, 2017 16:20
Ron Eldor

Hi Yum,
mbedtls_net_recv is the bio callback example for reading from the network interface. It is meand to read len bytes from the socket.
mbedtls_ssl_read is in the TLS layer, and is part of the API, and it reads len bytes of Application data. It includes parsing the record header, and decrypting the data, if needed. as part of its operation, the bio callback for f_recv is called, which in the examples is mbedtls_net_recv.
I hope this explanation was clear enough
Regards,
Mbed TLS Team member
Ron

 
Sep 7, 2017 17:09
Yum

Thanks.

Also, is it possible to read the incoming buffer in two reads - just like normal recv(). For example, server sent 100 bytes, is it possible to to call mbedtls_ssl_read with 10 bytes buffer first and then read 90 bytes in second read?

Thanks