Hi,

I have a question about the use of openssl, EVP_CIPHER_CTXs, in a
multithreaded environment.
I have N threads calling a function that contains an EVP_CIPHER_CTX,
ctx_init, EVP_CipherUpdate/Final and then Cleanup.
The CTX is only used by that same thread calling the function.

Must all N threads call CRYPTO_set_locking_callback before use? 
If so, can/should the callback function point to the same lock/mutexes for
all threads or should they have their own lock per thread?


When I'm not calling set_locking_callback at all I get of course coredumps;
#0  0x402a6ba1 in kill () from /lib/libc.so.6
#1  0x4002381d in pthread_kill () from /lib/libpthread.so.0
#2  0x40023b9b in raise () from /lib/libpthread.so.0
#3  0x402a80ec in abort () from /lib/libc.so.6
#4  0x403ddf0c in OpenSSLDie () from /usr/lib/libcrypto.so.0.9.7
#5  0x00000100 in ?? ()
#6  0x404a0f94 in __JCR_LIST__ () from /usr/lib/libcrypto.so.0.9.7
#7  0x40432639 in EVP_EncryptUpdate () from /usr/lib/libcrypto.so.0.9.7

When I only called set_locking_callback from the main thread I saw that the
locking function was never called, probably because it is the other threads
that are working with the EVP and not the main thread?

I am using win32, win64 and linux.

Cheers,

J

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to