aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/crypto
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-08-05 21:04:40 -0700
committerSteven Fackler <[email protected]>2016-08-05 21:04:40 -0700
commitfe47e93f2f5b6c2b2243b15445bbfdd4e58780b1 (patch)
treecc6f8b48a0b532e47dd527c35f16ef082e6daa86 /openssl/src/crypto
parentClean up x509 (diff)
downloadrust-openssl-fe47e93f2f5b6c2b2243b15445bbfdd4e58780b1.tar.xz
rust-openssl-fe47e93f2f5b6c2b2243b15445bbfdd4e58780b1.zip
Fix pkey method safety
Diffstat (limited to 'openssl/src/crypto')
-rw-r--r--openssl/src/crypto/pkey.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/openssl/src/crypto/pkey.rs b/openssl/src/crypto/pkey.rs
index ab9a4a95..9f72464b 100644
--- a/openssl/src/crypto/pkey.rs
+++ b/openssl/src/crypto/pkey.rs
@@ -63,7 +63,7 @@ impl PKey {
}
}
- pub fn from_handle(handle: *mut ffi::EVP_PKEY, parts: Parts) -> PKey {
+ pub unsafe fn from_handle(handle: *mut ffi::EVP_PKEY, parts: Parts) -> PKey {
ffi::init();
assert!(!handle.is_null());
@@ -587,7 +587,7 @@ impl PKey {
}
}
- pub unsafe fn get_handle(&self) -> *mut ffi::EVP_PKEY {
+ pub fn handle(&self) -> *mut ffi::EVP_PKEY {
return self.evp;
}
@@ -606,7 +606,8 @@ impl Drop for PKey {
impl Clone for PKey {
fn clone(&self) -> Self {
- let mut pkey = PKey::from_handle(unsafe { ffi::EVP_PKEY_new() }, self.parts);
+ let mut pkey = unsafe { PKey::from_handle(ffi::EVP_PKEY_new(), self.parts) };
+
// copy by encoding to DER and back
match self.parts {
Parts::Public => {