MbedTLS Handshake fails sometimes

I’m new in the forum so I want to apologize in advance if I’m missing some rules regarding the correct way to post my issue.
I wrote a code using the MbedTLS library in order to connect with several MQTT brokers. My device is equipped with:
STM32F432 (Arm-Cortex-M4)
Running on Freertos 10.2.1 OS
MbedTLS version is 3.0.0
During the Handshake procedure, the latter fails with the common error:
0x7280 Failed to perform TLS handshake: mbedTLSError= SSL - The connection indicated an EOF :
The problem is that after several attempts (generally 5-6) the handshake procedure works well without changing anything.
This issue happens for both Azure IoT-Hub and CloudMqtt. Due to the intermittent nature of this error, I don’t have many ideas to solve it.
Using a debug level of 5 and I generated two reports when the handshake failed and succeeded.



Looking in detail I notify you that the size given by the server key exchange header is around 469 bytes with respect to the attended 338 bytes.
I can also confirm that the wrong size is always the same every time the handshake protocol fails.

Do you have some idea of why this happens?

Tell me if you need more information.

Many thanks for considering my request.