From b36b1705b3148348a0361e5681d7377d5c45bd68 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 21 Mar 2023 20:49:48 -0400 Subject: [PATCH] Fix race condition with X509Name creation --- boring/src/x509/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/boring/src/x509/mod.rs b/boring/src/x509/mod.rs index e58c9efd..4f45d132 100644 --- a/boring/src/x509/mod.rs +++ b/boring/src/x509/mod.rs @@ -962,7 +962,10 @@ impl X509NameBuilder { /// Return an `X509Name`. pub fn build(self) -> X509Name { - self.0 + // Round-trip through bytes because OpenSSL is not const correct and + // names in a "modified" state compute various things lazily. This can + // lead to data-races because OpenSSL doesn't have locks or anything. + X509Name::from_der(&self.0.to_der().unwrap()).unwrap() } }