summaryrefslogtreecommitdiff
path: root/internal/nametransform
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-06-16 19:02:47 +0200
committerJakob Unterwurzacher2016-06-16 19:02:47 +0200
commit7e92ebe16a7735b29e0fdc62d4b5d49ce0dc2b66 (patch)
treec38b46c98ec73ea6ee48b3e6ab9569f249200e81 /internal/nametransform
parent6c3f97399a01a2d8480b39978209099335efbf7d (diff)
Rename nametransform, contentenc source files
Let's have shorter names, and merge *_api.go into the "main" file. No code changes.
Diffstat (limited to 'internal/nametransform')
-rw-r--r--internal/nametransform/diriv.go (renamed from internal/nametransform/names_diriv.go)0
-rw-r--r--internal/nametransform/name_api.go18
-rw-r--r--internal/nametransform/names.go (renamed from internal/nametransform/names_core.go)27
-rw-r--r--internal/nametransform/noiv.go (renamed from internal/nametransform/names_noiv.go)0
4 files changed, 23 insertions, 22 deletions
diff --git a/internal/nametransform/names_diriv.go b/internal/nametransform/diriv.go
index b9473aa..b9473aa 100644
--- a/internal/nametransform/names_diriv.go
+++ b/internal/nametransform/diriv.go
diff --git a/internal/nametransform/name_api.go b/internal/nametransform/name_api.go
deleted file mode 100644
index 7ac7d26..0000000
--- a/internal/nametransform/name_api.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package nametransform
-
-import "github.com/rfjakob/gocryptfs/internal/cryptocore"
-
-type NameTransform struct {
- cryptoCore *cryptocore.CryptoCore
- useEME bool
- longNames bool
- DirIVCache dirIVCache
-}
-
-func New(c *cryptocore.CryptoCore, useEME bool, longNames bool) *NameTransform {
- return &NameTransform{
- cryptoCore: c,
- longNames: longNames,
- useEME: useEME,
- }
-}
diff --git a/internal/nametransform/names_core.go b/internal/nametransform/names.go
index 779b885..8a7e260 100644
--- a/internal/nametransform/names_core.go
+++ b/internal/nametransform/names.go
@@ -9,10 +9,28 @@ import (
"fmt"
"github.com/rfjakob/eme"
+
+ "github.com/rfjakob/gocryptfs/internal/cryptocore"
)
+type NameTransform struct {
+ cryptoCore *cryptocore.CryptoCore
+ useEME bool
+ longNames bool
+ DirIVCache dirIVCache
+}
+
+func New(c *cryptocore.CryptoCore, useEME bool, longNames bool) *NameTransform {
+ return &NameTransform{
+ cryptoCore: c,
+ longNames: longNames,
+ useEME: useEME,
+ }
+}
+
// DecryptName - decrypt base64-encoded encrypted filename "cipherName"
-// The used encryption is either CBC or EME, depending on "useEME".
+// Used by DecryptPathDirIV().
+// The encryption is either CBC or EME, depending on "useEME".
//
// This function is exported because it allows for a very efficient readdir
// implementation (read IV once, decrypt all names using this function).
@@ -43,11 +61,12 @@ func (n *NameTransform) DecryptName(cipherName string, iv []byte) (string, error
return plain, err
}
-// encryptName - encrypt "plainName", return base64-encoded "cipherName64"
-// The used encryption is either CBC or EME, depending on "useEME".
+// encryptName - encrypt "plainName", return base64-encoded "cipherName64".
+// Used internally by EncryptPathDirIV().
+// The encryption is either CBC or EME, depending on "useEME".
//
// This function is exported because fusefrontend needs access to the full (not hashed)
-// name if longname is used
+// name if longname is used. Otherwise you should use EncryptPathDirIV()
func (n *NameTransform) EncryptName(plainName string, iv []byte) (cipherName64 string) {
bin := []byte(plainName)
diff --git a/internal/nametransform/names_noiv.go b/internal/nametransform/noiv.go
index f1009e4..f1009e4 100644
--- a/internal/nametransform/names_noiv.go
+++ b/internal/nametransform/noiv.go