Add EC_GROUP_order_bits for OpenSSL compatibility Change-Id: I37149fa4274357d84befff85728ce2337131afa7 Reviewed-on: https://boringssl-review.googlesource.com/c/33804 Commit-Queue: Adam Langley <agl@google.com> Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/fipsmodule/ec/ec.c b/crypto/fipsmodule/ec/ec.c index bd0662a..90b9d71 100644 --- a/crypto/fipsmodule/ec/ec.c +++ b/crypto/fipsmodule/ec/ec.c
@@ -625,6 +625,10 @@ return 1; } +int EC_GROUP_order_bits(const EC_GROUP *group) { + return BN_num_bits(&group->order); +} + int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx) { // All |EC_GROUP|s have cofactor 1.
diff --git a/include/openssl/ec.h b/include/openssl/ec.h index 966393e..c65a1a7 100644 --- a/include/openssl/ec.h +++ b/include/openssl/ec.h
@@ -133,6 +133,9 @@ // |group| that specifies the order of the group. OPENSSL_EXPORT const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group); +// EC_GROUP_order_bits returns the number of bits of the order of |group|. +OPENSSL_EXPORT int EC_GROUP_order_bits(const EC_GROUP *group); + // EC_GROUP_get_cofactor sets |*cofactor| to the cofactor of |group| using // |ctx|, if it's not NULL. It returns one on success and zero otherwise. OPENSSL_EXPORT int EC_GROUP_get_cofactor(const EC_GROUP *group,