mbedtls handshake return -0x10

formus14
Posts: 8
Joined: Wed Nov 15, 2017 3:22 pm

mbedtls handshake return -0x10

Postby formus14 » Sun Jul 08, 2018 10:01 pm

Hi,

I'm working on an example where I am using Bluetooth Client and LWS functionalities in parallel.

Strange enough, the mbedtls return -0x10 on the handshake if the Bluetooth is activated but works fine if the Bluetooth was deactivated!

Screenshot here showing the error and the free memory space on the internal and external RAM :
https://ibb.co/mbznro

I checked the error code of the mbedtls but couldn't find what type of error corresponds to -0x10 ..
https://tls.mbed.org/api/ssl_8h.html#a7 ... 66c8602177

Using IDF 3
https://github.com/espressif/esp-idf/tr ... cf1181458f

Any help ?

I appreciate the help ))

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: mbedtls handshake return -0x10

Postby ESP_Angus » Mon Jul 09, 2018 12:53 am

Hi formus,

mbedTLS error -0x10 is MBEDTLS_ERR_MPI_ALLOC_FAILED ("memory allocation failed"). Probably there is enough free heap memory only when Bluetooth is disabled.

Depending on which Bluetooth modes you are using (BLE or Bluetooth Classic), you can release some of the Bluetooth controller memory at runtime. See here:
https://docs.espressif.com/projects/esp ... _bt_mode_t

(The documentation link is to the master branch but this function is available in V3.0 and works the same.)

If releasing BT controller memory isn't enough, you may need to look at other ways to reduce overall memory usage in your app.

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: mbedtls handshake return -0x10

Postby Ritesh » Tue Jun 20, 2023 4:28 am

ESP_Angus wrote:
Mon Jul 09, 2018 12:53 am
Hi formus,

mbedTLS error -0x10 is MBEDTLS_ERR_MPI_ALLOC_FAILED ("memory allocation failed"). Probably there is enough free heap memory only when Bluetooth is disabled.

Depending on which Bluetooth modes you are using (BLE or Bluetooth Classic), you can release some of the Bluetooth controller memory at runtime. See here:
https://docs.espressif.com/projects/esp ... _bt_mode_t

(The documentation link is to the master branch but this function is available in V3.0 and works the same.)

If releasing BT controller memory isn't enough, you may need to look at other ways to reduce overall memory usage in your app.
Hello ESP_Angus,

We are exactly facing same issue while using BLE mode as per our application requirement and in parallel we are using secure connection for Firmware Update.

So, We will check below setting and will let you know if it would be helpful for us or not.
If the app calls esp_bt_controller_enable(ESP_BT_MODE_BLE) to use BLE only then it is safe to call esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT) at initialization time to free unused BT Classic memory.
Note - We are using ESP32 IDF 3.2 version as of now for our already developed product.
Regards,
Ritesh Prajapati

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: mbedtls handshake return -0x10

Postby Ritesh » Wed Jun 21, 2023 5:45 am

Hello ESP_Angus and Team,

We have done some more debugging into it and found that if we disable Bluetooth Controller then we able to update firmware into secure way without any issue.

Then we have also checked both internal and external memory and found that internal memory goes beyond limit like 5KBytes due to which mbedTLS component is not able to read certificates as per requirements.

So, There is workaround to disable BLE component and controller when Secure Firmware Update is ongoing.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: Baidu [Spider] and 185 guests