Moves `cleanup` into its own function
This commit is contained in:
parent
888f4ccaab
commit
810ddeb4ca
|
|
@ -108,16 +108,16 @@ impl X509StoreContextRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Verifies a certificate with the given certificate store.
|
/// Verifies a certificate with the given certificate store.
|
||||||
|
/// For successive calls to this function, it is required to call `cleanup` in beforehand.
|
||||||
|
///
|
||||||
/// * `trust` - The certificate store with the trusted certificates.
|
/// * `trust` - The certificate store with the trusted certificates.
|
||||||
/// * `cert` - The certificate that should be verified.
|
/// * `cert` - The certificate that should be verified.
|
||||||
/// * `cert_chain` - The certificates chain.
|
/// * `cert_chain` - The certificates chain.
|
||||||
///
|
///
|
||||||
/// This corresponds to [`X509_STORE_CTX_init`] followed by [`X509_verify_cert`] and
|
/// This corresponds to [`X509_STORE_CTX_init`] followed by [`X509_verify_cert`].
|
||||||
/// [`X509_STORE_CTX_cleanup`].
|
|
||||||
///
|
///
|
||||||
/// [`X509_STORE_CTX_init`]: https://www.openssl.org/docs/man1.0.2/crypto/X509_STORE_CTX_init.html
|
/// [`X509_STORE_CTX_init`]: https://www.openssl.org/docs/man1.0.2/crypto/X509_STORE_CTX_init.html
|
||||||
/// [`X509_verify_cert`]: https://www.openssl.org/docs/man1.0.2/crypto/X509_verify_cert.html
|
/// [`X509_verify_cert`]: https://www.openssl.org/docs/man1.0.2/crypto/X509_verify_cert.html
|
||||||
/// [`X509_STORE_CTX_cleanup`]: https://www.openssl.org/docs/man1.0.2/crypto/X509_STORE_CTX_cleanup.html
|
|
||||||
///
|
///
|
||||||
/// # Result
|
/// # Result
|
||||||
///
|
///
|
||||||
|
|
@ -129,13 +129,22 @@ impl X509StoreContextRef {
|
||||||
cert.as_ptr(), cert_chain.as_ptr()))?;
|
cert.as_ptr(), cert_chain.as_ptr()))?;
|
||||||
|
|
||||||
cvt(ffi::X509_verify_cert(self.as_ptr()))?;
|
cvt(ffi::X509_verify_cert(self.as_ptr()))?;
|
||||||
|
|
||||||
ffi::X509_STORE_CTX_cleanup(self.as_ptr());
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Cleans-up the context.
|
||||||
|
///
|
||||||
|
/// This corresponds to [`X509_STORE_CTX_cleanup`].
|
||||||
|
///
|
||||||
|
/// [`X509_STORE_CTX_cleanup`]: https://www.openssl.org/docs/man1.0.2/crypto/X509_STORE_CTX_cleanup.html
|
||||||
|
pub fn cleanup(&mut self) {
|
||||||
|
unsafe {
|
||||||
|
ffi::X509_STORE_CTX_cleanup(self.as_ptr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Set the error code of the context.
|
/// Set the error code of the context.
|
||||||
///
|
///
|
||||||
/// This corresponds to [`X509_STORE_CTX_set_error`].
|
/// This corresponds to [`X509_STORE_CTX_set_error`].
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue