Skip to content

Commit

Permalink
cleanup: removed deprecated OpenSSL functions from build
Browse files Browse the repository at this point in the history
using #if OPENSSL_VERSION_NUMBER < 0x10000000L because these functions
are deprecated since 1.0.0

in our actual openssl/crypto.h of 1.1.8 these functions are defined like this
and there is no compatible replacement:

    define CRYPTO_num_locks() (1)
    define CRYPTO_set_locking_callback(func)
    define CRYPTO_get_locking_callback() (NULL)
    define CRYPTO_set_add_lock_callback(func)
    define CRYPTO_get_add_lock_callback() (NULL)
  • Loading branch information
franku committed Jul 3, 2018
1 parent e74684d commit afcab6c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion core/src/lib/crypto_openssl.cc
Expand Up @@ -1567,6 +1567,7 @@ void OpensslPostErrors(JobControlRecord *jcr, int code, const char *errstring)
* Returns: thread ID
*
*/
#if OPENSSL_VERSION_NUMBER < 0x10000000L
static unsigned long GetOpensslThreadId(void)
{
#ifdef HAVE_WIN32
Expand All @@ -1579,12 +1580,14 @@ static unsigned long GetOpensslThreadId(void)
* emulation code, which defines pthread_t as a structure.
*/
return ((unsigned long)pthread_self());
#endif
#endif /* not HAVE_WIN32 */
}
#endif /* #if OPENSSL_VERSION_NUMBER < 0x10000000L */

/*
* Allocate a dynamic OpenSSL mutex
*/
#if OPENSSL_VERSION_NUMBER < 0x10000000L
static struct CRYPTO_dynlock_value *openssl_create_dynamic_mutex (const char *file, int line)
{
struct CRYPTO_dynlock_value *dynlock;
Expand Down Expand Up @@ -1620,10 +1623,12 @@ static void OpensslDestroyDynamicMutex(struct CRYPTO_dynlock_value *dynlock, con

free(dynlock);
}
#endif /* OPENSSL_VERSION_NUMBER < 0x10000000L */

/*
* (Un)Lock a static OpenSSL mutex
*/
#if OPENSSL_VERSION_NUMBER < 0x10000000L
static void openssl_update_static_mutex (int mode, int i, const char *file, int line)
{
if (mode & CRYPTO_LOCK) {
Expand All @@ -1632,6 +1637,7 @@ static void openssl_update_static_mutex (int mode, int i, const char *file, int
V(mutexes[i]);
}
}
#endif /* OPENSSL_VERSION_NUMBER < 0x10000000L */

/*
* Initialize OpenSSL thread support
Expand All @@ -1645,7 +1651,9 @@ int OpensslInitThreads (void)


/* Set thread ID callback */
#if OPENSSL_VERSION_NUMBER < 0x10000000L
CRYPTO_set_id_callback(GetOpensslThreadId);
#endif

/* Initialize static locking */
numlocks = CRYPTO_num_locks();
Expand All @@ -1658,13 +1666,15 @@ int OpensslInitThreads (void)
}
}

#if OPENSSL_VERSION_NUMBER < 0x10000000L
/* Set static locking callback */
CRYPTO_set_locking_callback(openssl_update_static_mutex);

/* Initialize dyanmic locking */
CRYPTO_set_dynlock_create_callback(openssl_create_dynamic_mutex);
CRYPTO_set_dynlock_lock_callback(OpensslUpdateDynamicMutex);
CRYPTO_set_dynlock_destroy_callback(OpensslDestroyDynamicMutex);
#endif

return 0;
}
Expand Down

0 comments on commit afcab6c

Please sign in to comment.