aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/src/crypto.erl
diff options
context:
space:
mode:
authorAndreas Schultz <[email protected]>2014-11-16 18:45:53 +0100
committerAndreas Schultz <[email protected]>2014-11-17 10:56:52 +0100
commit08753545c4b08b191234f60efe65f78ed113f0d2 (patch)
tree2594398f7cca3a3c9110249031e7b8a9b2c545bf /lib/crypto/src/crypto.erl
parent30e5a5b28f3f4c5ba69d536aec30d1fae4e1f2fb (diff)
downloadotp-08753545c4b08b191234f60efe65f78ed113f0d2.tar.gz
otp-08753545c4b08b191234f60efe65f78ed113f0d2.tar.bz2
otp-08753545c4b08b191234f60efe65f78ed113f0d2.zip
[crypto] enhance generate_key for ECC keys
enhance generate_key to calculate ECC public keys from private keys
Diffstat (limited to 'lib/crypto/src/crypto.erl')
-rw-r--r--lib/crypto/src/crypto.erl7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index 7f82fa83fd..92da8efba4 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -588,9 +588,8 @@ generate_key(srp, {user, [Generator, Prime, Version]}, PrivateArg)
end,
user_srp_gen_key(Private, Generator, Prime);
-generate_key(ecdh, Curve, undefined) ->
- ec_key_generate(nif_curve_params(Curve)).
-
+generate_key(ecdh, Curve, PrivKey) ->
+ ec_key_generate(nif_curve_params(Curve), ensure_int_as_bin(PrivKey)).
compute_key(dh, OthersPublicKey, MyPrivateKey, DHParameters) ->
case dh_compute_key_nif(ensure_int_as_bin(OthersPublicKey),
@@ -1555,7 +1554,7 @@ dh_compute_key(OthersPublicKey, MyPrivateKey, DHParameters) ->
dh_compute_key_nif(_OthersPublicKey, _MyPrivateKey, _DHParameters) -> ?nif_stub.
-ec_key_generate(_Key) -> ?nif_stub.
+ec_key_generate(_Curve, _Key) -> ?nif_stub.
ecdh_compute_key_nif(_Others, _Curve, _My) -> ?nif_stub.