aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/openssl/openssl_ec_public_key.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2010-08-10 15:56:10 +0200
committerMartin Willi <martin@revosec.ch>2010-08-10 18:46:30 +0200
commita944d2092bb8663be21f863bbe27fa475966c9d9 (patch)
tree7a3d6f2c612f7e9e229c0e8be2fa21fb05d3db2e /src/libstrongswan/plugins/openssl/openssl_ec_public_key.c
parent33ddaaabec136e358bf38a6aeb7855f466603007 (diff)
downloadstrongswan-a944d2092bb8663be21f863bbe27fa475966c9d9.tar.bz2
strongswan-a944d2092bb8663be21f863bbe27fa475966c9d9.tar.xz
Use bits instead of bytes for a private/public key
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_ec_public_key.c')
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_ec_public_key.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_ec_public_key.c b/src/libstrongswan/plugins/openssl/openssl_ec_public_key.c
index 16257178d..f680749a3 100644
--- a/src/libstrongswan/plugins/openssl/openssl_ec_public_key.c
+++ b/src/libstrongswan/plugins/openssl/openssl_ec_public_key.c
@@ -176,10 +176,20 @@ METHOD(public_key_t, encrypt, bool,
return FALSE;
}
-METHOD(public_key_t, get_keysize, size_t,
+METHOD(public_key_t, get_keysize, int,
private_openssl_ec_public_key_t *this)
{
- return EC_FIELD_ELEMENT_LEN(EC_KEY_get0_group(this->ec));
+ 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;
+ }
}
/**