nametransform: delete unused function DecryptPathDirIV
This commit is contained in:
parent
abd61d968d
commit
c7b3150afc
@ -50,13 +50,3 @@ func (fs *FS) encryptPath(plainPath string) (string, error) {
|
||||
fs.dirIVLock.RUnlock()
|
||||
return cPath, err
|
||||
}
|
||||
|
||||
// decryptPath - decrypt relative ciphertext path
|
||||
func (fs *FS) decryptPath(cipherPath string) (string, error) {
|
||||
if fs.args.PlaintextNames {
|
||||
return cipherPath, nil
|
||||
}
|
||||
fs.dirIVLock.RLock()
|
||||
defer fs.dirIVLock.RUnlock()
|
||||
return fs.nameTransform.DecryptPathDirIV(cipherPath, fs.args.Cipherdir)
|
||||
}
|
||||
|
@ -123,27 +123,3 @@ func (be *NameTransform) EncryptPathDirIV(plainPath string, rootDir string) (cip
|
||||
be.DirIVCache.store(parentDir, iv, cParentDir)
|
||||
return cipherPath, nil
|
||||
}
|
||||
|
||||
// DecryptPathDirIV - decrypt path using EME with DirIV
|
||||
//
|
||||
// TODO This has only a single user, Readlink(), and only for compatability with
|
||||
// gocryptfs v0.5. Drop?
|
||||
func (be *NameTransform) DecryptPathDirIV(encryptedPath string, rootDir string) (string, error) {
|
||||
var wd = rootDir
|
||||
var plainNames []string
|
||||
encryptedNames := strings.Split(encryptedPath, "/")
|
||||
tlog.Debug.Printf("DecryptPathDirIV: decrypting %v\n", encryptedNames)
|
||||
for _, encryptedName := range encryptedNames {
|
||||
iv, err := ReadDirIV(wd)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
plainName, err := be.DecryptName(encryptedName, iv)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
plainNames = append(plainNames, plainName)
|
||||
wd = filepath.Join(wd, encryptedName)
|
||||
}
|
||||
return filepath.Join(plainNames...), nil
|
||||
}
|
||||
|
@ -26,8 +26,6 @@ func New(c *cryptocore.CryptoCore, longNames bool) *NameTransform {
|
||||
}
|
||||
|
||||
// DecryptName - decrypt base64-encoded encrypted filename "cipherName"
|
||||
// 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).
|
||||
|
Loading…
Reference in New Issue
Block a user