1 (edited by faberge 2019-01-12 12:16:50)

Topic: [SOLVED] SSL_write failed

Hi all!

I am new to wolfSSL. I am currently trying to get library working for STM32 and Wifi. I have implemented a random seed function with on chip RNG module (not SPL as it was in wolfSSL, just CMSIS) and also implemented an xtime function with valid epoch time_t (get via Wifi before starting all SSL stuff). So, everything compiles without warnings. But when I try to run a client example, I encounter a problem: the library prints an error message via serial that SSL_write has failed. I check my implementation of functions for wolfssl_SetIOSend & wolfssl_SetIORecv calls and see that first there is one TX package for 122 bytes approx and then one RX package for 5 bytes with 5 bytes received (previous values on that address are all 0's but then are 21, 3, or smth) so data indeed is transmitted.
However right after that the library states that SSL_write call has failed. Any idea what to try next?
Oh, by the way SSL version is TLSv1.2

Share

Re: [SOLVED] SSL_write failed

Hi faberge,

Thanks for your interest in wolfSSL! It sounds like you are 99% of the way there.

The call to read 5 bytes is to get the TLS header, which indicates the total size of the TLS packet. So the next read will be the remainder of the TLS packet. Perhaps you can share a bit more about the code used in your read and write callbacks? You can find our default IO callback functions here: https://github.com/wolfSSL/wolfssl/blob … io.c#L194.

Make sure you are properly handling a non-blocking case, which you would need to return `WOLFSSL_CBIO_ERR_WANT_READ`.

Another common pitfall (depending on your transport layer) is some stacks require getting the entire packet in which case you'd need to cache the remainder of the TLS packet for the read after the 5 byte header.

If you still need help debugging this please provide debug logs, wireshark trace and code snippets for review. If you'd like to keep those private you can email us directly at support@wolfssl.com and reference this forum link.

Thanks,
David Garske, wolfSSL

Share

3 (edited by faberge 2019-02-28 07:22:38)

Re: [SOLVED] SSL_write failed

dgarske wrote:

Another common pitfall (depending on your transport layer) is some stacks require getting the entire packet in which case you'd need to cache the remainder of the TLS packet for the read after the 5 byte header.

Hello dgarske! Thank you for your answer, though I have resolved that issue myself a while ago. A was monitoring this forum for a couple of days while trying various things to make it all work and discovered that the problem was indeed in transport protocol or to be precise, the way I was handling data. I totally forgot to check topic after that. Again, thank you very much.

Share