xref: /third_party/rust/crates/rust-openssl/openssl/src/lib_ctx.rs (revision 92f3ab15)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/rust/crates/rust-openssl/openssl/src/
1use crate::cvt_p;
2use crate::error::ErrorStack;
3use foreign_types::ForeignType;
4use openssl_macros::corresponds;
5
6foreign_type_and_impl_send_sync! {
7    type CType = ffi::OSSL_LIB_CTX;
8    fn drop = ffi::OSSL_LIB_CTX_free;
9
10    pub struct LibCtx;
11    pub struct LibCtxRef;
12}
13
14impl LibCtx {
15    #[corresponds(OSSL_LIB_CTX_new)]
16    pub fn new() -> Result<Self, ErrorStack> {
17        unsafe {
18            let ptr = cvt_p(ffi::OSSL_LIB_CTX_new())?;
19            Ok(LibCtx::from_ptr(ptr))
20        }
21    }
22}
23

Indexes created Thu Nov 07 10:32:03 CST 2024