Check out my first novel, midnight's simulacra!

OpenSSL

From dankwiki
Revision as of 03:29, 16 August 2009 by Dank (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Threads

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

See also