Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Commit

Permalink
[#114] update for older openssl compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFrench committed Jan 15, 2019
1 parent c659caa commit c4abfa7
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions evhtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2826,16 +2826,35 @@ htp__accept_cb_(struct evconnlistener * serv, int fd, struct sockaddr * s, int s

#ifndef EVHTP_DISABLE_SSL
#ifndef EVHTP_DISABLE_EVTHR
static void
htp__ssl_get_thread_id_(CRYPTO_THREADID *id)
static
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
void
#else
unsigned long
#endif
htp__ssl_get_thread_id_(
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
CRYPTO_THREADID * id
#else
void
#endif
)
{
#ifndef WIN32
unsigned long tid;

#ifndef WIN32
tid = (unsigned long)pthread_self();
CRYPTO_THREADID_set_numeric(id, (unsigned long)pthread_self());
#else

tid = pthread_self().p;
CRYPTO_THREADID_set_numeric(id, (unsigned long)(pthread_self().p));
#endif

#if OPENSSL_VERSION_NUMBER >= 0x10000000L
CRYPTO_THREADID_set_numeric(id, tid);
#else
return tid;
#endif
}

static void
Expand Down Expand Up @@ -4694,8 +4713,12 @@ evhtp_ssl_use_threads(void)
pthread_mutex_init(&(ssl_locks[i]), NULL);
}

CRYPTO_THREADID_set_callback(htp__ssl_get_thread_id_);
#if OPENSSL_VERSION_NUMBER < 0x10000000L
CRYPTO_set_id_callback(htp__ssl_get_thread_id_);
CRYPTO_set_locking_callback(htp__ssl_thread_lock_);
#else
CRYPTO_THREADID_set_callback(htp__ssl_get_thread_id_);
#endif

return 0;
}
Expand Down

0 comments on commit c4abfa7

Please sign in to comment.