feat(x509): Implement `Clone` for `X509Store` (#339)

* boring(x509): impl Clone of X509Store
This commit is contained in:
0x676e67 2025-04-08 01:05:27 +08:00 committed by GitHub
parent 20ad2665b2
commit 49a8d0906a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 0 deletions

View File

@ -125,6 +125,23 @@ foreign_type_and_impl_send_sync! {
pub struct X509Store;
}
impl Clone for X509Store {
fn clone(&self) -> Self {
(**self).to_owned()
}
}
impl ToOwned for X509StoreRef {
type Owned = X509Store;
fn to_owned(&self) -> Self::Owned {
unsafe {
ffi::X509_STORE_up_ref(self.as_ptr());
X509Store::from_ptr(self.as_ptr())
}
}
}
impl X509StoreRef {
/// **Warning: this method is unsound**
///