From fe7355f9ee4ae8e52a9b76202e90032d78824f21 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Fri, 27 Nov 2015 23:34:55 +0100 Subject: diriv: use "DirIV" flag to discern and support mounting old filesystems --- cryptfs/config_file.go | 3 +++ cryptfs/names_diriv.go | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'cryptfs') diff --git a/cryptfs/config_file.go b/cryptfs/config_file.go index 1e7e3b3..a0ab218 100644 --- a/cryptfs/config_file.go +++ b/cryptfs/config_file.go @@ -47,8 +47,11 @@ func CreateConfFile(filename string, password string, plaintextNames bool) error // This sets ScryptObject and EncryptedKey cf.EncryptKey(key, password) + // Set defaults cf.Version = HEADER_CURRENT_VERSION + cf.FeatureFlags = []string{FlagDirIV} + // Set values chosen by the user if plaintextNames { cf.FeatureFlags = append(cf.FeatureFlags, FlagPlaintextNames) } diff --git a/cryptfs/names_diriv.go b/cryptfs/names_diriv.go index ab039f0..6346bc2 100644 --- a/cryptfs/names_diriv.go +++ b/cryptfs/names_diriv.go @@ -22,8 +22,9 @@ func (be *CryptFS) readDirIV(dir string) (iv []byte, err error) { } // WriteDirIV - create diriv file inside "dir" (absolute path) -// This function is exported because it is used from pathfs_frontend -func (be *CryptFS) WriteDirIV(dir string) error { +// This function is exported because it is used from pathfs_frontend, main, +// and also the automated tests. +func WriteDirIV(dir string) error { iv := RandBytes(DIRIV_LEN) file := filepath.Join(dir, DIRIV_FILENAME) // 0444 permissions: the file is not secret but should not be written to -- cgit v1.2.3