Posts

Inexplicable OpenSSL errors (SSL_Read/SSL_write)

Lately I had experienced strange problem with Openssl library. During usual work on one of my services SSL_read function started to fails randomly. SSL_get_error() always showed SSL_ERROR_SSL error. Further investigation using ERR_get_error() didn't help - sometimes error was related to handshake, sometimes to other reasons, but still I wasn't able to determine exact error. More strangeness brings the fact that handshake error was shown in case when connection was established for a long time and data was successfully transmitted many times. This strange error appears in random order without any explanations. To make deeper investigation I tried to capture traffic on client/server side. It was a big challenge because using of ECDHA ciphers required client/server modification. Finally I caught error and started to looking into traffic and..... i found nothing. Even Wireshark was able to normally decode all data. So my next assumption was incorrect memory read/write access. I