diff options
| author | Jakob Unterwurzacher | 2016-07-03 15:35:58 +0200 | 
|---|---|---|
| committer | Jakob Unterwurzacher | 2016-07-03 15:35:58 +0200 | 
| commit | e574a6cc1f053a16158bd228cf0ec9c6b255ad09 (patch) | |
| tree | 5964982fa8f93b1e24be1f8a229ff7e197501fd2 /internal/nametransform | |
| parent | d5b7eb33daec612626305c961b7ec6d5eccd79a7 (diff) | |
nametransform: hide detailed padding error behind the debug flag
unPad16 returns detailed errors including the position of the
incorrect bytes. Kill a possible padding oracle by lumping
everything into a generic error.
The detailed error is only logged if debug is active.
Diffstat (limited to 'internal/nametransform')
| -rw-r--r-- | internal/nametransform/names.go | 7 | 
1 files changed, 6 insertions, 1 deletions
| diff --git a/internal/nametransform/names.go b/internal/nametransform/names.go index 4930488..89ce0db 100644 --- a/internal/nametransform/names.go +++ b/internal/nametransform/names.go @@ -10,6 +10,7 @@ import (  	"github.com/rfjakob/eme"  	"github.com/rfjakob/gocryptfs/internal/cryptocore" +	"github.com/rfjakob/gocryptfs/internal/tlog"  )  type NameTransform struct { @@ -42,7 +43,11 @@ func (n *NameTransform) DecryptName(cipherName string, iv []byte) (string, error  	bin = eme.Transform(n.cryptoCore.BlockCipher, iv, bin, eme.DirectionDecrypt)  	bin, err = unPad16(bin)  	if err != nil { -		return "", err +		tlog.Debug.Printf("pad16 error detail: %v", err) +		// unPad16 returns detailed errors including the position of the +		// incorrect bytes. Kill the padding oracle by lumping everything into +		// a generic error. +		return "", fmt.Errorf("Invalid padding")  	}  	plain := string(bin)  	return plain, err | 
