Switch newDecryptionReader return to io.Reader

This commit is contained in:
alexmullins 2015-11-06 01:01:44 -06:00
parent 119f51e65c
commit 42f3489e0b
1 changed files with 2 additions and 3 deletions

View File

@ -14,7 +14,6 @@ import (
"errors" "errors"
"hash" "hash"
"io" "io"
"io/ioutil"
"golang.org/x/crypto/pbkdf2" "golang.org/x/crypto/pbkdf2"
) )
@ -247,7 +246,7 @@ func generateKeys(password, salt []byte, keySize int) (encKey, authKey, pwv []by
return return
} }
func newDecryptionReader(r *io.SectionReader, f *File) (io.ReadCloser, error) { func newDecryptionReader(r *io.SectionReader, f *File) (io.Reader, error) {
keyLen := aesKeyLen(f.aesStrength) keyLen := aesKeyLen(f.aesStrength)
saltLen := keyLen / 2 // salt is half of key len saltLen := keyLen / 2 // salt is half of key len
if saltLen == 0 { if saltLen == 0 {
@ -280,7 +279,7 @@ func newDecryptionReader(r *io.SectionReader, f *File) (io.ReadCloser, error) {
ar := newAuthReader(authKey, data, authcode, false) ar := newAuthReader(authKey, data, authcode, false)
// return decryption reader // return decryption reader
dr := decryptStream(decKey, ar) dr := decryptStream(decKey, ar)
return ioutil.NopCloser(dr), nil return dr, nil
} }
func decryptStream(key []byte, ciphertext io.Reader) io.Reader { func decryptStream(key []byte, ciphertext io.Reader) io.Reader {