2022-08-28 11:11:36 +02:00
|
|
|
//go:build without_openssl
|
2016-10-04 09:51:14 +02:00
|
|
|
// +build without_openssl
|
|
|
|
|
|
|
|
package stupidgcm
|
|
|
|
|
|
|
|
import (
|
2017-02-24 09:46:10 +01:00
|
|
|
"fmt"
|
2016-10-04 09:51:14 +02:00
|
|
|
"os"
|
2017-05-07 22:15:01 +02:00
|
|
|
|
2021-09-04 11:58:43 +02:00
|
|
|
"crypto/cipher"
|
|
|
|
|
2021-08-23 15:05:15 +02:00
|
|
|
"github.com/rfjakob/gocryptfs/v2/internal/exitcodes"
|
2016-10-04 09:51:14 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2016-10-04 23:30:05 +02:00
|
|
|
// BuiltWithoutOpenssl indicates if openssl been disabled at compile-time
|
2016-10-04 09:51:14 +02:00
|
|
|
BuiltWithoutOpenssl = true
|
|
|
|
)
|
|
|
|
|
|
|
|
func errExit() {
|
2021-09-07 18:11:11 +02:00
|
|
|
fmt.Fprintln(os.Stderr, "I have been compiled without openssl support but you are still trying to use openssl")
|
2017-05-07 22:15:01 +02:00
|
|
|
os.Exit(exitcodes.OpenSSL)
|
2016-10-04 09:51:14 +02:00
|
|
|
}
|
|
|
|
|
2021-09-10 12:14:19 +02:00
|
|
|
func NewAES256GCM(_ []byte) cipher.AEAD {
|
2021-09-07 18:11:11 +02:00
|
|
|
errExit()
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewChacha20poly1305(_ []byte) cipher.AEAD {
|
2016-10-04 09:51:14 +02:00
|
|
|
errExit()
|
2016-12-10 13:14:20 +01:00
|
|
|
return nil
|
2016-10-04 09:51:14 +02:00
|
|
|
}
|
|
|
|
|
2021-09-04 11:58:43 +02:00
|
|
|
func NewXchacha20poly1305(_ []byte) cipher.AEAD {
|
2018-02-18 11:33:47 +01:00
|
|
|
errExit()
|
2021-09-04 11:58:43 +02:00
|
|
|
return nil
|
2018-02-18 11:33:47 +01:00
|
|
|
}
|