aboutsummaryrefslogtreecommitdiff
path: root/cryptfs/names_diriv.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-11-29 19:57:48 +0100
committerJakob Unterwurzacher2015-11-29 20:03:37 +0100
commit1d0a442405e8fc7a0742a8f8db2ea0f874f750a5 (patch)
treeb2ff9e44da9792f7a0abbc9abdf99f6a6e2cef2e /cryptfs/names_diriv.go
parent6f764b386786b92023fa696594105f702226b3ff (diff)
OpenDir performance: Read DirIV once and reuse it for all names
Formerly, we called decryptPath for every name. That resulted in a directory walk that reads in all diriv files on the way. Massive improvement for RM and LS (check performance.txt for details) VERSION UNTAR RM LS v0.4 48 5 1.5 v0.5-rc1 56 19 7 v0.5-rc1-1 54 9 4.1 <---- THIS VERSION
Diffstat (limited to 'cryptfs/names_diriv.go')
-rw-r--r--cryptfs/names_diriv.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/cryptfs/names_diriv.go b/cryptfs/names_diriv.go
index be7a2b1..ae8545b 100644
--- a/cryptfs/names_diriv.go
+++ b/cryptfs/names_diriv.go
@@ -7,8 +7,8 @@ import (
"strings"
)
-// readDirIV - read the "gocryptfs.diriv" file from "dir" (absolute path)
-func (be *CryptFS) readDirIV(dir string) (iv []byte, err error) {
+// readDirIV - read the "gocryptfs.diriv" file from "dir" (absolute ciphertext path)
+func (be *CryptFS) ReadDirIV(dir string) (iv []byte, err error) {
ivfile := filepath.Join(dir, DIRIV_FILENAME)
Debug.Printf("readDirIV: reading %s\n", ivfile)
iv, err = ioutil.ReadFile(ivfile)
@@ -22,7 +22,7 @@ func (be *CryptFS) readDirIV(dir string) (iv []byte, err error) {
return iv, nil
}
-// WriteDirIV - create diriv file inside "dir" (absolute path)
+// WriteDirIV - create diriv file inside "dir" (absolute ciphertext path)
// This function is exported because it is used from pathfs_frontend, main,
// and also the automated tests.
func WriteDirIV(dir string) error {
@@ -45,7 +45,7 @@ func (be *CryptFS) EncryptPathDirIV(plainPath string, rootDir string) (string, e
var encryptedNames []string
plainNames := strings.Split(plainPath, "/")
for _, plainName := range plainNames {
- iv, err := be.readDirIV(wd)
+ iv, err := be.ReadDirIV(wd)
if err != nil {
return "", err
}
@@ -66,11 +66,11 @@ func (be *CryptFS) DecryptPathDirIV(encryptedPath string, rootDir string) (strin
encryptedNames := strings.Split(encryptedPath, "/")
Debug.Printf("DecryptPathDirIV: decrypting %v\n", encryptedNames)
for _, encryptedName := range encryptedNames {
- iv, err := be.readDirIV(wd)
+ iv, err := be.ReadDirIV(wd)
if err != nil {
return "", err
}
- plainName, err := be.decryptName(encryptedName, iv)
+ plainName, err := be.DecryptName(encryptedName, iv)
if err != nil {
return "", err
}