aboutsummaryrefslogtreecommitdiff
path: root/internal/configfile/scrypt.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-05-07 22:15:01 +0200
committerJakob Unterwurzacher2017-05-07 22:16:22 +0200
commitd5adde1eeb13ba377f7c05b9f21893c01f61ec16 (patch)
tree011813ca5afd81ae6311bb007f5dc10ef69b2e7a /internal/configfile/scrypt.go
parentad7942f434fea567f24458e67a0919291b5ec8dd (diff)
exitcodes: pull all exit code definitions into the package
This commit defines all exit codes in one place in the exitcodes package. Also, it adds a test to verify the exit code on incorrect password, which is what SiriKali cares about the most. Fixes https://github.com/rfjakob/gocryptfs/issues/77 .
Diffstat (limited to 'internal/configfile/scrypt.go')
-rw-r--r--internal/configfile/scrypt.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/internal/configfile/scrypt.go b/internal/configfile/scrypt.go
index 0646754..b5a3edb 100644
--- a/internal/configfile/scrypt.go
+++ b/internal/configfile/scrypt.go
@@ -8,6 +8,7 @@ import (
"golang.org/x/crypto/scrypt"
"github.com/rfjakob/gocryptfs/internal/cryptocore"
+ "github.com/rfjakob/gocryptfs/internal/exitcodes"
"github.com/rfjakob/gocryptfs/internal/tlog"
)
@@ -84,22 +85,22 @@ func (s *ScryptKDF) validateParams() {
minN := 1 << scryptMinLogN
if s.N < minN {
tlog.Fatal.Println("Fatal: scryptn below 10 is too low to make sense")
- os.Exit(1)
+ os.Exit(exitcodes.ScryptParams)
}
if s.R < scryptMinR {
tlog.Fatal.Printf("Fatal: scrypt parameter R below minimum: value=%d, min=%d", s.R, scryptMinR)
- os.Exit(1)
+ os.Exit(exitcodes.ScryptParams)
}
if s.P < scryptMinP {
tlog.Fatal.Printf("Fatal: scrypt parameter P below minimum: value=%d, min=%d", s.P, scryptMinP)
- os.Exit(1)
+ os.Exit(exitcodes.ScryptParams)
}
if len(s.Salt) < scryptMinSaltLen {
tlog.Fatal.Printf("Fatal: scrypt salt length below minimum: value=%d, min=%d", len(s.Salt), scryptMinSaltLen)
- os.Exit(1)
+ os.Exit(exitcodes.ScryptParams)
}
if s.KeyLen < cryptocore.KeyLen {
tlog.Fatal.Printf("Fatal: scrypt parameter KeyLen below minimum: value=%d, min=%d", len(s.Salt), cryptocore.KeyLen)
- os.Exit(1)
+ os.Exit(exitcodes.ScryptParams)
}
}