On Friday 12 June 2009 02:12:06 Kyle Hamilton wrote:
> This looks like you're trying to use a library compiled for
> multithreading without providing it the address of a lock or unlock
> function.
>
> This is, incidentally, programmer FAQ #1, readable at
> http://openssl.org/support/faq.html#PROG1 .
>
> -Kyle H

AFAICS from the source, it is passing it a lcok/unlock function. The code 
calling CRYPTO_set_locking_callback () looks like this. 

#ifdef USE_PTHREADS
  /* Set up mutexes for the OpenSSL library */
  if (openssl_mutex == NULL)
    {
      pthread_mutexattr_t attr;
      int n;

      openssl_mutex = malloc (sizeof (pthread_mutex_t) * CRYPTO_num_locks ());
      if (openssl_mutex == NULL)
        return 0;
      pthread_mutexattr_init (&attr);
      for (n = 0; n < CRYPTO_num_locks (); n++)
        pthread_mutex_init (&openssl_mutex[n], &attr);
      pthread_mutexattr_destroy (&attr);
      CRYPTO_set_locking_callback (openssl_mutexcb);
    }
#endif

checking that #ifdef, I find 

/* Build with support for Posix threading */
#define USE_PTHREADS 1

in a header called config.h, which is included by the relevant source file.

openssl_mutexcb () is defined as

static void
openssl_mutexcb (int mode, int n,
                 const char *file __attribute__ ((unused)),
                 int line __attribute__ ((unused)))
{
  if (mode & CRYPTO_LOCK)
    pthread_mutex_lock (&openssl_mutex[n]);
  else
    pthread_mutex_unlock (&openssl_mutex[n]);
}
#endif

At first glance that looks OK to me, but it's all third party code.

Neil Youngman
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to