-
Luca Boccassi authored
Solution: add a crypto [de-]initialiser, refcounted and serialised through critical sections. This is necessary as utility APIs such as zmq_curve_keypair also call into the sodium/tweetnacl libraries and need the initialisation outside of the zmq context. Also the libsodium documentation explicitly says that sodium_init must not be called concurrently from multiple threads, which could have happened until now. Also the randombytes_close function does not appear to be thread safe either. This change guarantees that the library is initialised only once at any given time across the whole program. Fixes #2632
e015a0f8