aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2015-09-07 14:51:56 +0200
committerSverker Eriksson <[email protected]>2015-09-07 14:51:56 +0200
commitae274fd207a2643a858bbe2dfa254b3936990b6e (patch)
treebe085e03e49e7c3350c0fd3d14ce5e5f713cd1db
parent0b629b6dcbedc1c889843cde784696353db32dba (diff)
parentc73a53164269fd59a205696467622699dca92d83 (diff)
downloadotp-ae274fd207a2643a858bbe2dfa254b3936990b6e.tar.gz
otp-ae274fd207a2643a858bbe2dfa254b3936990b6e.tar.bz2
otp-ae274fd207a2643a858bbe2dfa254b3936990b6e.zip
Merge branch 'sverk/crypto-ec_curves/OTP-12944' into maint
* sverk/crypto-ec_curves/OTP-12944: crypto: Make ec_curves/0 return empty list if not supported
-rw-r--r--lib/crypto/src/crypto_ec_curves.erl12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/crypto/src/crypto_ec_curves.erl b/lib/crypto/src/crypto_ec_curves.erl
index fe17643d96..002b03b80c 100644
--- a/lib/crypto/src/crypto_ec_curves.erl
+++ b/lib/crypto/src/crypto_ec_curves.erl
@@ -4,11 +4,13 @@
curves() ->
CryptoSupport = crypto:supports(),
- HasGF2m = proplists:get_bool(ec_gf2m, proplists:get_value(public_keys, CryptoSupport)),
- prime_curves() ++ characteristic_two_curves(HasGF2m).
+ PubKeys = proplists:get_value(public_keys, CryptoSupport),
+ HasEC = proplists:get_bool(ecdh, PubKeys),
+ HasGF2m = proplists:get_bool(ec_gf2m, PubKeys),
+ prime_curves(HasEC) ++ characteristic_two_curves(HasGF2m).
-prime_curves() ->
+prime_curves(true) ->
[secp112r1,secp112r2,secp128r1,secp128r2,secp160k1,secp160r1,secp160r2,
secp192r1,secp192k1,secp224k1,secp224r1,secp256k1,secp256r1,secp384r1,
secp521r1,prime192v1,prime192v2,prime192v3,prime239v1,prime239v2,prime239v3,
@@ -16,7 +18,9 @@ prime_curves() ->
brainpoolP160r1,brainpoolP160t1,brainpoolP192r1,brainpoolP192t1,
brainpoolP224r1,brainpoolP224t1,brainpoolP256r1,brainpoolP256t1,
brainpoolP320r1,brainpoolP320t1,brainpoolP384r1,brainpoolP384t1,
- brainpoolP512r1,brainpoolP512t1].
+ brainpoolP512r1,brainpoolP512t1];
+prime_curves(_) ->
+ [].
characteristic_two_curves(true) ->
[sect113r1,sect113r2,sect131r1,sect131r2,sect163k1,sect163r1,