From 2ceb99216fba055d591157c52e76ee4885615db9 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 27 Mar 2023 11:59:36 +0200 Subject: [PATCH] Implement ToOwned for X509StoreRef and Clone for X509Store --- boring/src/x509/store.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/boring/src/x509/store.rs b/boring/src/x509/store.rs index d244c640..d53c6482 100644 --- a/boring/src/x509/store.rs +++ b/boring/src/x509/store.rs @@ -103,4 +103,21 @@ impl X509StoreRef { } } +impl ToOwned for X509StoreRef { + type Owned = X509Store; + + fn to_owned(&self) -> X509Store { + unsafe { + ffi::X509_STORE_up_ref(self.as_ptr()); + X509Store::from_ptr(self.as_ptr()) + } + } +} + +impl Clone for X509Store { + fn clone(&self) -> Self { + (**self).to_owned() + } +} + use crate::ffi::X509_STORE_get0_objects;