Merge pull request #1179 from lukaslihotzki/master

Add EC_GROUP_order_bits
This commit is contained in:
Steven Fackler 2019-11-11 19:10:30 -05:00 committed by GitHub
commit efd7915c32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -61,6 +61,9 @@ extern "C" {
pub fn EC_GROUP_get_degree(group: *const EC_GROUP) -> c_int;
#[cfg(ossl110)]
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,

View File

@ -228,6 +228,16 @@ 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
#[cfg(ossl110)]
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`]