From d771f497de2ee521f15a59507fdac1e15616721d Mon Sep 17 00:00:00 2001 From: Tim Pambor Date: Mon, 30 May 2022 11:12:57 +0200 Subject: [PATCH] Mark add_alias unsafe --- openssl/src/x509/mod.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index 7782958f9..02b89549a 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -843,12 +843,16 @@ impl X509Extension { } } - #[corresponds(X509V3_EXT_add_alias)] - pub fn add_alias(to: Nid, from: Nid) -> Result<(), ErrorStack> { - unsafe { - ffi::init(); - cvt(ffi::X509V3_EXT_add_alias(to.as_raw(), from.as_raw())).map(|_| ()) - } + /// Adds an alias for an extension + /// + /// This corresponds to [`X509V3_EXT_add_alias`] + /// + /// # Safety + /// + /// This method modifies global state without locking and therefore is not thread safe + pub unsafe fn add_alias(to: Nid, from: Nid) -> Result<(), ErrorStack> { + ffi::init(); + cvt(ffi::X509V3_EXT_add_alias(to.as_raw(), from.as_raw())).map(|_| ()) } } -- GitLab