diff options
Diffstat (limited to 'internal/configfile')
-rw-r--r-- | internal/configfile/config_file.go | 25 | ||||
-rw-r--r-- | internal/configfile/config_test.go | 12 |
2 files changed, 1 insertions, 36 deletions
diff --git a/internal/configfile/config_file.go b/internal/configfile/config_file.go index c1f93af..951dce8 100644 --- a/internal/configfile/config_file.go +++ b/internal/configfile/config_file.go @@ -5,9 +5,7 @@ package configfile import ( "encoding/json" "fmt" - "io" "io/ioutil" - "log" "syscall" "os" @@ -61,21 +59,6 @@ type ConfFile struct { filename string } -// randBytesDevRandom gets "n" random bytes from /dev/random or panics -func randBytesDevRandom(n int) []byte { - f, err := os.Open("/dev/random") - if err != nil { - log.Panic("Failed to open /dev/random: " + err.Error()) - } - defer f.Close() - b := make([]byte, n) - _, err = io.ReadFull(f, b) - if err != nil { - log.Panic("Failed to read random bytes: " + err.Error()) - } - return b -} - // CreateArgs exists because the argument list to Create became too long. type CreateArgs struct { Filename string @@ -84,7 +67,6 @@ type CreateArgs struct { LogN int Creator string AESSIV bool - Devrandom bool Fido2CredentialID []byte Fido2HmacSalt []byte DeterministicNames bool @@ -136,12 +118,7 @@ func Create(args *CreateArgs) error { } { // Generate new random master key - var key []byte - if args.Devrandom { - key = randBytesDevRandom(cryptocore.KeyLen) - } else { - key = cryptocore.RandBytes(cryptocore.KeyLen) - } + key := cryptocore.RandBytes(cryptocore.KeyLen) tlog.PrintMasterkeyReminder(key) // Encrypt it using the password // This sets ScryptObject and EncryptedKey diff --git a/internal/configfile/config_test.go b/internal/configfile/config_test.go index 021b6c1..b8012d3 100644 --- a/internal/configfile/config_test.go +++ b/internal/configfile/config_test.go @@ -86,18 +86,6 @@ func TestCreateConfDefault(t *testing.T) { } } -func TestCreateConfDevRandom(t *testing.T) { - err := Create(&CreateArgs{ - Filename: "config_test/tmp.conf", - Password: testPw, - LogN: 10, - Creator: "test", - Devrandom: true}) - if err != nil { - t.Fatal(err) - } -} - func TestCreateConfPlaintextnames(t *testing.T) { err := Create(&CreateArgs{ Filename: "config_test/tmp.conf", |