Coverage Report

Created: 2026-09-28 06:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/openssl-0.10.62/src/macros.rs
Line
Count
Source
1
macro_rules! private_key_from_pem {
2
    ($(#[$m:meta])* $n:ident, $(#[$m2:meta])* $n2:ident, $(#[$m3:meta])* $n3:ident, $t:ty, $f:path) => {
3
        from_pem!($(#[$m])* $n, $t, $f);
4
5
        $(#[$m2])*
6
0
        pub fn $n2(pem: &[u8], passphrase: &[u8]) -> Result<$t, crate::error::ErrorStack> {
7
            unsafe {
8
0
                ffi::init();
9
0
                let bio = crate::bio::MemBioSlice::new(pem)?;
10
0
                let passphrase = ::std::ffi::CString::new(passphrase).unwrap();
11
0
                cvt_p($f(bio.as_ptr(),
12
0
                         ptr::null_mut(),
13
0
                         None,
14
0
                         passphrase.as_ptr() as *const _ as *mut _))
15
0
                    .map(|p| ::foreign_types::ForeignType::from_ptr(p))
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Private>>::private_key_from_pem_passphrase::{closure#0}
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Private>>::private_key_from_pem_passphrase::{closure#0}
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Private>>::private_key_from_pem_passphrase::{closure#0}
16
            }
17
0
        }
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Private>>::private_key_from_pem_passphrase
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Private>>::private_key_from_pem_passphrase
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Private>>::private_key_from_pem_passphrase
18
19
        $(#[$m3])*
20
0
        pub fn $n3<F>(pem: &[u8], callback: F) -> Result<$t, crate::error::ErrorStack>
21
0
            where F: FnOnce(&mut [u8]) -> Result<usize, crate::error::ErrorStack>
22
        {
23
            unsafe {
24
0
                ffi::init();
25
0
                let mut cb = crate::util::CallbackState::new(callback);
26
0
                let bio = crate::bio::MemBioSlice::new(pem)?;
27
0
                cvt_p($f(bio.as_ptr(),
28
0
                         ptr::null_mut(),
29
0
                         Some(crate::util::invoke_passwd_cb::<F>),
30
0
                         &mut cb as *mut _ as *mut _))
31
0
                    .map(|p| ::foreign_types::ForeignType::from_ptr(p))
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Private>>::private_key_from_pem_callback::<_>::{closure#0}
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Private>>::private_key_from_pem_callback::<_>::{closure#0}
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Private>>::private_key_from_pem_callback::<_>::{closure#0}
32
            }
33
0
        }
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Private>>::private_key_from_pem_callback::<_>
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Private>>::private_key_from_pem_callback::<_>
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Private>>::private_key_from_pem_callback::<_>
34
    }
35
}
36
37
macro_rules! private_key_to_pem {
38
    ($(#[$m:meta])* $n:ident, $(#[$m2:meta])* $n2:ident, $f:path) => {
39
        $(#[$m])*
40
0
        pub fn $n(&self) -> Result<Vec<u8>, crate::error::ErrorStack> {
41
            unsafe {
42
0
                let bio = crate::bio::MemBio::new()?;
43
0
                cvt($f(bio.as_ptr(),
44
0
                        self.as_ptr(),
45
0
                        ptr::null(),
46
0
                        ptr::null_mut(),
47
0
                        -1,
48
0
                        None,
49
0
                        ptr::null_mut()))?;
50
0
                Ok(bio.get_buf().to_owned())
51
            }
52
0
        }
Unexecuted instantiation: <openssl::dsa::DsaRef<_>>::private_key_to_pem
Unexecuted instantiation: <openssl::rsa::RsaRef<_>>::private_key_to_pem
Unexecuted instantiation: <openssl::ec::EcKeyRef<_>>::private_key_to_pem
Unexecuted instantiation: <openssl::pkey::PKeyRef<_>>::private_key_to_pem_pkcs8
53
54
        $(#[$m2])*
55
0
        pub fn $n2(
56
0
            &self,
57
0
            cipher: crate::symm::Cipher,
58
0
            passphrase: &[u8]
59
0
        ) -> Result<Vec<u8>, crate::error::ErrorStack> {
60
            unsafe {
61
0
                let bio = crate::bio::MemBio::new()?;
62
0
                assert!(passphrase.len() <= ::libc::c_int::max_value() as usize);
63
0
                cvt($f(bio.as_ptr(),
64
0
                        self.as_ptr(),
65
0
                        cipher.as_ptr(),
66
0
                        passphrase.as_ptr() as *const _ as *mut _,
67
0
                        passphrase.len() as ::libc::c_int,
68
0
                        None,
69
0
                        ptr::null_mut()))?;
70
0
                Ok(bio.get_buf().to_owned())
71
            }
72
0
        }
Unexecuted instantiation: <openssl::dsa::DsaRef<_>>::private_key_to_pem_passphrase
Unexecuted instantiation: <openssl::rsa::RsaRef<_>>::private_key_to_pem_passphrase
Unexecuted instantiation: <openssl::ec::EcKeyRef<_>>::private_key_to_pem_passphrase
Unexecuted instantiation: <openssl::pkey::PKeyRef<_>>::private_key_to_pem_pkcs8_passphrase
73
    }
74
}
75
76
macro_rules! to_pem {
77
    ($(#[$m:meta])* $n:ident, $f:path) => {
78
        $(#[$m])*
79
0
        pub fn $n(&self) -> Result<Vec<u8>, crate::error::ErrorStack> {
80
            unsafe {
81
0
                let bio = crate::bio::MemBio::new()?;
82
0
                cvt($f(bio.as_ptr(), self.as_ptr()))?;
83
0
                Ok(bio.get_buf().to_owned())
84
            }
85
0
        }
Unexecuted instantiation: <openssl::x509::X509Ref>::to_pem
Unexecuted instantiation: <openssl::x509::X509Ref>::to_text
Unexecuted instantiation: <openssl::x509::X509CrlRef>::to_pem
Unexecuted instantiation: <openssl::x509::X509ReqRef>::to_pem
Unexecuted instantiation: <openssl::x509::X509ReqRef>::to_text
Unexecuted instantiation: <openssl::pkcs7::Pkcs7Ref>::to_pem
Unexecuted instantiation: <openssl::cms::CmsContentInfoRef>::to_pem
Unexecuted instantiation: <openssl::dh::DhRef<_>>::params_to_pem
Unexecuted instantiation: <openssl::dsa::DsaRef<_>>::public_key_to_pem
Unexecuted instantiation: <openssl::rsa::RsaRef<_>>::public_key_to_pem
Unexecuted instantiation: <openssl::rsa::RsaRef<_>>::public_key_to_pem_pkcs1
Unexecuted instantiation: <openssl::ec::EcKeyRef<_>>::public_key_to_pem
Unexecuted instantiation: <openssl::pkey::PKeyRef<_>>::public_key_to_pem
86
    }
87
}
88
89
macro_rules! to_der {
90
    ($(#[$m:meta])* $n:ident, $f:path) => {
91
        $(#[$m])*
92
0
        pub fn $n(&self) -> Result<Vec<u8>, crate::error::ErrorStack> {
93
            unsafe {
94
0
                let len = crate::cvt($f(::foreign_types::ForeignTypeRef::as_ptr(self),
95
0
                                        ptr::null_mut()))?;
96
0
                let mut buf = vec![0; len as usize];
97
0
                crate::cvt($f(::foreign_types::ForeignTypeRef::as_ptr(self),
98
0
                              &mut buf.as_mut_ptr()))?;
99
0
                Ok(buf)
100
            }
101
0
        }
Unexecuted instantiation: <openssl::ssl::SslSessionRef>::to_der
Unexecuted instantiation: <openssl::x509::X509Ref>::to_der
Unexecuted instantiation: <openssl::x509::X509RevokedRef>::to_der
Unexecuted instantiation: <openssl::x509::X509CrlRef>::to_der
Unexecuted instantiation: <openssl::x509::X509ExtensionRef>::to_der
Unexecuted instantiation: <openssl::x509::X509NameRef>::to_der
Unexecuted instantiation: <openssl::x509::X509ReqRef>::to_der
Unexecuted instantiation: <openssl::ecdsa::EcdsaSigRef>::to_der
Unexecuted instantiation: <openssl::pkcs7::Pkcs7Ref>::to_der
Unexecuted instantiation: <openssl::cms::CmsContentInfoRef>::to_der
Unexecuted instantiation: <openssl::pkcs12::Pkcs12Ref>::to_der
Unexecuted instantiation: <openssl::ocsp::OcspResponseRef>::to_der
Unexecuted instantiation: <openssl::ocsp::OcspRequestRef>::to_der
Unexecuted instantiation: <openssl::dsa::DsaSigRef>::to_der
Unexecuted instantiation: <openssl::dh::DhRef<_>>::params_to_der
Unexecuted instantiation: <openssl::dsa::DsaRef<_>>::public_key_to_der
Unexecuted instantiation: <openssl::dsa::DsaRef<_>>::private_key_to_der
Unexecuted instantiation: <openssl::rsa::RsaRef<_>>::private_key_to_der
Unexecuted instantiation: <openssl::rsa::RsaRef<_>>::public_key_to_der
Unexecuted instantiation: <openssl::rsa::RsaRef<_>>::public_key_to_der_pkcs1
Unexecuted instantiation: <openssl::ec::EcKeyRef<_>>::private_key_to_der
Unexecuted instantiation: <openssl::ec::EcKeyRef<_>>::public_key_to_der
Unexecuted instantiation: <openssl::pkey::PKeyRef<_>>::public_key_to_der
Unexecuted instantiation: <openssl::pkey::PKeyRef<_>>::private_key_to_der
102
    };
103
}
104
105
macro_rules! from_der {
106
    ($(#[$m:meta])* $n:ident, $t:ty, $f:path) => {
107
        $(#[$m])*
108
0
        pub fn $n(der: &[u8]) -> Result<$t, crate::error::ErrorStack> {
109
            use std::convert::TryInto;
110
            unsafe {
111
0
                ffi::init();
112
0
                let len = ::std::cmp::min(der.len(), ::libc::c_long::max_value() as usize) as ::libc::c_long;
113
0
                crate::cvt_p($f(::std::ptr::null_mut(), &mut der.as_ptr(), len.try_into().unwrap()))
114
0
                    .map(|p| ::foreign_types::ForeignType::from_ptr(p))
Unexecuted instantiation: <openssl::ssl::SslSession>::from_der::{closure#0}
Unexecuted instantiation: <openssl::x509::X509>::from_der::{closure#0}
Unexecuted instantiation: <openssl::x509::X509Revoked>::from_der::{closure#0}
Unexecuted instantiation: <openssl::x509::X509Crl>::from_der::{closure#0}
Unexecuted instantiation: <openssl::x509::X509Name>::from_der::{closure#0}
Unexecuted instantiation: <openssl::x509::X509Req>::from_der::{closure#0}
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Public>>::public_key_from_der::{closure#0}
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Public>>::public_key_from_der_pkcs1::{closure#0}
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Private>>::private_key_from_der::{closure#0}
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Private>>::private_key_from_der::{closure#0}
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Public>>::public_key_from_der::{closure#0}
Unexecuted instantiation: <openssl::ecdsa::EcdsaSig>::from_der::{closure#0}
Unexecuted instantiation: <openssl::pkcs7::Pkcs7>::from_der::{closure#0}
Unexecuted instantiation: <openssl::cms::CmsContentInfo>::from_der::{closure#0}
Unexecuted instantiation: <openssl::pkcs12::Pkcs12>::from_der::{closure#0}
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Public>>::public_key_from_der::{closure#0}
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Private>>::private_key_from_der::{closure#0}
Unexecuted instantiation: <openssl::ocsp::OcspResponse>::from_der::{closure#0}
Unexecuted instantiation: <openssl::dsa::Dsa<openssl::pkey::Public>>::public_key_from_der::{closure#0}
Unexecuted instantiation: <openssl::ocsp::OcspRequest>::from_der::{closure#0}
Unexecuted instantiation: <openssl::dsa::DsaSig>::from_der::{closure#0}
Unexecuted instantiation: <openssl::dh::Dh<openssl::pkey::Params>>::params_from_der::{closure#0}
115
            }
116
0
        }
Unexecuted instantiation: <openssl::ssl::SslSession>::from_der
Unexecuted instantiation: <openssl::x509::X509>::from_der
Unexecuted instantiation: <openssl::x509::X509Revoked>::from_der
Unexecuted instantiation: <openssl::x509::X509Crl>::from_der
Unexecuted instantiation: <openssl::x509::X509Name>::from_der
Unexecuted instantiation: <openssl::x509::X509Req>::from_der
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Public>>::public_key_from_der
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Public>>::public_key_from_der_pkcs1
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Private>>::private_key_from_der
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Private>>::private_key_from_der
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Public>>::public_key_from_der
Unexecuted instantiation: <openssl::ecdsa::EcdsaSig>::from_der
Unexecuted instantiation: <openssl::pkcs7::Pkcs7>::from_der
Unexecuted instantiation: <openssl::cms::CmsContentInfo>::from_der
Unexecuted instantiation: <openssl::pkcs12::Pkcs12>::from_der
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Public>>::public_key_from_der
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Private>>::private_key_from_der
Unexecuted instantiation: <openssl::ocsp::OcspResponse>::from_der
Unexecuted instantiation: <openssl::dsa::Dsa<openssl::pkey::Public>>::public_key_from_der
Unexecuted instantiation: <openssl::ocsp::OcspRequest>::from_der
Unexecuted instantiation: <openssl::dsa::DsaSig>::from_der
Unexecuted instantiation: <openssl::dh::Dh<openssl::pkey::Params>>::params_from_der
117
    }
118
}
119
120
macro_rules! from_pem {
121
    ($(#[$m:meta])* $n:ident, $t:ty, $f:path) => {
122
        $(#[$m])*
123
0
        pub fn $n(pem: &[u8]) -> Result<$t, crate::error::ErrorStack> {
124
            unsafe {
125
0
                crate::init();
126
0
                let bio = crate::bio::MemBioSlice::new(pem)?;
127
0
                cvt_p($f(bio.as_ptr(), ::std::ptr::null_mut(), None, ::std::ptr::null_mut()))
128
0
                    .map(|p| ::foreign_types::ForeignType::from_ptr(p))
Unexecuted instantiation: <openssl::x509::X509>::from_pem::{closure#0}
Unexecuted instantiation: <openssl::x509::X509Crl>::from_pem::{closure#0}
Unexecuted instantiation: <openssl::x509::X509Req>::from_pem::{closure#0}
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Public>>::public_key_from_pem::{closure#0}
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Public>>::public_key_from_pem_pkcs1::{closure#0}
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Private>>::private_key_from_pem::{closure#0}
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Private>>::private_key_from_pem::{closure#0}
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Public>>::public_key_from_pem::{closure#0}
Unexecuted instantiation: <openssl::pkcs7::Pkcs7>::from_pem::{closure#0}
Unexecuted instantiation: <openssl::cms::CmsContentInfo>::from_pem::{closure#0}
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Public>>::public_key_from_pem::{closure#0}
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Private>>::private_key_from_pem::{closure#0}
Unexecuted instantiation: <openssl::dsa::Dsa<openssl::pkey::Public>>::public_key_from_pem::{closure#0}
Unexecuted instantiation: <openssl::dh::Dh<openssl::pkey::Params>>::params_from_pem::{closure#0}
129
            }
130
0
        }
Unexecuted instantiation: <openssl::x509::X509>::from_pem
Unexecuted instantiation: <openssl::x509::X509Crl>::from_pem
Unexecuted instantiation: <openssl::x509::X509Req>::from_pem
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Public>>::public_key_from_pem
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Public>>::public_key_from_pem_pkcs1
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Private>>::private_key_from_pem
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Private>>::private_key_from_pem
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Public>>::public_key_from_pem
Unexecuted instantiation: <openssl::pkcs7::Pkcs7>::from_pem
Unexecuted instantiation: <openssl::cms::CmsContentInfo>::from_pem
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Public>>::public_key_from_pem
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Private>>::private_key_from_pem
Unexecuted instantiation: <openssl::dsa::Dsa<openssl::pkey::Public>>::public_key_from_pem
Unexecuted instantiation: <openssl::dh::Dh<openssl::pkey::Params>>::params_from_pem
131
    }
132
}
133
134
macro_rules! foreign_type_and_impl_send_sync {
135
    (
136
        $(#[$impl_attr:meta])*
137
        type CType = $ctype:ty;
138
        fn drop = $drop:expr;
139
        $(fn clone = $clone:expr;)*
140
141
        $(#[$owned_attr:meta])*
142
        pub struct $owned:ident;
143
        $(#[$borrowed_attr:meta])*
144
        pub struct $borrowed:ident;
145
    )
146
        => {
147
            ::foreign_types::foreign_type! {
148
                $(#[$impl_attr])*
149
                type CType = $ctype;
150
                fn drop = $drop;
151
                $(fn clone = $clone;)*
152
                $(#[$owned_attr])*
153
                pub struct $owned;
154
                $(#[$borrowed_attr])*
155
                pub struct $borrowed;
156
            }
157
158
            unsafe impl Send for $owned{}
159
            unsafe impl Send for $borrowed{}
160
            unsafe impl Sync for $owned{}
161
            unsafe impl Sync for $borrowed{}
162
        };
163
}
164
165
macro_rules! generic_foreign_type_and_impl_send_sync {
166
    (
167
        $(#[$impl_attr:meta])*
168
        type CType = $ctype:ty;
169
        fn drop = $drop:expr;
170
        $(fn clone = $clone:expr;)*
171
172
        $(#[$owned_attr:meta])*
173
        pub struct $owned:ident<T>;
174
        $(#[$borrowed_attr:meta])*
175
        pub struct $borrowed:ident<T>;
176
    ) => {
177
        $(#[$owned_attr])*
178
        pub struct $owned<T>(*mut $ctype, ::std::marker::PhantomData<T>);
179
180
        $(#[$impl_attr])*
181
        impl<T> ::foreign_types::ForeignType for $owned<T> {
182
            type CType = $ctype;
183
            type Ref = $borrowed<T>;
184
185
            #[inline]
186
0
            unsafe fn from_ptr(ptr: *mut $ctype) -> $owned<T> {
187
0
                $owned(ptr, ::std::marker::PhantomData)
188
0
            }
Unexecuted instantiation: <openssl::pkey_ctx::PkeyCtx<()> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Public> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Private> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Public> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Private> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Params> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Public> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Private> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::dsa::Dsa<openssl::pkey::Params> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::dsa::Dsa<openssl::pkey::Public> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::dsa::Dsa<openssl::pkey::Private> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::dh::Dh<openssl::pkey::Params> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::dh::Dh<openssl::pkey::Public> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::dh::Dh<openssl::pkey::Private> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::x509::store::X509Lookup<_> as foreign_types_shared::ForeignType>::from_ptr
Unexecuted instantiation: <openssl::x509::store::X509LookupMethod<_> as foreign_types_shared::ForeignType>::from_ptr
189
190
            #[inline]
191
0
            fn as_ptr(&self) -> *mut $ctype {
192
0
                self.0
193
0
            }
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Private> as foreign_types_shared::ForeignType>::as_ptr
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Private> as foreign_types_shared::ForeignType>::as_ptr
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Params> as foreign_types_shared::ForeignType>::as_ptr
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Public> as foreign_types_shared::ForeignType>::as_ptr
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Private> as foreign_types_shared::ForeignType>::as_ptr
Unexecuted instantiation: <openssl::dh::Dh<_> as foreign_types_shared::ForeignType>::as_ptr
Unexecuted instantiation: <openssl::dsa::Dsa<_> as foreign_types_shared::ForeignType>::as_ptr
Unexecuted instantiation: <openssl::pkey_ctx::PkeyCtx<_> as foreign_types_shared::ForeignType>::as_ptr
Unexecuted instantiation: <openssl::x509::store::X509Lookup<_> as foreign_types_shared::ForeignType>::as_ptr
Unexecuted instantiation: <openssl::x509::store::X509LookupMethod<_> as foreign_types_shared::ForeignType>::as_ptr
194
        }
195
196
        impl<T> Drop for $owned<T> {
197
            #[inline]
198
0
            fn drop(&mut self) {
199
0
                unsafe { $drop(self.0) }
200
0
            }
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Public> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <openssl::pkey_ctx::PkeyCtx<()> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <openssl::rsa::Rsa<openssl::pkey::Private> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Params> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Public> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <openssl::ec::EcKey<openssl::pkey::Private> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <openssl::dsa::Dsa<openssl::pkey::Params> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <openssl::dsa::Dsa<openssl::pkey::Public> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <openssl::dsa::Dsa<openssl::pkey::Private> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <openssl::dh::Dh<openssl::pkey::Params> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <openssl::x509::store::X509Lookup<_> as core::ops::drop::Drop>::drop
Unexecuted instantiation: <openssl::x509::store::X509LookupMethod<_> as core::ops::drop::Drop>::drop
201
        }
202
203
        $(
204
            impl<T> Clone for $owned<T> {
205
                #[inline]
206
                fn clone(&self) -> $owned<T> {
207
                    unsafe {
208
                        let handle: *mut $ctype = $clone(self.0);
209
                        ::foreign_types::ForeignType::from_ptr(handle)
210
                    }
211
                }
212
            }
213
214
            impl<T> ::std::borrow::ToOwned for $borrowed<T> {
215
                type Owned = $owned<T>;
216
                #[inline]
217
                fn to_owned(&self) -> $owned<T> {
218
                    unsafe {
219
                        let handle: *mut $ctype =
220
                            $clone(::foreign_types::ForeignTypeRef::as_ptr(self));
221
                        $crate::ForeignType::from_ptr(handle)
222
                    }
223
                }
224
            }
225
        )*
226
227
        impl<T> ::std::ops::Deref for $owned<T> {
228
            type Target = $borrowed<T>;
229
230
            #[inline]
231
0
            fn deref(&self) -> &$borrowed<T> {
232
0
                unsafe { ::foreign_types::ForeignTypeRef::from_ptr(self.0) }
233
0
            }
Unexecuted instantiation: <openssl::pkey::PKey<openssl::pkey::Public> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <openssl::dh::Dh<openssl::pkey::Params> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <openssl::ec::EcKey<_> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <openssl::dsa::Dsa<_> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <openssl::rsa::Rsa<_> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <openssl::pkey_ctx::PkeyCtx<_> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <openssl::x509::store::X509Lookup<_> as core::ops::deref::Deref>::deref
Unexecuted instantiation: <openssl::x509::store::X509LookupMethod<_> as core::ops::deref::Deref>::deref
234
        }
235
236
        impl<T> ::std::ops::DerefMut for $owned<T> {
237
            #[inline]
238
0
            fn deref_mut(&mut self) -> &mut $borrowed<T> {
239
0
                unsafe { ::foreign_types::ForeignTypeRef::from_ptr_mut(self.0) }
240
0
            }
Unexecuted instantiation: <openssl::pkey_ctx::PkeyCtx<()> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <openssl::dh::Dh<_> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <openssl::ec::EcKey<_> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <openssl::dsa::Dsa<_> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <openssl::rsa::Rsa<_> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <openssl::pkey::PKey<_> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <openssl::x509::store::X509Lookup<_> as core::ops::deref::DerefMut>::deref_mut
Unexecuted instantiation: <openssl::x509::store::X509LookupMethod<_> as core::ops::deref::DerefMut>::deref_mut
241
        }
242
243
        impl<T> ::std::borrow::Borrow<$borrowed<T>> for $owned<T> {
244
            #[inline]
245
0
            fn borrow(&self) -> &$borrowed<T> {
246
0
                &**self
247
0
            }
Unexecuted instantiation: <openssl::dh::Dh<_> as core::borrow::Borrow<openssl::dh::DhRef<_>>>::borrow
Unexecuted instantiation: <openssl::ec::EcKey<_> as core::borrow::Borrow<openssl::ec::EcKeyRef<_>>>::borrow
Unexecuted instantiation: <openssl::dsa::Dsa<_> as core::borrow::Borrow<openssl::dsa::DsaRef<_>>>::borrow
Unexecuted instantiation: <openssl::rsa::Rsa<_> as core::borrow::Borrow<openssl::rsa::RsaRef<_>>>::borrow
Unexecuted instantiation: <openssl::pkey::PKey<_> as core::borrow::Borrow<openssl::pkey::PKeyRef<_>>>::borrow
Unexecuted instantiation: <openssl::pkey_ctx::PkeyCtx<_> as core::borrow::Borrow<openssl::pkey_ctx::PkeyCtxRef<_>>>::borrow
Unexecuted instantiation: <openssl::x509::store::X509Lookup<_> as core::borrow::Borrow<openssl::x509::store::X509LookupRef<_>>>::borrow
Unexecuted instantiation: <openssl::x509::store::X509LookupMethod<_> as core::borrow::Borrow<openssl::x509::store::X509LookupMethodRef<_>>>::borrow
248
        }
249
250
        impl<T> ::std::convert::AsRef<$borrowed<T>> for $owned<T> {
251
            #[inline]
252
0
            fn as_ref(&self) -> &$borrowed<T> {
253
0
                &**self
254
0
            }
Unexecuted instantiation: <openssl::dh::Dh<_> as core::convert::AsRef<openssl::dh::DhRef<_>>>::as_ref
Unexecuted instantiation: <openssl::ec::EcKey<_> as core::convert::AsRef<openssl::ec::EcKeyRef<_>>>::as_ref
Unexecuted instantiation: <openssl::dsa::Dsa<_> as core::convert::AsRef<openssl::dsa::DsaRef<_>>>::as_ref
Unexecuted instantiation: <openssl::rsa::Rsa<_> as core::convert::AsRef<openssl::rsa::RsaRef<_>>>::as_ref
Unexecuted instantiation: <openssl::pkey::PKey<_> as core::convert::AsRef<openssl::pkey::PKeyRef<_>>>::as_ref
Unexecuted instantiation: <openssl::pkey_ctx::PkeyCtx<_> as core::convert::AsRef<openssl::pkey_ctx::PkeyCtxRef<_>>>::as_ref
Unexecuted instantiation: <openssl::x509::store::X509Lookup<_> as core::convert::AsRef<openssl::x509::store::X509LookupRef<_>>>::as_ref
Unexecuted instantiation: <openssl::x509::store::X509LookupMethod<_> as core::convert::AsRef<openssl::x509::store::X509LookupMethodRef<_>>>::as_ref
255
        }
256
257
        $(#[$borrowed_attr])*
258
        pub struct $borrowed<T>(::foreign_types::Opaque, ::std::marker::PhantomData<T>);
259
260
        $(#[$impl_attr])*
261
        impl<T> ::foreign_types::ForeignTypeRef for $borrowed<T> {
262
            type CType = $ctype;
263
        }
264
265
        unsafe impl<T> Send for $owned<T>{}
266
        unsafe impl<T> Send for $borrowed<T>{}
267
        unsafe impl<T> Sync for $owned<T>{}
268
        unsafe impl<T> Sync for $borrowed<T>{}
269
    };
270
}