xref: /third_party/rust/crates/rust-openssl/openssl/src/lib_ctx.rs
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/rust/crates/rust-openssl/openssl/src/
192f3ab15Sopenharmony_ciuse crate::cvt_p;
292f3ab15Sopenharmony_ciuse crate::error::ErrorStack;
392f3ab15Sopenharmony_ciuse foreign_types::ForeignType;
492f3ab15Sopenharmony_ciuse openssl_macros::corresponds;
592f3ab15Sopenharmony_ci
692f3ab15Sopenharmony_ciforeign_type_and_impl_send_sync! {
792f3ab15Sopenharmony_ci    type CType = ffi::OSSL_LIB_CTX;
892f3ab15Sopenharmony_ci    fn drop = ffi::OSSL_LIB_CTX_free;
992f3ab15Sopenharmony_ci
1092f3ab15Sopenharmony_ci    pub struct LibCtx;
1192f3ab15Sopenharmony_ci    pub struct LibCtxRef;
1292f3ab15Sopenharmony_ci}
1392f3ab15Sopenharmony_ci
1492f3ab15Sopenharmony_ciimpl LibCtx {
1592f3ab15Sopenharmony_ci    #[corresponds(OSSL_LIB_CTX_new)]
1692f3ab15Sopenharmony_ci    pub fn new() -> Result<Self, ErrorStack> {
1792f3ab15Sopenharmony_ci        unsafe {
1892f3ab15Sopenharmony_ci            let ptr = cvt_p(ffi::OSSL_LIB_CTX_new())?;
1992f3ab15Sopenharmony_ci            Ok(LibCtx::from_ptr(ptr))
2092f3ab15Sopenharmony_ci        }
2192f3ab15Sopenharmony_ci    }
2292f3ab15Sopenharmony_ci}
23

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