aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/c_src
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-06-12 10:48:05 +0200
committerSverker Eriksson <[email protected]>2013-06-12 10:48:05 +0200
commit1f8d9f43766fea0e706db8923075ab65a7677daf (patch)
tree91de81d0594c528c17e2e6e1dfaacbb85145017f /lib/crypto/c_src
parent5dd13b1efead2a8101ff1fb46937fbfa00db5269 (diff)
parent6b1147bd90960772257e12ab6fa66ec9aaacc48a (diff)
downloadotp-1f8d9f43766fea0e706db8923075ab65a7677daf.tar.gz
otp-1f8d9f43766fea0e706db8923075ab65a7677daf.tar.bz2
otp-1f8d9f43766fea0e706db8923075ab65a7677daf.zip
Merge branch 'sverk/crypto-upgrade-resource-bug' into maint
* sverk/crypto-upgrade-resource-bug: crypto: Fix bug with takover of EC resource type
Diffstat (limited to 'lib/crypto/c_src')
-rw-r--r--lib/crypto/c_src/crypto.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c
index 00abeb9990..35de3dbf0c 100644
--- a/lib/crypto/c_src/crypto.c
+++ b/lib/crypto/c_src/crypto.c
@@ -590,6 +590,14 @@ static int init(ErlNifEnv* env, ERL_NIF_TERM load_info)
PRINTF_ERR1("CRYPTO: Invalid load_info '%T'", load_info);
return 0;
}
+
+#if defined(HAVE_EC)
+ res_type_ec_key = enif_open_resource_type(env,NULL,"crypto.EC_KEY",
+ ec_key_dtor,
+ ERL_NIF_RT_CREATE|ERL_NIF_RT_TAKEOVER,
+ NULL);
+#endif
+
if (library_refc > 0) {
/* Repeated loading of this library (module upgrade).
* Atoms and callbacks are already set, we are done.
@@ -633,11 +641,6 @@ static int init(ErlNifEnv* env, ERL_NIF_TERM load_info)
for (i = 0; i < EC_CURVES_CNT; i++)
ec_curves[i].atom = enif_make_atom(env,ec_curves[i].name);
-
- res_type_ec_key = enif_open_resource_type(env,NULL,"crypto.EC_KEY",
- ec_key_dtor,
- ERL_NIF_RT_CREATE|ERL_NIF_RT_TAKEOVER,
- NULL);
#endif
init_digest_types(env);