a65965783a
This makes it easier to use the package in external projects. See https://github.com/rfjakob/gocryptfs/issues/79
47 lines
737 B
Go
47 lines
737 B
Go
// +build without_openssl
|
|
|
|
package stupidgcm
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
type stupidGCM struct{}
|
|
|
|
const (
|
|
// BuiltWithoutOpenssl indicates if openssl been disabled at compile-time
|
|
BuiltWithoutOpenssl = true
|
|
)
|
|
|
|
func errExit() {
|
|
fmt.Fprintln(os.Stderr, "gocryptfs has been compiled without openssl support but you are still trying to use openssl")
|
|
os.Exit(2)
|
|
}
|
|
|
|
func New(_ []byte) stupidGCM {
|
|
errExit()
|
|
// Never reached
|
|
return stupidGCM{}
|
|
}
|
|
|
|
func (g stupidGCM) NonceSize() int {
|
|
errExit()
|
|
return -1
|
|
}
|
|
|
|
func (g stupidGCM) Overhead() int {
|
|
errExit()
|
|
return -1
|
|
}
|
|
|
|
func (g stupidGCM) Seal(_, _, _, _ []byte) []byte {
|
|
errExit()
|
|
return nil
|
|
}
|
|
|
|
func (g stupidGCM) Open(_, _, _, _ []byte) ([]byte, error) {
|
|
errExit()
|
|
return nil, nil
|
|
}
|