diff options
author | Sverker Eriksson <[email protected]> | 2013-04-23 16:51:01 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2013-05-08 10:39:19 +0200 |
commit | 2c1b0c61e2f6177d755e5bee9a865db646b6dca1 (patch) | |
tree | 1733c6d4ac76f1222561dfa056aa7c983489128c /lib/crypto/c_src | |
parent | d9d8d008728b4522c62ed90540b1d90097fddb68 (diff) | |
download | otp-2c1b0c61e2f6177d755e5bee9a865db646b6dca1.tar.gz otp-2c1b0c61e2f6177d755e5bee9a865db646b6dca1.tar.bz2 otp-2c1b0c61e2f6177d755e5bee9a865db646b6dca1.zip |
crypto, public_key: Switch places of ecdh_compute_key arguments
Diffstat (limited to 'lib/crypto/c_src')
-rw-r--r-- | lib/crypto/c_src/crypto.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c index e953eb960f..5781c1de78 100644 --- a/lib/crypto/c_src/crypto.c +++ b/lib/crypto/c_src/crypto.c @@ -3466,21 +3466,14 @@ static ERL_NIF_TERM ecdh_compute_key_nif(ErlNifEnv* env, int argc, const ERL_NIF EC_POINT *my_ecpoint; EC_KEY *other_ecdh = NULL; - if (!enif_get_resource(env, argv[0], res_type_ec_key, (void **)&other_key)) + if (!enif_get_resource(env, argv[1], res_type_ec_key, (void **)&other_key)) return enif_make_badarg(env); group = EC_GROUP_dup(EC_KEY_get0_group(other_key->key)); priv_key = EC_KEY_get0_private_key(other_key->key); - if (!term2point(env, argv[1], group, &my_ecpoint)) { - struct nif_ec_key *my_key; - - if (!enif_get_resource(env, argv[1], res_type_ec_key, (void **)&my_key)) - goto out_err; - - if ((my_ecpoint = EC_POINT_new(group)) == NULL) - goto out_err; - EC_POINT_copy(my_ecpoint, EC_KEY_get0_public_key(my_key->key)); + if (!term2point(env, argv[0], group, &my_ecpoint)) { + goto out_err; } if ((other_ecdh = EC_KEY_new()) == NULL |