aboutsummaryrefslogtreecommitdiff
path: root/internal/stupidgcm/without_openssl.go
blob: fcef793803b9a1a4606c3395148783a7449391e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//go:build without_openssl
// +build without_openssl

package stupidgcm

import (
	"fmt"
	"os"

	"crypto/cipher"

	"github.com/rfjakob/gocryptfs/v2/internal/exitcodes"
)

const (
	// BuiltWithoutOpenssl indicates if openssl been disabled at compile-time
	BuiltWithoutOpenssl = true
)

func errExit() {
	fmt.Fprintln(os.Stderr, "I have been compiled without openssl support but you are still trying to use openssl")
	os.Exit(exitcodes.OpenSSL)
}

func NewAES256GCM(_ []byte) cipher.AEAD {
	errExit()
	return nil
}

func NewChacha20poly1305(_ []byte) cipher.AEAD {
	errExit()
	return nil
}

func NewXchacha20poly1305(_ []byte) cipher.AEAD {
	errExit()
	return nil
}