diff --git a/openssl-sys/src/ec.rs b/openssl-sys/src/ec.rs index ffb1a16cc91749b8745207f61e875a80617710bf..e07038488e0f7ebd28739c747005d90b1d41c708 100644 --- a/openssl-sys/src/ec.rs +++ b/openssl-sys/src/ec.rs @@ -61,6 +61,8 @@ extern "C" { pub fn EC_GROUP_get_degree(group: *const EC_GROUP) -> c_int; + pub fn EC_GROUP_order_bits(group: *const EC_GROUP) -> c_int; + pub fn EC_GROUP_new_curve_GFp( p: *const BIGNUM, a: *const BIGNUM, diff --git a/openssl/src/ec.rs b/openssl/src/ec.rs index d6097bbca9b94e3c64b98d2b7d20e23b34c91bad..600974dc4da6482c35d4ddec144351b051b78f1d 100644 --- a/openssl/src/ec.rs +++ b/openssl/src/ec.rs @@ -228,6 +228,15 @@ impl EcGroupRef { unsafe { ffi::EC_GROUP_get_degree(self.as_ptr()) as u32 } } + /// Returns the number of bits in the group order. + /// + /// OpenSSL documentation at [`EC_GROUP_order_bits`] + /// + /// [`EC_GROUP_order_bits`]: https://www.openssl.org/docs/man1.1.0/crypto/EC_GROUP_order_bits.html + pub fn order_bits(&self) -> u32 { + unsafe { ffi::EC_GROUP_order_bits(self.as_ptr()) as u32 } + } + /// Returns the generator for the given curve as a [`EcPoint`]. /// /// OpenSSL documentation at [`EC_GROUP_get0_generator`]