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-08-23 15:05:15 +02:00
|
|
|
"github.com/rfjakob/gocryptfs/v2/internal/exitcodes"
|
2016-10-04 09:51:14 +02:00
|
|
|
)
|
|
|
|
|
2018-02-18 11:33:47 +01:00
|
|
|
type StupidGCM struct{}
|
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() {
|
2017-02-24 09:46:10 +01:00
|
|
|
fmt.Fprintln(os.Stderr, "gocryptfs has 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
|
|
|
}
|
|
|
|
|
2018-02-18 11:33:47 +01:00
|
|
|
func New(_ []byte, _ bool) *StupidGCM {
|
2016-10-04 09:51:14 +02:00
|
|
|
errExit()
|
2016-12-10 13:14:20 +01:00
|
|
|
// Never reached
|
2018-02-18 11:33:47 +01:00
|
|
|
return &StupidGCM{}
|
2016-10-04 09:51:14 +02:00
|
|
|
}
|
|
|
|
|
2018-02-18 11:33:47 +01:00
|
|
|
func (g *StupidGCM) NonceSize() int {
|
2016-10-04 09:51:14 +02:00
|
|
|
errExit()
|
2016-12-10 13:14:20 +01:00
|
|
|
return -1
|
2016-10-04 09:51:14 +02:00
|
|
|
}
|
|
|
|
|
2018-02-18 11:33:47 +01:00
|
|
|
func (g *StupidGCM) Overhead() int {
|
2016-10-04 09:51:14 +02:00
|
|
|
errExit()
|
2016-12-10 13:14:20 +01:00
|
|
|
return -1
|
2016-10-04 09:51:14 +02:00
|
|
|
}
|
|
|
|
|
2018-02-18 11:33:47 +01:00
|
|
|
func (g *StupidGCM) Seal(_, _, _, _ []byte) []byte {
|
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
|
|
|
}
|
|
|
|
|
2018-02-18 11:33:47 +01:00
|
|
|
func (g *StupidGCM) Open(_, _, _, _ []byte) ([]byte, error) {
|
2016-10-04 09:51:14 +02:00
|
|
|
errExit()
|
2016-12-10 13:14:20 +01:00
|
|
|
return nil, nil
|
2016-10-04 09:51:14 +02:00
|
|
|
}
|
2018-02-18 11:33:47 +01:00
|
|
|
|
|
|
|
func (g *StupidGCM) Wipe() {
|
|
|
|
errExit()
|
|
|
|
}
|