aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/fs.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-05-28 20:44:54 +0200
committerJakob Unterwurzacher2017-05-28 20:44:54 +0200
commit791c78b203be199960274053ea2b1d44c63b07c6 (patch)
tree82ad692eb25336802edf10f83528182772771df7 /internal/fusefrontend/fs.go
parente2341c93d5b113457905b338b414e41892113ec4 (diff)
fusefrontend: aessiv: enable deterministiv file id and block ivdet
Seems to work ok: $ echo aaaaaaaaaaaaaaaaaaa > b/foo $ gocryptfs-xray a/LAh7EiK-kjleJhStVZ1JGg Header: Version: 2, Id: 8d76d368438112fb00cb807fa8210a74 Block 0: IV: b05bb152f77816678230885d09a4a596, Tag: c1c7d580fe01dd1eb543efd9d8eda8ad, Offset: 18 Len: 52 $ > b/foo $ echo aaaaaaaaaaaaaaaaaaa > b/foo $ gocryptfs-xray a/LAh7EiK-kjleJhStVZ1JGg Header: Version: 2, Id: 8d76d368438112fb00cb807fa8210a74 Block 0: IV: b05bb152f77816678230885d09a4a596, Tag: c1c7d580fe01dd1eb543efd9d8eda8ad, Offset: 18 Len: 52 Deterministic diriv generation is still missing. Part of https://github.com/rfjakob/gocryptfs/issues/108
Diffstat (limited to 'internal/fusefrontend/fs.go')
-rw-r--r--internal/fusefrontend/fs.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go
index c589302..40b6d2d 100644
--- a/internal/fusefrontend/fs.go
+++ b/internal/fusefrontend/fs.go
@@ -100,11 +100,12 @@ func (fs *FS) Open(path string, flags uint32, context *fuse.Context) (fuseFile n
return nil, fuse.EPERM
}
newFlags := fs.mangleOpenFlags(flags)
- cPath, err := fs.getBackingPath(path)
+ cRelPath, err := fs.encryptPath(path)
if err != nil {
- tlog.Debug.Printf("Open: getBackingPath: %v", err)
+ tlog.Debug.Printf("Open: encryptPath: %v", err)
return nil, fuse.ToStatus(err)
}
+ cPath := filepath.Join(fs.args.Cipherdir, cRelPath)
tlog.Debug.Printf("Open: %s", cPath)
f, err := os.OpenFile(cPath, newFlags, 0666)
if err != nil {
@@ -116,8 +117,7 @@ func (fs *FS) Open(path string, flags uint32, context *fuse.Context) (fuseFile n
}
return nil, fuse.ToStatus(err)
}
-
- return NewFile(f, fs)
+ return NewFile(f, fs, cRelPath)
}
// Create implements pathfs.Filesystem.
@@ -126,10 +126,11 @@ func (fs *FS) Create(path string, flags uint32, mode uint32, context *fuse.Conte
return nil, fuse.EPERM
}
newFlags := fs.mangleOpenFlags(flags)
- cPath, err := fs.getBackingPath(path)
+ cRelPath, err := fs.encryptPath(path)
if err != nil {
return nil, fuse.ToStatus(err)
}
+ cPath := filepath.Join(fs.args.Cipherdir, cRelPath)
var fd *os.File
cName := filepath.Base(cPath)
@@ -171,7 +172,7 @@ func (fs *FS) Create(path string, flags uint32, mode uint32, context *fuse.Conte
tlog.Warn.Printf("Create: fd.Chown failed: %v", err)
}
}
- return NewFile(fd, fs)
+ return NewFile(fd, fs, path)
}
// Chmod implements pathfs.Filesystem.