aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/src/crypto_ec_curves.erl
diff options
context:
space:
mode:
authorAndreas Schultz <[email protected]>2013-12-30 11:54:23 +0100
committerAndreas Schultz <[email protected]>2014-01-13 13:00:24 +0100
commit8837c1be2ba8a3c123df3f5a87003daa9aac6539 (patch)
tree9b18eed937e5e58e4afd7886fd3b3fd41e4341e0 /lib/crypto/src/crypto_ec_curves.erl
parentd06e7d12d3e8d77348e0c7e93a44b060e07f7075 (diff)
downloadotp-8837c1be2ba8a3c123df3f5a87003daa9aac6539.tar.gz
otp-8837c1be2ba8a3c123df3f5a87003daa9aac6539.tar.bz2
otp-8837c1be2ba8a3c123df3f5a87003daa9aac6539.zip
crypto: selective support for GF2m curves
Newer OpenSSL versions allow to selectively disable GF2m elliptic curves. Selectively enable GF2m curves is support for them is available.
Diffstat (limited to 'lib/crypto/src/crypto_ec_curves.erl')
-rw-r--r--lib/crypto/src/crypto_ec_curves.erl23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/crypto/src/crypto_ec_curves.erl b/lib/crypto/src/crypto_ec_curves.erl
index 8bd1f21edd..fe17643d96 100644
--- a/lib/crypto/src/crypto_ec_curves.erl
+++ b/lib/crypto/src/crypto_ec_curves.erl
@@ -3,19 +3,30 @@
-export([curve/1, curves/0]).
curves() ->
+ CryptoSupport = crypto:supports(),
+ HasGF2m = proplists:get_bool(ec_gf2m, proplists:get_value(public_keys, CryptoSupport)),
+ prime_curves() ++ characteristic_two_curves(HasGF2m).
+
+
+prime_curves() ->
[secp112r1,secp112r2,secp128r1,secp128r2,secp160k1,secp160r1,secp160r2,
secp192r1,secp192k1,secp224k1,secp224r1,secp256k1,secp256r1,secp384r1,
secp521r1,prime192v1,prime192v2,prime192v3,prime239v1,prime239v2,prime239v3,
- prime256v1,sect113r1,sect113r2,sect131r1,sect131r2,sect163k1,sect163r1,
+ prime256v1,wtls6,wtls7,wtls8,wtls9,wtls12,
+ brainpoolP160r1,brainpoolP160t1,brainpoolP192r1,brainpoolP192t1,
+ brainpoolP224r1,brainpoolP224t1,brainpoolP256r1,brainpoolP256t1,
+ brainpoolP320r1,brainpoolP320t1,brainpoolP384r1,brainpoolP384t1,
+ brainpoolP512r1,brainpoolP512t1].
+
+characteristic_two_curves(true) ->
+ [sect113r1,sect113r2,sect131r1,sect131r2,sect163k1,sect163r1,
sect163r2,sect193r1,sect193r2,sect233k1,sect233r1,sect239k1,sect283k1,
sect283r1,sect409k1,sect409r1,sect571k1,sect571r1,c2pnb163v1,c2pnb163v2,
c2pnb163v3,c2pnb176v1,c2tnb191v1,c2tnb191v2,c2tnb191v3,c2pnb208w1,c2tnb239v1,
c2tnb239v2,c2tnb239v3,c2pnb272w1,c2pnb304w1,c2tnb359v1,c2pnb368w1,c2tnb431r1,
- wtls1,wtls3,wtls4,wtls5,wtls6,wtls7,wtls8,wtls9,wtls10,wtls11,wtls12,ipsec3,
- ipsec4,brainpoolP160r1,brainpoolP160t1,brainpoolP192r1,brainpoolP192t1,
- brainpoolP224r1,brainpoolP224t1,brainpoolP256r1,brainpoolP256t1,
- brainpoolP320r1,brainpoolP320t1,brainpoolP384r1,brainpoolP384t1,
- brainpoolP512r1,brainpoolP512t1].
+ wtls1,wtls3,wtls4,wtls5,wtls10,wtls11,ipsec3,ipsec4];
+characteristic_two_curves(_) ->
+ [].
curve(secp112r1) ->
{