openssl: Report correct key length for EC keys when not using NIST curves
[strongswan.git] / src / libstrongswan / plugins / openssl / openssl_ec_private_key.c
index 12f2642..bc7884c 100644 (file)
@@ -181,17 +181,7 @@ METHOD(private_key_t, decrypt, bool,
 METHOD(private_key_t, get_keysize, int,
        private_openssl_ec_private_key_t *this)
 {
-       switch (EC_GROUP_get_curve_name(EC_KEY_get0_group(this->ec)))
-       {
-               case NID_X9_62_prime256v1:
-                       return 256;
-               case NID_secp384r1:
-                       return 384;
-               case NID_secp521r1:
-                       return 521;
-               default:
-                       return 0;
-       }
+       return EC_GROUP_get_degree(EC_KEY_get0_group(this->ec));
 }
 
 METHOD(private_key_t, get_type, key_type_t,