diff options
| author | Benjamin Fry <[email protected]> | 2017-03-19 12:06:41 -0700 |
|---|---|---|
| committer | Bastian Köcher <[email protected]> | 2018-03-07 13:50:12 +0100 |
| commit | 35cad33d518f3b6ecff1a01a4707b35ab834342e (patch) | |
| tree | 804a68c4d415c095b02a073c81b2f7eb77a8b02d /openssl/src | |
| parent | properly version library functions (diff) | |
| download | rust-openssl-35cad33d518f3b6ecff1a01a4707b35ab834342e.tar.xz rust-openssl-35cad33d518f3b6ecff1a01a4707b35ab834342e.zip | |
fix error check
Diffstat (limited to 'openssl/src')
| -rw-r--r-- | openssl/src/x509/mod.rs | 4 | ||||
| -rw-r--r-- | openssl/src/x509/tests.rs | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index 1e7c4448..6133e1a3 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -86,11 +86,11 @@ impl X509StoreContextRef { } } - #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))] pub fn verify_cert(self) -> Result<Option<X509VerifyError>, ErrorStack> { unsafe { - cvt(ffi::X509_verify_cert(self.as_ptr())).map(|_| ()) + try!(cvt(ffi::X509_verify_cert(self.as_ptr())).map(|_| ())) } + Ok(self.error()) } /// Returns the error code of the context. diff --git a/openssl/src/x509/tests.rs b/openssl/src/x509/tests.rs index 2b9d5dd3..b6303ade 100644 --- a/openssl/src/x509/tests.rs +++ b/openssl/src/x509/tests.rs @@ -285,7 +285,6 @@ fn signature() { assert_eq!(algorithm.object().to_string(), "sha256WithRSAEncryption"); } -#[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))] #[test] fn clone_x509() { let cert = include_bytes!("../../test/cert.pem"); @@ -301,11 +300,11 @@ fn test_verify_cert() { let ca = X509::from_pem(ca).unwrap(); let mut store_bldr = X509StoreBuilder::new().unwrap(); - store_bldr.add_cert(ca); + store_bldr.add_cert(ca).unwrap(); let store = store_bldr.build(); let store_ctx_bldr = X509StoreContext::builder().unwrap(); let store_ctx = store_ctx_bldr.build(&store, &cert, &Stack::new().unwrap()).unwrap(); - store_ctx.verify_cert().unwrap(); + assert!(store_ctx.verify_cert().unwrap().is_none()); } |