aboutsummaryrefslogtreecommitdiff
path: root/openssl/src
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-10-31 20:19:59 -0700
committerSteven Fackler <[email protected]>2016-10-31 20:19:59 -0700
commit16e398e005803e0796f7033497179d689b3df265 (patch)
tree1052dac3dbd3d6e87967451b3f21f61ac4d87b71 /openssl/src
parentUpdate Rsa (diff)
downloadrust-openssl-16e398e005803e0796f7033497179d689b3df265.tar.xz
rust-openssl-16e398e005803e0796f7033497179d689b3df265.zip
Update verify
Diffstat (limited to 'openssl/src')
-rw-r--r--openssl/src/sign.rs9
-rw-r--r--openssl/src/ssl/mod.rs8
-rw-r--r--openssl/src/verify.rs14
3 files changed, 12 insertions, 19 deletions
diff --git a/openssl/src/sign.rs b/openssl/src/sign.rs
index eeee5cc7..aebfcca7 100644
--- a/openssl/src/sign.rs
+++ b/openssl/src/sign.rs
@@ -63,13 +63,14 @@ use {cvt, cvt_p};
use hash::MessageDigest;
use pkey::PKey;
use error::ErrorStack;
+use types::Ref;
#[cfg(ossl110)]
use ffi::{EVP_MD_CTX_new, EVP_MD_CTX_free};
#[cfg(any(ossl101, ossl102))]
use ffi::{EVP_MD_CTX_create as EVP_MD_CTX_new, EVP_MD_CTX_destroy as EVP_MD_CTX_free};
-pub struct Signer<'a>(*mut ffi::EVP_MD_CTX, PhantomData<&'a PKey>);
+pub struct Signer<'a>(*mut ffi::EVP_MD_CTX, PhantomData<&'a Ref<PKey>>);
impl<'a> Drop for Signer<'a> {
fn drop(&mut self) {
@@ -80,7 +81,7 @@ impl<'a> Drop for Signer<'a> {
}
impl<'a> Signer<'a> {
- pub fn new(type_: MessageDigest, pkey: &'a PKey) -> Result<Signer<'a>, ErrorStack> {
+ pub fn new(type_: MessageDigest, pkey: &'a Ref<PKey>) -> Result<Signer<'a>, ErrorStack> {
unsafe {
ffi::init();
@@ -128,7 +129,7 @@ impl<'a> Write for Signer<'a> {
}
}
-pub struct Verifier<'a>(*mut ffi::EVP_MD_CTX, PhantomData<&'a PKey>);
+pub struct Verifier<'a>(*mut ffi::EVP_MD_CTX, PhantomData<&'a Ref<PKey>>);
impl<'a> Drop for Verifier<'a> {
fn drop(&mut self) {
@@ -139,7 +140,7 @@ impl<'a> Drop for Verifier<'a> {
}
impl<'a> Verifier<'a> {
- pub fn new(type_: MessageDigest, pkey: &'a PKey) -> Result<Verifier<'a>, ErrorStack> {
+ pub fn new(type_: MessageDigest, pkey: &'a Ref<PKey>) -> Result<Verifier<'a>, ErrorStack> {
unsafe {
ffi::init();
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index 6a6916fc..8101ad01 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -95,7 +95,7 @@ use dh::Dh;
use ec_key::EcKey;
use x509::{X509StoreContextRef, X509FileType, X509, X509Ref, X509VerifyError};
#[cfg(any(ossl102, ossl110))]
-use verify::X509VerifyParamRef;
+use verify::X509VerifyParam;
use pkey::PKey;
use error::ErrorStack;
use opaque::Opaque;
@@ -1109,13 +1109,13 @@ impl SslRef {
///
/// Requires the `v102` or `v110` features and OpenSSL 1.0.2 or 1.1.0.
#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))]
- pub fn param_mut(&mut self) -> &mut X509VerifyParamRef {
+ pub fn param_mut(&mut self) -> &mut Ref<X509VerifyParam> {
self._param_mut()
}
#[cfg(any(ossl102, ossl110))]
- fn _param_mut(&mut self) -> &mut X509VerifyParamRef {
- unsafe { X509VerifyParamRef::from_ptr_mut(ffi::SSL_get0_param(self.as_ptr())) }
+ fn _param_mut(&mut self) -> &mut Ref<X509VerifyParam> {
+ unsafe { Ref::from_ptr_mut(ffi::SSL_get0_param(self.as_ptr())) }
}
/// Returns the result of X509 certificate verification.
diff --git a/openssl/src/verify.rs b/openssl/src/verify.rs
index ceb3a6c8..c067e08e 100644
--- a/openssl/src/verify.rs
+++ b/openssl/src/verify.rs
@@ -3,7 +3,7 @@ use ffi;
use cvt;
use error::ErrorStack;
-use opaque::Opaque;
+use types::Ref;
bitflags! {
pub flags X509CheckFlags: c_uint {
@@ -19,17 +19,9 @@ bitflags! {
}
}
-pub struct X509VerifyParamRef(Opaque);
-
-impl X509VerifyParamRef {
- pub unsafe fn from_ptr_mut<'a>(ptr: *mut ffi::X509_VERIFY_PARAM) -> &'a mut X509VerifyParamRef {
- &mut *(ptr as *mut _)
- }
-
- pub fn as_ptr(&self) -> *mut ffi::X509_VERIFY_PARAM {
- self as *const _ as *mut _
- }
+type_!(X509VerifyParam, ffi::X509_VERIFY_PARAM, ffi::X509_VERIFY_PARAM_free);
+impl Ref<X509VerifyParam> {
pub fn set_hostflags(&mut self, hostflags: X509CheckFlags) {
unsafe {
ffi::X509_VERIFY_PARAM_set_hostflags(self.as_ptr(), hostflags.bits);