Topic: HTTPS client on SMT32F437
for my embedded application running ChibiOS with LWIP I'm trying to add a HTTPS client. I've managed to build and run a test client connecting to api.telegram.org. However facing some issues I'm not able to solve for now.
First, for my target I use WOLFSSL_STM32F4 and I imported STM32 HAL Crypto libraries to support HW encryption. With ChibiOS included WolfSSL 126.96.36.199 I did not succeed to compile and link. But moving to newest WolfSSL helped. But somehow I'm unable to pass wolfSSL_connect() without errors like:
... sent: client key exchange connect state: FIRST_REPLY_SECOND connect state: FIRST_REPLY_THIRD growing output buffer Shrinking output buffer sent: change cipher spec connect state: FIRST_REPLY_FOURTH wolfSSL Entering SendFinished growing output buffer wolfSSL Entering BuildMessage wolfSSL Leaving BuildMessage, return -180 wolfSSL error occurred, error = -320
However by defining NO_STM32_CRYPTO this error is gone. I wonder what I might do wrong as I tried to verify the AES HW by running the STM32 test program.
Second, If I keep the SW Crypto on I see very slow "SendClientKeyExchange" section. It actually takes around 12-14 seconds in wc_DhSetCheckKey() doing some magic with prime numbers like fast_mp_montgomery_reduce().
I tried to add USE_FAST_MATH, but that actually add extra 4-5 seconds. Or WOLFSSL_SP which seems negligible.
I wonder if there is any way to speed this part up, or maybe prepare the DH key only once on startup.
Thanks in advance,