Problem: CURVE mechanism is unusable with chroot()

libsodium calls abort() when /dev/urandom can't be found
even if one creates ZeroMQ context before calling chroot()[1].

This happens because crypto gets initialized on handshake,
and at that moment the process is already chroot'ed.

Solution: initialize cryptographic libraries in ctx

randombytes_close() is already there in the destructor.

[1] https://download.libsodium.org/doc/usage/index.html
This commit is contained in:
Nikolay Edigaryev
2016-03-30 02:23:56 +05:00
parent 05c8de7928
commit 884e00cb4a
6 changed files with 15 additions and 25 deletions

View File

@@ -233,6 +233,8 @@ namespace zmq
int vmci_family;
mutex_t vmci_sync;
#endif
mutex_t crypto_sync;
};
}