Please define CRYPTO_set_idptr_callback() so that the idptr_function is
able to return failure.  This is necessary when the package which calls
CRYPTO_set_idptr_callback() uses third-party modules which can create
their own threads.  Then the idptr_function itself needs to allocate a
unique ID and set it with pthread_setspecific(), both of which can fail.

Simplest way without changing the prototype would be to let NULL mean
failure.  Though that messes up for a thread package where a thread ID
already is a pointer which can be NULL (maybe for the main thread).

On the other hand using '==' instead of pthread_equal() may in theory
fail anyway (even if pthread_t is an integer), so maybe malloc is safer
anyway.  For the same reason, the only actually POSIX-conforming
interface would be to also allow a configurable thread_equal() function
which would take the passed thread IDs for argument.


doc/crypto/threads.pod is wrong: It claims that the id(ptr)_callback
functions should return a thread ID.  Presumably they actually only
need to return _some_ value which is unique per thread.

Please also explain something about what these IDs are used for.  What
happens if the ID functions being used (maybe the defaults) are bad?  If
two threads get the same ID?  If the same thread gets different IDs at
different times?   What if the process fork()s, is it OK to keep the
same thread ID(s)?  To _not_ keep them?

-- 
Regards,
Hallvard

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

Reply via email to