OpenSSL: Difference between revisions

No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
* The <tt>threads(3ssl)</tt> man page is pretty good.
* The <tt>threads(3ssl)</tt> man page is pretty good.
* Unless you're using OpenSSL 0.9.9, the <tt>CRYPTO_set_id_callback(3ssl)</tt> is pretty much broken on [[pthreads]] implementations which don't return an integer value from <tt>pthread_self(3)</tt>. This is true for the [[FreeBSD APIs|FreeBSD]] native implementations (the [[LinuxThreads]] emulation package should work, but is broken in other, more grave, ways). On OpenSSL 0.9.9, <tt>CRYPTO_set_idptr_callback(3ssl)</tt> can be used for implementations which return a pointer or an aggregate.
* Unless you're using OpenSSL 0.9.9, the <tt>CRYPTO_set_id_callback(3ssl)</tt> is pretty much broken on [[pthreads]] implementations which don't return an integer value from <tt>pthread_self(3)</tt>. This is true for the [[FreeBSD APIs|FreeBSD]] native implementations (the [[LinuxThreads]] emulation package should work, but is broken in other, more grave, ways). On OpenSSL 0.9.9, <tt>CRYPTO_set_idptr_callback(3ssl)</tt> can be used for implementations which return a pointer or an aggregate.
** [[libdank]]'s OpenSSL layer handles this via a <tt>pthread_once_t</tt> which installs a class of thread-specific data. If the thread executing the callback has a NULL value for <tt>pthread_get_specific()</tt>, a <tt>static</tt> key is incremented and copied into the TSD. The increment, and copy of the result, forms a <tt>static</tt> mutex-protected critical section.


==See also==
==See also==
[http://www.mail-archive.com/openssl-users@openssl.org/msg52117.html "Clarification questions on OpenSSL thread-safe support"], openssl-users mailing list 2008-03-10
*[http://www.mail-archive.com/openssl-users@openssl.org/msg52117.html "Clarification questions on OpenSSL thread-safe support"], openssl-users mailing list 2008-03-10
*[http://www.mail-archive.com/openssl-users@openssl.org/msg46161.html "When to use CRYPTO_set_locking_callback() and CRYPTO_set_id_callback()?"], openssl-users mailing list 2006-08-17