mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Move sodium_init() call
This commit is contained in:
parent
3edcb198e5
commit
146af4ee9b
2 changed files with 9 additions and 3 deletions
|
@ -18,6 +18,10 @@
|
|||
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
#if HAVE_SODIUM
|
||||
#include <sodium.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
@ -126,6 +130,11 @@ void initNix()
|
|||
CRYPTO_set_locking_callback(opensslLockCallback);
|
||||
#endif
|
||||
|
||||
#if HAVE_SODIUM
|
||||
if (sodium_init() == -1)
|
||||
throw Error("could not initialise libsodium");
|
||||
#endif
|
||||
|
||||
loadConfFile();
|
||||
|
||||
startSignalHandlerThread();
|
||||
|
|
|
@ -981,9 +981,6 @@ static void opGenerateBinaryCacheKey(Strings opFlags, Strings opArgs)
|
|||
string publicKeyFile = *i++;
|
||||
|
||||
#if HAVE_SODIUM
|
||||
if (sodium_init() == -1)
|
||||
throw Error("could not initialise libsodium");
|
||||
|
||||
unsigned char pk[crypto_sign_PUBLICKEYBYTES];
|
||||
unsigned char sk[crypto_sign_SECRETKEYBYTES];
|
||||
if (crypto_sign_keypair(pk, sk) != 0)
|
||||
|
|
Loading…
Reference in a new issue