From f941576f751fbf59049d982ca901cd3eab7dfe1f Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 14 May 2013 19:07:51 +0200 Subject: crypto,public_key,ssl: Change return value of crypto:generate_key(ecdh,..) to conform with the return value of the other types. --- lib/crypto/src/crypto.erl | 2 +- lib/crypto/test/crypto_SUITE.erl | 2 +- lib/public_key/src/public_key.erl | 2 +- lib/ssl/test/erl_make_certs.erl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl index 8c61084f3e..4cfa8415b4 100644 --- a/lib/crypto/src/crypto.erl +++ b/lib/crypto/src/crypto.erl @@ -1489,7 +1489,7 @@ ecdh_compute_key_nif(_Others, _My) -> ?nif_stub. ec_key_to_term(Key) -> case ec_key_to_term_nif(Key) of {PrivKey, PubKey} -> - {bin_to_int(PrivKey), PubKey}; + {PubKey, bin_to_int(PrivKey)}; _ -> erlang:error(conversion_failed) end. diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl index 57f5696d3c..1812c98dff 100644 --- a/lib/crypto/test/crypto_SUITE.erl +++ b/lib/crypto/test/crypto_SUITE.erl @@ -1887,7 +1887,7 @@ ec(Config) when is_list(Config) -> ec_do() -> %% test for a name curve - {D2_priv, D2_pub} = crypto:generate_key(ecdh, sect113r2), + {D2_pub, D2_priv} = crypto:generate_key(ecdh, sect113r2), PrivECDH = [D2_priv, sect113r2], PubECDH = [D2_pub, sect113r2], %%TODO: find a published test case for a EC key diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl index 648dba3d5a..56e7844d5d 100644 --- a/lib/public_key/src/public_key.erl +++ b/lib/public_key/src/public_key.erl @@ -878,7 +878,7 @@ ec_curve_spec( #'ECParameters'{fieldID = FieldId, curve = PCurve, base = Base, o ec_curve_spec({namedCurve, OID}) -> pubkey_cert_records:namedCurves(OID). -ec_key({PrivateKey, PubKey}, Params) -> +ec_key({PubKey, PrivateKey}, Params) -> #'ECPrivateKey'{version = 1, privateKey = int2list(PrivateKey), parameters = Params, diff --git a/lib/ssl/test/erl_make_certs.erl b/lib/ssl/test/erl_make_certs.erl index be1253bfb8..be46fd0d46 100644 --- a/lib/ssl/test/erl_make_certs.erl +++ b/lib/ssl/test/erl_make_certs.erl @@ -410,7 +410,7 @@ int2list(I) -> binary_to_list(<>). gen_ec2(CurveId) -> - {PrivKey, PubKey} = crypto:generate_key(ecdh, CurveId), + {PubKey, PrivKey} = crypto:generate_key(ecdh, CurveId), #'ECPrivateKey'{version = 1, privateKey = int2list(PrivKey), -- cgit v1.2.3