aboutsummaryrefslogtreecommitdiff
path: root/perl/lib
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-01-06 17:56:53 +0100
committerEelco Dolstra <edolstra@gmail.com>2021-01-06 17:56:53 +0100
commit0df69d96e02ce4c9e17bd33333c5d78313341dd3 (patch)
treefea6aa6a86b8c51ac97ec20db43e46347c102ede /perl/lib
parent9374c2baeabe45a22e4b8746dc97f5ce4f030184 (diff)
Make sodium a required dependency
Diffstat (limited to 'perl/lib')
-rw-r--r--perl/lib/Nix/Store.xs10
1 files changed, 0 insertions, 10 deletions
diff --git a/perl/lib/Nix/Store.xs b/perl/lib/Nix/Store.xs
index 9e3b7d389..ad9042a2a 100644
--- a/perl/lib/Nix/Store.xs
+++ b/perl/lib/Nix/Store.xs
@@ -14,9 +14,7 @@
#include "util.hh"
#include "crypto.hh"
-#if HAVE_SODIUM
#include <sodium.h>
-#endif
using namespace nix;
@@ -239,12 +237,8 @@ SV * convertHash(char * algo, char * s, int toBase32)
SV * signString(char * secretKey_, char * msg)
PPCODE:
try {
-#if HAVE_SODIUM
auto sig = SecretKey(secretKey_).signDetached(msg);
XPUSHs(sv_2mortal(newSVpv(sig.c_str(), sig.size())));
-#else
- throw Error("Nix was not compiled with libsodium, required for signed binary cache support");
-#endif
} catch (Error & e) {
croak("%s", e.what());
}
@@ -253,7 +247,6 @@ SV * signString(char * secretKey_, char * msg)
int checkSignature(SV * publicKey_, SV * sig_, char * msg)
CODE:
try {
-#if HAVE_SODIUM
STRLEN publicKeyLen;
unsigned char * publicKey = (unsigned char *) SvPV(publicKey_, publicKeyLen);
if (publicKeyLen != crypto_sign_PUBLICKEYBYTES)
@@ -265,9 +258,6 @@ int checkSignature(SV * publicKey_, SV * sig_, char * msg)
throw Error("signature is not valid");
RETVAL = crypto_sign_verify_detached(sig, (unsigned char *) msg, strlen(msg), publicKey) == 0;
-#else
- throw Error("Nix was not compiled with libsodium, required for signed binary cache support");
-#endif
} catch (Error & e) {
croak("%s", e.what());
}