aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/c_src/crypto.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-11-28 10:29:43 +0100
committerSverker Eriksson <[email protected]>2012-12-04 18:14:51 +0100
commite2de6663aec09c401d4b13e770a311c50fe69f88 (patch)
tree5fd4ec68b9538a029d87b2ab2aa869c41ad90b12 /lib/crypto/c_src/crypto.c
parent2138eb4db5b879344703e48f2e2e7d692b904ca2 (diff)
downloadotp-e2de6663aec09c401d4b13e770a311c50fe69f88.tar.gz
otp-e2de6663aec09c401d4b13e770a311c50fe69f88.tar.bz2
otp-e2de6663aec09c401d4b13e770a311c50fe69f88.zip
crypto: Let info_lib return header version instead of lib version
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 f789aaada0..72c9e5b8e8 100644
--- a/lib/crypto/c_src/crypto.c
+++ b/lib/crypto/c_src/crypto.c
@@ -536,12 +536,21 @@ static ERL_NIF_TERM info_lib(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]
const char* ver = SSLeay_version(SSLEAY_VERSION);
unsigned ver_sz = strlen(ver);
ERL_NIF_TERM name_term, ver_term;
+ int ver_num = OPENSSL_VERSION_NUMBER;
+ /* R16:
+ * Ignore library version number from SSLeay() and instead show header
+ * version. Otherwise user might try to call a function that is implemented
+ * by a newer library but not supported by the headers used at compile time.
+ * Example: DES_ede3_cfb_encrypt in 0.9.7i but not in 0.9.7d.
+ *
+ * Version string is still from library though.
+ */
memcpy(enif_make_new_binary(env, name_sz, &name_term), libname, name_sz);
memcpy(enif_make_new_binary(env, ver_sz, &ver_term), ver, ver_sz);
return enif_make_list1(env, enif_make_tuple3(env, name_term,
- enif_make_int(env, SSLeay()),
+ enif_make_int(env, ver_num),
ver_term));
}