Loading openssl-sys/src/dsa.rs +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ use *; extern "C" { pub fn DSA_new() -> *mut DSA; pub fn DSA_free(dsa: *mut DSA); pub fn DSA_up_ref(dsa: *mut DSA) -> c_int; pub fn DSA_size(dsa: *const DSA) -> c_int; pub fn DSA_sign( dummy: c_int, Loading openssl/src/dsa.rs +23 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,23 @@ generic_foreign_type_and_impl_send_sync! { pub struct DsaRef<T>; } impl<T> Clone for Dsa<T> { fn clone(&self) -> Dsa<T> { (**self).to_owned() } } impl<T> ToOwned for DsaRef<T> { type Owned = Dsa<T>; fn to_owned(&self) -> Dsa<T> { unsafe { ffi::DSA_up_ref(self.as_ptr()); Dsa::from_ptr(self.as_ptr()) } } } impl<T> DsaRef<T> where T: HasPublic, Loading Loading @@ -412,4 +429,10 @@ mod test { verifier.update(TEST_DATA).unwrap(); assert!(verifier.verify(&signature[..]).unwrap()); } #[test] fn clone() { let key = Dsa::generate(2048).unwrap(); drop(key.clone()); } } Loading
openssl-sys/src/dsa.rs +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ use *; extern "C" { pub fn DSA_new() -> *mut DSA; pub fn DSA_free(dsa: *mut DSA); pub fn DSA_up_ref(dsa: *mut DSA) -> c_int; pub fn DSA_size(dsa: *const DSA) -> c_int; pub fn DSA_sign( dummy: c_int, Loading
openssl/src/dsa.rs +23 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,23 @@ generic_foreign_type_and_impl_send_sync! { pub struct DsaRef<T>; } impl<T> Clone for Dsa<T> { fn clone(&self) -> Dsa<T> { (**self).to_owned() } } impl<T> ToOwned for DsaRef<T> { type Owned = Dsa<T>; fn to_owned(&self) -> Dsa<T> { unsafe { ffi::DSA_up_ref(self.as_ptr()); Dsa::from_ptr(self.as_ptr()) } } } impl<T> DsaRef<T> where T: HasPublic, Loading Loading @@ -412,4 +429,10 @@ mod test { verifier.update(TEST_DATA).unwrap(); assert!(verifier.verify(&signature[..]).unwrap()); } #[test] fn clone() { let key = Dsa::generate(2048).unwrap(); drop(key.clone()); } }