From 4cb6e8e530070a393b3143dd9e01bf8d73fe4f09 Mon Sep 17 00:00:00 2001 From: alexmullins Date: Thu, 26 Nov 2015 18:45:48 -0600 Subject: [PATCH] Check for nil Password --- crypto.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto.go b/crypto.go index 11e5212..038a8be 100644 --- a/crypto.go +++ b/crypto.go @@ -278,6 +278,9 @@ func newDecryptionReader(r *io.SectionReader, f *File) (io.Reader, error) { salt := saltpwvv[:saltLen] pwvv := saltpwvv[saltLen : saltLen+2] // generate keys + if f.Password == nil { + return nil, ErrPassword + } decKey, authKey, pwv := generateKeys(f.Password(), salt, keyLen) // check password verifier (pwv) // Change to use crypto/subtle for constant time comparison