I am using OpenSSL in multi threaded application where I call SSL_read and
SSL_write from two different threads.
I am first establishing DTLS connection over wireless connection to
communicate and to send encrypted messages using OpenSSL.
I am successfully able to send and receive data but wanted to clear the
connection and re-establish the new connection using DTLS. So in other words
do not want the same session reuse.
I am facing Segmentation fault while doing SSL_free and trying to understand
the cause. I am having following questions -
1) OpenSSL manual states that SSL_read and SSL_write should happen from
single thread as the SSL CTX could not be used at the same time. But if the
application takes care of reading and writing synchronously or in safe
manner is it still an issue ?
2) What is the meaning of OpenSSL is multithread safe ? I found various
sample implementations which uses CRYPTO_set_id_callback API to implement
THREAD_setup and cleanup APIs used in DTLS based server implementation. I
believe these APIs prevents the multiple threads to simultaneously access
SSL_ctx at the same time ? But if it is true than why it is not preventing
the SSL_write and SSL_read issue.
3) How to enable debugging option in OpenSSL as I am using gdb but I do not
see any thing except the call stack during Seg Fault.
0xb6e3cc10 in dtls1_get_record() from /usr/lib/libssl.so.1.0.0