dgarske wrote:Hi windyMk92,
The attachments are missing. Feel free to email support@wolfssl.com if you cannot post them here.
Is the issue specific to two concurrent threads or just when the STM32F7 is acting as the server? Are you using AES Hardware acceleration? If so have you tried disabling using NO_STM32_CRYPTO?
For multi-threading the common issues are not using mutex protection on the WOLFSSL object between threads. For the WOLFSSL_CTX you should have separate ones. Make sure the server side CTX constructor is using the wolfTLSv1_2_server_method or wolfSSLv23_server_method (to select highest available TLS version and allow downgrade).
We have some excellent TLS examples here: https://github.com/wolfSSL/wolfssl-exam … master/tls
Thanks,
David Garske, wolfSSL
Dear David,
Thank you for your quick response.
Let's me clarify my issue:
+ I'm using 2 concurrent threads H.ttps on port 443 and FTPS on port 990
+ I didn't use AES Hardware acceleration
#define NO_STM32_HASH
#define NO_STM32_CRYPTO
#define WOLFSSL_STM32F7
#define STM32_HAL_V2
#define HAL_CONSOLE_UART huart1
+ I didn't use mutex protection for my threads, so maybe it causes my problem.
+ For the WOLFSSL_CTX, yes it is separated for each thread, and I'm using wolfTLSv1_2_server_method.
void HTTPS_ServerTask(void const * args)
{
SOCKET_T sockfd = 0;
WOLFSSL_METHOD* method = 0;
WOLFSSL_CTX* ctx = 0;
word16 port= 443;
/* Let tcp_listen assign port */
wolfTcp_listen(&sockfd, &port, 1, 0, 0);
method = wolfTLSv1_2_server_method();
ctx = wolfSSL_CTX_new(method);
#ifndef USE_WOLFSSL_IO
wolfSSL_CTX_SetIORecv(ctx, my_EmbedReceive);
wolfSSL_CTX_SetIOSend(ctx, my_EmbedSend);
#endif
...
}
void FTPS_ServerTask(void const * args)
{
SOCKET_T sockfd = 0;
WOLFSSL_METHOD* method = 0;
WOLFSSL_CTX* ctx = 0;
word16 port= 990;
/* Let tcp_listen assign port */
wolfTcp_listen(&sockfd, &port, 1, 0, 0);
method = wolfTLSv1_2_server_method();
ctx = wolfSSL_CTX_new(method);
#ifndef USE_WOLFSSL_IO
wolfSSL_CTX_SetIORecv(ctx, my_EmbedReceive);
wolfSSL_CTX_SetIOSend(ctx, my_EmbedSend);
#endif
...
}
Both threads use the same functions my_EmbedReceive/my_EmbedSend.
I will try add mutex protection for my threads.
Thank you.
Sincerely.