From 7a52fbbe99b6377ca664692462808c84ba81c8a4 Mon Sep 17 00:00:00 2001 From: Anthony Ramine <123095+nox@users.noreply.github.com> Date: Mon, 2 Jun 2025 16:39:11 +0200 Subject: [PATCH] Add X509VerifyParamRef::copy_from (#361) --- boring/src/x509/verify.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/boring/src/x509/verify.rs b/boring/src/x509/verify.rs index 7546442d..8b63b7bc 100644 --- a/boring/src/x509/verify.rs +++ b/boring/src/x509/verify.rs @@ -182,4 +182,12 @@ impl X509VerifyParamRef { pub fn set_depth(&mut self, depth: c_int) { unsafe { ffi::X509_VERIFY_PARAM_set_depth(self.as_ptr(), depth) } } + + /// Copies parameters from `src`. + /// + /// If a parameter is unset in `src`, the existing value in `self`` is preserved. + #[corresponds(X509_VERIFY_PARAM_set1)] + pub fn copy_from(&mut self, src: &Self) -> Result<(), ErrorStack> { + unsafe { cvt(ffi::X509_VERIFY_PARAM_set1(self.as_ptr(), src.as_ptr())).map(|_| ()) } + } }