summaryrefslogtreecommitdiff
path: root/exports
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-02-10 13:36:09 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-04-05 12:26:10 +0200
commit53b31fa9f103d8262b7c1d28c5714238902e5081 (patch)
tree5aa56e5e756f33f3753f5b5b4decdefe4782db61 /exports
parent23e63807085b13a9b221c3374d05099559583011 (diff)
Move python library load to init and fix build
Signed-off-by: jwijenbergh <jeroenwijenbergh@protonmail.com>
Diffstat (limited to 'exports')
-rw-r--r--exports/Makefile2
-rw-r--r--exports/exports.go12
2 files changed, 7 insertions, 7 deletions
diff --git a/exports/Makefile b/exports/Makefile
index 3dcf2f0..a23f211 100644
--- a/exports/Makefile
+++ b/exports/Makefile
@@ -16,7 +16,7 @@ endif
# Build shared library and remove lib prefix (if any) from header name
# GOOS and GOARCH envvars are set by common.mk
# This extra target prevents unnecessary rebuild
-lib/$(GOOS)/$(GOARCH)/$(LIB_FILE): exports.go ../verify.go
+lib/$(GOOS)/$(GOARCH)/$(LIB_FILE): exports.go ../src/verify.go
CGO_ENABLED=1 go build -o $@ -buildmode=c-shared $<
mv lib/$(GOOS)/$(GOARCH)/$(LIB_PREFIX)$(LIB_NAME).h lib/$(GOOS)/$(GOARCH)/$(LIB_NAME).h || true # Normalize header name
diff --git a/exports/exports.go b/exports/exports.go
index c1ae79b..9ea8cba 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -2,20 +2,20 @@ package main
import "C"
-import "eduvpn-common"
+import "github.com/jwijenbergh/eduvpn-common/src"
// Functions here should probably not take string parameters, see https://pkg.go.dev/cmd/cgo#hdr-C_references_to_Go
-// Verify verifies a signature on a JSON file. See eduvpn_discovery.Verify for more details.
-// It returns 0 for a valid signature and a nonzero eduvpn_discovery.VerifyErrorCode otherwise.
+// Verify verifies a signature on a JSON file. See eduvpn.Verify for more details.
+// It returns 0 for a valid signature and a nonzero eduvpn.VerifyErrorCode otherwise.
// signatureFileContent must be UTF-8-encoded.
//export Verify
func Verify(signatureFileContent []byte, signedJson []byte, expectedFileName []byte, minSignTime uint64) int8 {
- valid, err := eduvpn_discovery.Verify(string(signatureFileContent), signedJson, string(expectedFileName), minSignTime)
+ valid, err := eduvpn.Verify(string(signatureFileContent), signedJson, string(expectedFileName), minSignTime, false)
if valid {
return 0
} else {
- return int8(err.(eduvpn_discovery.VerifyError).Code)
+ return int8(err.(eduvpn.VerifyError).Code)
}
}
@@ -24,7 +24,7 @@ func Verify(signatureFileContent []byte, signedJson []byte, expectedFileName []b
// keyString must be an ASCII Base64-encoded key.
//export InsecureTestingSetExtraKey
func InsecureTestingSetExtraKey(keyString []byte) {
- eduvpn_discovery.InsecureTestingSetExtraKey(string(keyString))
+ eduvpn.InsecureTestingSetExtraKey(string(keyString))
}
// Not used in library, but needed to compile.