aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/c_src/crypto.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2014-06-17 20:17:40 +0200
committerSverker Eriksson <[email protected]>2014-06-17 20:17:40 +0200
commit70c6e5a1baa326c9809851e00b8849cb6706f812 (patch)
tree7d4fe71a02361f8ef2a659a9f6b1aae3fe08d967 /lib/crypto/c_src/crypto.c
parent07b8f441ca711f9812fad9e9115bab3c3aa92f79 (diff)
downloadotp-70c6e5a1baa326c9809851e00b8849cb6706f812.tar.gz
otp-70c6e5a1baa326c9809851e00b8849cb6706f812.tar.bz2
otp-70c6e5a1baa326c9809851e00b8849cb6706f812.zip
crypto: Fix crypto for debug and valgrind
without relying on opt-version has been built. Removed ASSERT to make crypto_callback.debug.so work without dynamic linking to libcrypto.so.
Diffstat (limited to 'lib/crypto/c_src/crypto.c')
-rw-r--r--lib/crypto/c_src/crypto.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c
index fca08c4eed..828f9a8a2b 100644
--- a/lib/crypto/c_src/crypto.c
+++ b/lib/crypto/c_src/crypto.c
@@ -505,6 +505,15 @@ static int init_ose_crypto() {
#endif
#ifdef HAVE_DYNAMIC_CRYPTO_LIB
+
+# if defined(DEBUG)
+static char crypto_callback_name[] = "crypto_callback.debug";
+# elif defined(VALGRIND)
+static char crypto_callback_name[] = "crypto_callback.valgrind";
+# else
+static char crypto_callback_name[] = "crypto_callback";
+# endif
+
static int change_basename(ErlNifBinary* bin, char* buf, int bufsz, const char* newfile)
{
int i;
@@ -611,7 +620,7 @@ static int init(ErlNifEnv* env, ERL_NIF_TERM load_info)
#ifdef HAVE_DYNAMIC_CRYPTO_LIB
{
void* handle;
- if (!change_basename(&lib_bin, lib_buf, sizeof(lib_buf), "crypto_callback")) {
+ if (!change_basename(&lib_bin, lib_buf, sizeof(lib_buf), crypto_callback_name)) {
return 0;
}
if (!(handle = enif_dlopen(lib_buf, &error_handler, NULL))) {