mbedtlsstm32h7

Mbed TLS Handshake retransmission issue - PC based client and STM32H7 based server


I am working on setting up a USB based secure communication between PC as client and STM32H753 microcontroller running a SSL Server. The network stack used is LwIP and Mbed TLS (TLS v1.2) is used for the secure communication layer. I adapted this using the SSL_Server example available and used the ssl_client1.c available with the MbedTLS for the PC-based app.

I am facing an issue where the Client sends a Hello and the server seems to receive it. But I expect a TCP ACK to be sent back immediately after its reception, which does not happen right away, resulting in the Client trying to retransmit the Client Hello multiple times.

The server runs into the following error in the meantime:

. Last error was: -29312 - SSL - The connection indicated an EOF

But it still sends everything together eventually after some time delay (caused due to the RSA private key operation), but I am afraid if these could break something else in the future. I am using the altcp_write(), altcp_output() functions to write data out.

Are there any hints on what mistake I am making here?

Attaching screenshots of Wireshark traces, PC based loopback test where everything is fine:

PC Loopback test - All is well here

PC to STM32H7 communication which has issues

PC client to STM32H7 server test - Issues


Solution

  • I was able to solve this myself. I was handshaking inside the receive callback on the server side, causing the tcp_output() to never send data on time. I moved it out to a different routine and cleaned up the code to fix it.

    The question can be closed.