Concurrent SSL Clients using OpenSSL

mpulis
Posts: 57
Joined: Mon Aug 07, 2017 7:53 am

Concurrent SSL Clients using OpenSSL

Postby mpulis » Tue Aug 07, 2018 7:10 am

Hi all,

Would it be possible to run multiple SSL Clients concurrently on the ESP32?

I'm asking this because I'm experiencing an error when trying to set up 2 SSL clients using OpenSSL, both of which are trying to connect to the same remote IP and Port but using different local TCP Ports (I've set up one on local Port 443 and another to 400).

The first client to be set up connects without any problems and works perfectly on its own, but the second fails when trying to build a new SSL structure, i.e. the SSL_new() method fails.

Does anyone know if such an operation is possible using the OpenSSL library?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Concurrent SSL Clients using OpenSSL

Postby WiFive » Tue Aug 07, 2018 8:19 am

If you have enough ram

mpulis
Posts: 57
Joined: Mon Aug 07, 2017 7:53 am

Re: Concurrent SSL Clients using OpenSSL

Postby mpulis » Tue Aug 07, 2018 11:48 am

I don't believe that its a memory issue. I've created 2 threads with the same memory allocated to each, with each one responsible of opening and handling a TCP client. At first I was initializing both at the same time, but now I've delayed one of them to open after the other.

The second thread is causing a LoadProhibited error to occur when calling the SSL_new() method, as shown below.

Guru Meditation Error of type LoadProhibited occurred on core 1. Exception was unhandled.
Register dump:
PC : 0x401545d9 PS : 0x00060630 A0 : 0x80116421 A1 : 0x3fffde90
0x401545d9: SSL_set_fd at C:/Users/mpulis/Desktop/Projects/ESP32/msys32/home/esp-idf/components/openssl/library/ssl_lib.c:1385

A2 : 0x00000000 A3 : 0x00000001 A4 : 0x3f40be14 A5 : 0x0000001f
A6 : 0x00000001 A7 : 0x00000005 A8 : 0x8008228c A9 : 0x3fffde30
A10 : 0x00000000 A11 : 0x3fff7800 A12 : 0x3fffde70 A13 : 0x0000000c
A14 : 0x00000000 A15 : 0x00000003 SAR : 0x00000004 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000018 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffe

Backtrace: 0x401545d9:0x3fffde90 0x40116421:0x3fffdeb0
0x401545d9: SSL_set_fd at C:/Users/mpulis/Desktop/Projects/ESP32/msys32/home/esp-idf/components/openssl/library/ssl_lib.c:1385

0x40116421: httpClientAuxiliaryTask at C:/Users/mpulis/Desktop/Projects/ESP32/msys32/home/WiZi/main/http.c:582

mpulis
Posts: 57
Joined: Mon Aug 07, 2017 7:53 am

Re: Concurrent SSL Clients using OpenSSL

Postby mpulis » Tue Aug 07, 2018 12:40 pm

Found the problem, it was a lack of memory issue. Thanks for the support!

Who is online

Users browsing this forum: No registered users and 101 guests