Add EcKey::check_key

This commit is contained in:
Steven Fackler 2016-11-13 22:10:52 +00:00
parent 35f11d555e
commit 82eb3c4f51
2 changed files with 6 additions and 0 deletions

View File

@ -1391,6 +1391,7 @@ extern {
pub fn EC_KEY_set_private_key(key: *mut EC_KEY, key: *const BIGNUM) -> c_int;
pub fn EC_KEY_get0_private_key(key: *const EC_KEY) -> *const BIGNUM;
pub fn EC_KEY_generate_key(key: *mut EC_KEY) -> c_int;
pub fn EC_KEY_check_key(key: *const EC_KEY) -> c_int;
pub fn EC_KEY_free(key: *mut EC_KEY);
pub fn EC_GFp_simple_method() -> *const EC_METHOD;

View File

@ -249,6 +249,11 @@ impl EcKeyRef {
}
}
}
/// Checks the key for validity.
pub fn check_key(&self) -> Result<(), ErrorStack> {
unsafe { cvt(ffi::EC_KEY_check_key(self.as_ptr())).map(|_| ()) }
}
}
impl EcKey {