From 2983eb6fbdb311326a9a536c2e042b507a4487f7 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sat, 26 Aug 2017 09:40:24 -0400 Subject: [PATCH] start preparing for gutting of libsodium dependancy --- Makefile | 7 ++++- contrib/backends/srndv2/Makefile | 7 +++-- .../backends/srndv2/src/srnd/cryptography.go | 29 +++++++++++++++++++ .../backends/srndv2/src/srnd/nacl_crypto.go | 2 ++ 4 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 contrib/backends/srndv2/src/srnd/cryptography.go diff --git a/Makefile b/Makefile index e9091ad..2059b7b 100644 --- a/Makefile +++ b/Makefile @@ -30,11 +30,16 @@ $(JS): js-deps $(SRND): - make -C $(SRND_DIR) + $(MAKE) -C $(SRND_DIR) + cp $(SRND_DIR)/srndv2 $(SRND) + +pure: + $(MAKE) -C $(SRND_DIR) pure cp $(SRND_DIR)/srndv2 $(SRND) clean: rm -f $(SRND) $(JS) + $(MAKE) -C $(SRND_DIR) clean distclean: clean rm -rf $(REPO_GOPATH) diff --git a/contrib/backends/srndv2/Makefile b/contrib/backends/srndv2/Makefile index 53d2a9c..2f78774 100644 --- a/contrib/backends/srndv2/Makefile +++ b/contrib/backends/srndv2/Makefile @@ -1,10 +1,11 @@ REPO=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) -all: clean build - -build: srndv2 +all: srndv2 srndv2: + GOPATH=$(REPO) go build -v -tags libsodium + +pure: GOPATH=$(REPO) go build -v clean: diff --git a/contrib/backends/srndv2/src/srnd/cryptography.go b/contrib/backends/srndv2/src/srnd/cryptography.go new file mode 100644 index 0000000..5e7519c --- /dev/null +++ b/contrib/backends/srndv2/src/srnd/cryptography.go @@ -0,0 +1,29 @@ +// +build !libsodium + +package srnd + +import ( + "golang.org/x/crypto/curve25519" +) + +func naclCryptoVerifyFucky(h, sig, pk []byte) bool { + return false +} + +func naclCryptoSignFucky(hash, sk []byte) []byte { + return nil +} + +func naclCryptoVerifyDetached(hash, sig, pk []byte) bool { + return false +} + +func naclCryptoSignDetached(hash, sk []byte) []byte { + return nil +} + +func naclSeedToKeyPair(seed []byte) (pk, sk []byte) { + return +} + +var naclScalarBaseMult = curve25519.ScalarBaseMult diff --git a/contrib/backends/srndv2/src/srnd/nacl_crypto.go b/contrib/backends/srndv2/src/srnd/nacl_crypto.go index bf66796..7169c16 100644 --- a/contrib/backends/srndv2/src/srnd/nacl_crypto.go +++ b/contrib/backends/srndv2/src/srnd/nacl_crypto.go @@ -1,3 +1,5 @@ +// +build libsodium + package srnd import (