]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
drbg: add handling for cases where TSAN isn't available
authorPauli <pauli@openssl.org>
Wed, 12 Jan 2022 04:01:17 +0000 (15:01 +1100)
committerPauli <pauli@openssl.org>
Thu, 13 Jan 2022 10:46:34 +0000 (21:46 +1100)
Most of the DRGB code is run under lock from the EVP layer.  This is relied
on to make the majority of TSAN operations safe.  However, it is still necessary
to enable locking for all DRBGs created.

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/17479)

providers/implementations/rands/drbg.c

index 8b899b99b17dc054e0c64dd10e581c8132e6c536..16d382dced8f5cc2ee4a4594b81579dd05c9b503 100644 (file)
@@ -837,6 +837,10 @@ PROV_DRBG *ossl_rand_drbg_new
             goto err;
         }
     }
+#ifdef TSAN_REQUIRES_LOCKING
+    if (!ossl_drbg_enable_locking(drbg))
+        goto err;
+#endif
     return drbg;
 
  err: