summaryrefslogtreecommitdiff
path: root/internal/stupidgcm/without_openssl.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/stupidgcm/without_openssl.go')
-rw-r--r--internal/stupidgcm/without_openssl.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/internal/stupidgcm/without_openssl.go b/internal/stupidgcm/without_openssl.go
new file mode 100644
index 0000000..0b3cf90
--- /dev/null
+++ b/internal/stupidgcm/without_openssl.go
@@ -0,0 +1,48 @@
+// +build without_openssl
+
+package stupidgcm
+
+import (
+ "os"
+
+ "github.com/rfjakob/gocryptfs/internal/tlog"
+)
+
+type stupidGCM struct{}
+
+const (
+ // Has openssl been disabled at compile-time?
+ BuiltWithoutOpenssl = true
+)
+
+func errExit() {
+ tlog.Fatal.Println("gocryptfs has been compiled without openssl support but you are still trying to use openssl")
+ os.Exit(2)
+}
+
+func New(_ []byte) stupidGCM {
+ errExit()
+ // This panic is never reached, but having it here stops the Go compiler
+ // from complaining about the missing return code.
+ panic("")
+}
+
+func (g stupidGCM) NonceSize() int {
+ errExit()
+ panic("")
+}
+
+func (g stupidGCM) Overhead() int {
+ errExit()
+ panic("")
+}
+
+func (g stupidGCM) Seal(_, _, _, _ []byte) []byte {
+ errExit()
+ panic("")
+}
+
+func (g stupidGCM) Open(_, _, _, _ []byte) ([]byte, error) {
+ errExit()
+ panic("")
+}