diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-02-10T10·54+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-02-10T10·54+0100 |
commit | 1c972cba145dc95cb0930a83caf191f1ef722f8b (patch) | |
tree | ed57b226f29a2963bd6ff46cd1919c4e5c23a063 /src | |
parent | 5d9cd27dce30e1f221815f3f888203414e12a167 (diff) |
Make libsodium an optional dependency
Diffstat (limited to 'src')
-rw-r--r-- | src/nix-store/nix-store.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index c59eb21fb456..c16adf049628 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -20,7 +20,9 @@ #include <bzlib.h> +#if HAVE_SODIUM #include <sodium.h> +#endif using namespace nix; @@ -1016,6 +1018,7 @@ static void opGenerateBinaryCacheKey(Strings opFlags, Strings opArgs) if (opArgs.size() != 1) throw UsageError("one argument expected"); string keyName = opArgs.front(); +#if HAVE_SODIUM sodium_init(); unsigned char pk[crypto_sign_PUBLICKEYBYTES]; @@ -1025,6 +1028,9 @@ static void opGenerateBinaryCacheKey(Strings opFlags, Strings opArgs) std::cout << keyName << ":" << base64Encode(string((char *) pk, crypto_sign_PUBLICKEYBYTES)) << std::endl; std::cout << keyName << ":" << base64Encode(string((char *) sk, crypto_sign_SECRETKEYBYTES)) << std::endl; +#else + throw Error("Nix was not compiled with libsodium, required for signed binary cache support"); +#endif } |