Loading openssl-sys/src/handwritten/ec.rs +2 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ extern "C" { pub fn EC_GROUP_set_asn1_flag(key: *mut EC_GROUP, flag: c_int); pub fn EC_GROUP_get_asn1_flag(group: *const EC_GROUP) -> c_int; pub fn EC_GROUP_get_curve_GFp( group: *const EC_GROUP, p: *mut BIGNUM, Loading openssl/src/ec.rs +13 −0 Original line number Diff line number Diff line Loading @@ -294,6 +294,12 @@ impl EcGroupRef { } } /// Gets the flag determining if the group corresponds to a named curve. #[corresponds(EC_GROUP_get_asn1_flag)] pub fn get_asn1_flag(&mut self) -> Asn1Flag { unsafe { Asn1Flag(ffi::EC_GROUP_get_asn1_flag(self.as_ptr())) } } /// Returns the name of the curve, if a name is associated. #[corresponds(EC_GROUP_get_curve_name)] pub fn curve_name(&self) -> Option<Nid> { Loading Loading @@ -1265,4 +1271,11 @@ mod test { let group2 = EcGroup::from_curve_name(Nid::X9_62_PRIME239V3).unwrap(); assert!(!g.is_on_curve(&group2, &mut ctx).unwrap()); } #[test] fn get_flags() { let mut group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap(); let flag = group.get_asn1_flag(); assert_eq!(flag.0, Asn1Flag::NAMED_CURVE.0); } } Loading
openssl-sys/src/handwritten/ec.rs +2 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ extern "C" { pub fn EC_GROUP_set_asn1_flag(key: *mut EC_GROUP, flag: c_int); pub fn EC_GROUP_get_asn1_flag(group: *const EC_GROUP) -> c_int; pub fn EC_GROUP_get_curve_GFp( group: *const EC_GROUP, p: *mut BIGNUM, Loading
openssl/src/ec.rs +13 −0 Original line number Diff line number Diff line Loading @@ -294,6 +294,12 @@ impl EcGroupRef { } } /// Gets the flag determining if the group corresponds to a named curve. #[corresponds(EC_GROUP_get_asn1_flag)] pub fn get_asn1_flag(&mut self) -> Asn1Flag { unsafe { Asn1Flag(ffi::EC_GROUP_get_asn1_flag(self.as_ptr())) } } /// Returns the name of the curve, if a name is associated. #[corresponds(EC_GROUP_get_curve_name)] pub fn curve_name(&self) -> Option<Nid> { Loading Loading @@ -1265,4 +1271,11 @@ mod test { let group2 = EcGroup::from_curve_name(Nid::X9_62_PRIME239V3).unwrap(); assert!(!g.is_on_curve(&group2, &mut ctx).unwrap()); } #[test] fn get_flags() { let mut group = EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap(); let flag = group.get_asn1_flag(); assert_eq!(flag.0, Asn1Flag::NAMED_CURVE.0); } }