openssl/crypto/rand
Matt Caswell f5a50c2a07 Enable locking on the primary DRBG when we create it
The primary DRBG may be shared across multiple threads and therefore
we must use locking to access it. Previously we were enabling that locking
lazily when we attempted to obtain one of the child DRBGs. Part of the
process of enabling the lock, is to create the lock. But if we create the
lock lazily then it is too late - we may race with other threads where each
thread is independently attempting to enable the locking. This results
in multiple locks being created - only one of which "sticks" and the rest
are leaked.

Instead we enable locking on the primary when we first create it. This is
already locked and therefore we cannot race.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13660)
2021-01-14 17:30:46 +00:00
..
build.info rand: move the entropy source out of the FIPS provider 2020-11-20 08:24:21 +10:00
prov_seed.c rand: move the entropy source out of the FIPS provider 2020-11-20 08:24:21 +10:00
rand_deprecated.c
rand_egd.c
rand_err.c ERR: Rebuild all generated error headers and source files 2020-11-24 15:22:33 +01:00
rand_lib.c Enable locking on the primary DRBG when we create it 2021-01-14 17:30:46 +00:00
rand_local.h
rand_meth.c
rand_pool.c rand: move the entropy source out of the FIPS provider 2020-11-20 08:24:21 +10:00
randfile.c