diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-02-28 17:47:06 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-03-01 22:04:25 +0000 |
commit | 77470e989cf3c502ee00eb060b197d0241f33a22 (patch) | |
tree | e5c4b0f9b5f59a4080f7234ab143109ca2aa6a39 /crypto/ec/ec_lib.c | |
parent | 7d054e5ab2aeaead14c0c19b808d62221020b0e1 (diff) |
Replace overrides.
Instead of overriding a default operation move default operation to a
separate function which is then explicitly included in any EC_METHOD
that uses it.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/ec/ec_lib.c')
-rw-r--r-- | crypto/ec/ec_lib.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index e45cbe3607..1f487b48a0 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -373,11 +373,11 @@ const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group) int EC_GROUP_order_bits(const EC_GROUP *group) { - if (group->meth->group_order_bits) - return group->meth->group_order_bits(group); - if (group->order) - return BN_num_bits(group->order); - return 0; + if (group->meth->group_order_bits == NULL) { + ECerr(EC_F_EC_GROUP_ORDER_BITS, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); + return 0; + } + return group->meth->group_order_bits(group); } int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, @@ -1030,3 +1030,10 @@ void *EC_KEY_get_ex_data(const EC_KEY *key, int idx) { return CRYPTO_get_ex_data(&key->ex_data, idx); } + +int ec_group_simple_order_bits(const EC_GROUP *group) +{ + if (group->order == NULL) + return 0; + return BN_num_bits(group->order); +} |