mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
ceph_crypto: Fix ceph::crypto::init mutex for NSS.
Even after ceph::crypto::shutdown, the library looked
already initialized; this broke the ForkDeathTest.MD5
in "make check", and NSS-using daemons.
See 921d4b3d8b
for more.
Signed-off-by: Tommi Virtanen <tommi.virtanen@dreamhost.com>
This commit is contained in:
parent
27a48c1c88
commit
79b1a10149
@ -24,9 +24,10 @@ ceph::crypto::HMACSHA1::~HMACSHA1()
|
||||
|
||||
#elif USE_NSS
|
||||
|
||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static bool crypto_init = false;
|
||||
|
||||
void ceph::crypto::init() {
|
||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static bool crypto_init = false;
|
||||
pthread_mutex_lock(&lock);
|
||||
if (crypto_init) {
|
||||
pthread_mutex_unlock(&lock);
|
||||
@ -41,6 +42,10 @@ void ceph::crypto::init() {
|
||||
}
|
||||
|
||||
void ceph::crypto::shutdown() {
|
||||
pthread_mutex_lock(&lock);
|
||||
assert(crypto_init);
|
||||
crypto_init = false;
|
||||
pthread_mutex_unlock(&lock);
|
||||
SECStatus s;
|
||||
s = NSS_Shutdown();
|
||||
assert(s == SECSuccess);
|
||||
|
Loading…
Reference in New Issue
Block a user