parent
ab4de4cbcd
commit
aeda9721d0
@ -116,12 +116,12 @@ func parseCliOpts() (args argContainer) {
|
|||||||
"Setting this to a lower value speeds up mounting but makes the password susceptible to brute-force attacks")
|
"Setting this to a lower value speeds up mounting but makes the password susceptible to brute-force attacks")
|
||||||
// Ignored otions
|
// Ignored otions
|
||||||
var dummyBool bool
|
var dummyBool bool
|
||||||
ignoreText := "(ignored for compatability)"
|
ignoreText := "(ignored for compatibility)"
|
||||||
flagSet.BoolVar(&dummyBool, "rw", false, ignoreText)
|
flagSet.BoolVar(&dummyBool, "rw", false, ignoreText)
|
||||||
flagSet.BoolVar(&dummyBool, "nosuid", false, ignoreText)
|
flagSet.BoolVar(&dummyBool, "nosuid", false, ignoreText)
|
||||||
flagSet.BoolVar(&dummyBool, "nodev", false, ignoreText)
|
flagSet.BoolVar(&dummyBool, "nodev", false, ignoreText)
|
||||||
var dummyString string
|
var dummyString string
|
||||||
flagSet.StringVar(&dummyString, "o", "", "For compatability, all options can be also passed as a comma-separated list to -o.")
|
flagSet.StringVar(&dummyString, "o", "", "For compatibility, all options can be also passed as a comma-separated list to -o.")
|
||||||
// Actual parsing
|
// Actual parsing
|
||||||
err = flagSet.Parse(os.Args[1:])
|
err = flagSet.Parse(os.Args[1:])
|
||||||
if err == flag.ErrHelp {
|
if err == flag.ErrHelp {
|
||||||
|
@ -16,7 +16,7 @@ func TestCryptoCoreNew(t *testing.T) {
|
|||||||
if c.IVLen != 12 {
|
if c.IVLen != 12 {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
// "New(key, BackendGoGCM, 128)" is tested for Go 1.4 and 1.5+ seperately
|
// "New(key, BackendGoGCM, 128)" is tested for Go 1.4 and 1.5+ separately
|
||||||
}
|
}
|
||||||
|
|
||||||
// "New" should panic on any key not 32 bytes long
|
// "New" should panic on any key not 32 bytes long
|
||||||
|
@ -212,7 +212,7 @@ func (f *file) Read(buf []byte, off int64) (resultData fuse.ReadResult, code fus
|
|||||||
// doWrite - encrypt "data" and write it to plaintext offset "off"
|
// doWrite - encrypt "data" and write it to plaintext offset "off"
|
||||||
//
|
//
|
||||||
// Arguments do not have to be block-aligned, read-modify-write is
|
// Arguments do not have to be block-aligned, read-modify-write is
|
||||||
// performed internally as neccessary
|
// performed internally as necessary
|
||||||
//
|
//
|
||||||
// Called by Write() for normal writing,
|
// Called by Write() for normal writing,
|
||||||
// and by Truncate() to rewrite the last file block.
|
// and by Truncate() to rewrite the last file block.
|
||||||
|
@ -175,7 +175,7 @@ func (f *file) statPlainSize() (uint64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// truncateGrowFile extends a file using seeking or ftruncate performing RMW on
|
// truncateGrowFile extends a file using seeking or ftruncate performing RMW on
|
||||||
// the first and last block as neccessary. New blocks in the middle become
|
// the first and last block as necessary. New blocks in the middle become
|
||||||
// file holes unless they have been fallocate()'d beforehand.
|
// file holes unless they have been fallocate()'d beforehand.
|
||||||
func (f *file) truncateGrowFile(oldPlainSz uint64, newPlainSz uint64) fuse.Status {
|
func (f *file) truncateGrowFile(oldPlainSz uint64, newPlainSz uint64) fuse.Status {
|
||||||
if newPlainSz <= oldPlainSz {
|
if newPlainSz <= oldPlainSz {
|
||||||
|
@ -30,7 +30,7 @@ const (
|
|||||||
|
|
||||||
// derivePathIV derives an IV from an encrypted path by hashing it with sha256
|
// derivePathIV derives an IV from an encrypted path by hashing it with sha256
|
||||||
func derivePathIV(path string, purpose ivPurposeType) []byte {
|
func derivePathIV(path string, purpose ivPurposeType) []byte {
|
||||||
// Use null byte as separator as it cannot occour in the path
|
// Use null byte as separator as it cannot occur in the path
|
||||||
extended := []byte(path + "\000" + string(purpose))
|
extended := []byte(path + "\000" + string(purpose))
|
||||||
hash := sha256.Sum256(extended)
|
hash := sha256.Sum256(extended)
|
||||||
return hash[:nametransform.DirIVLen]
|
return hash[:nametransform.DirIVLen]
|
||||||
|
@ -49,7 +49,7 @@ func ReadDirIVAt(dirfd *os.File) (iv []byte, err error) {
|
|||||||
// fdReadDirIV reads and verifies the DirIV from an opened gocryptfs.diriv file.
|
// fdReadDirIV reads and verifies the DirIV from an opened gocryptfs.diriv file.
|
||||||
func fdReadDirIV(fd *os.File) (iv []byte, err error) {
|
func fdReadDirIV(fd *os.File) (iv []byte, err error) {
|
||||||
// We want to detect if the file is bigger than DirIVLen, so
|
// We want to detect if the file is bigger than DirIVLen, so
|
||||||
// make the buffer 1 byte bigger than neccessary.
|
// make the buffer 1 byte bigger than necessary.
|
||||||
iv = make([]byte, DirIVLen+1)
|
iv = make([]byte, DirIVLen+1)
|
||||||
n, err := fd.Read(iv)
|
n, err := fd.Read(iv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Send signal USR1 to "pid" (usually our parent process). This notifies it
|
// Send signal USR1 to "pid" (usually our parent process). This notifies it
|
||||||
// that the mounting has completed sucessfully.
|
// that the mounting has completed successfully.
|
||||||
func sendUsr1(pid int) {
|
func sendUsr1(pid int) {
|
||||||
p, err := os.FindProcess(pid)
|
p, err := os.FindProcess(pid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -32,7 +32,7 @@ func TestFlags(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if !cf.IsFeatureFlagSet(configfile.FlagPlaintextNames) {
|
if !cf.IsFeatureFlagSet(configfile.FlagPlaintextNames) {
|
||||||
t.Error("PlaintextNames flag should be set but isnt")
|
t.Error("PlaintextNames flag should be set but isn't")
|
||||||
}
|
}
|
||||||
if cf.IsFeatureFlagSet(configfile.FlagEMENames) || cf.IsFeatureFlagSet(configfile.FlagDirIV) {
|
if cf.IsFeatureFlagSet(configfile.FlagEMENames) || cf.IsFeatureFlagSet(configfile.FlagDirIV) {
|
||||||
t.Error("FlagEMENames and FlagDirIV should be not set")
|
t.Error("FlagEMENames and FlagDirIV should be not set")
|
||||||
|
Loading…
Reference in New Issue
Block a user