summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-06-23 21:56:50 +0200
committerJakob Unterwurzacher2016-06-23 21:56:50 +0200
commit3d59a72ba952602ca046df532fe2a3e8e16f1046 (patch)
treed39845a851156ffcd6d3f41c6007921ae50b690d /internal
parente970b1fdb5963448f8d54d70ae903883605da32d (diff)
Drop deprecated "-emenames" option
The EMENames feature flag is already mandatory, dropping the command line option is the final step.
Diffstat (limited to 'internal')
-rw-r--r--internal/fusefrontend/args.go1
-rw-r--r--internal/fusefrontend/fs.go2
-rw-r--r--internal/nametransform/names.go27
3 files changed, 4 insertions, 26 deletions
diff --git a/internal/fusefrontend/args.go b/internal/fusefrontend/args.go
index 4f77973..32a335d 100644
--- a/internal/fusefrontend/args.go
+++ b/internal/fusefrontend/args.go
@@ -6,7 +6,6 @@ type Args struct {
Cipherdir string
OpenSSL bool
PlaintextNames bool
- EMENames bool
GCMIV128 bool
LongNames bool
}
diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go
index 4342482..1cf6d7c 100644
--- a/internal/fusefrontend/fs.go
+++ b/internal/fusefrontend/fs.go
@@ -38,7 +38,7 @@ func NewFS(args Args) *FS {
cryptoCore := cryptocore.New(args.Masterkey, args.OpenSSL, args.GCMIV128)
contentEnc := contentenc.New(cryptoCore, contentenc.DefaultBS)
- nameTransform := nametransform.New(cryptoCore, args.EMENames, args.LongNames)
+ nameTransform := nametransform.New(cryptoCore, args.LongNames)
return &FS{
FileSystem: pathfs.NewLoopbackFileSystem(args.Cipherdir),
diff --git a/internal/nametransform/names.go b/internal/nametransform/names.go
index 8a7e260..4930488 100644
--- a/internal/nametransform/names.go
+++ b/internal/nametransform/names.go
@@ -4,7 +4,6 @@ package nametransform
import (
"crypto/aes"
- "crypto/cipher"
"encoding/base64"
"fmt"
@@ -15,16 +14,14 @@ import (
type NameTransform struct {
cryptoCore *cryptocore.CryptoCore
- useEME bool
longNames bool
DirIVCache dirIVCache
}
-func New(c *cryptocore.CryptoCore, useEME bool, longNames bool) *NameTransform {
+func New(c *cryptocore.CryptoCore, longNames bool) *NameTransform {
return &NameTransform{
cryptoCore: c,
longNames: longNames,
- useEME: useEME,
}
}
@@ -35,28 +32,18 @@ func New(c *cryptocore.CryptoCore, useEME bool, longNames bool) *NameTransform {
// This function is exported because it allows for a very efficient readdir
// implementation (read IV once, decrypt all names using this function).
func (n *NameTransform) DecryptName(cipherName string, iv []byte) (string, error) {
-
bin, err := base64.URLEncoding.DecodeString(cipherName)
if err != nil {
return "", err
}
-
if len(bin)%aes.BlockSize != 0 {
return "", fmt.Errorf("Decoded length %d is not a multiple of the AES block size", len(bin))
}
-
- if n.useEME {
- bin = eme.Transform(n.cryptoCore.BlockCipher, iv, bin, eme.DirectionDecrypt)
- } else {
- cbc := cipher.NewCBCDecrypter(n.cryptoCore.BlockCipher, iv)
- cbc.CryptBlocks(bin, bin)
- }
-
+ bin = eme.Transform(n.cryptoCore.BlockCipher, iv, bin, eme.DirectionDecrypt)
bin, err = unPad16(bin)
if err != nil {
return "", err
}
-
plain := string(bin)
return plain, err
}
@@ -68,17 +55,9 @@ func (n *NameTransform) DecryptName(cipherName string, iv []byte) (string, error
// This function is exported because fusefrontend needs access to the full (not hashed)
// name if longname is used. Otherwise you should use EncryptPathDirIV()
func (n *NameTransform) EncryptName(plainName string, iv []byte) (cipherName64 string) {
-
bin := []byte(plainName)
bin = pad16(bin)
-
- if n.useEME {
- bin = eme.Transform(n.cryptoCore.BlockCipher, iv, bin, eme.DirectionEncrypt)
- } else {
- cbc := cipher.NewCBCEncrypter(n.cryptoCore.BlockCipher, iv)
- cbc.CryptBlocks(bin, bin)
- }
-
+ bin = eme.Transform(n.cryptoCore.BlockCipher, iv, bin, eme.DirectionEncrypt)
cipherName64 = base64.URLEncoding.EncodeToString(bin)
return cipherName64
}