aboutsummaryrefslogtreecommitdiff
path: root/cmd/fscrypt/keys.go
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-05-09 14:52:07 -0700
committerEric Biggers <ebiggers@google.com>2020-05-09 15:21:31 -0700
commit197eb371697aff066947372d10732387454fd88a (patch)
treee14057e5363a48a4cda42b265787cf50fdbee7a6 /cmd/fscrypt/keys.go
parent66fb4c557644ba2c37951a7568c06c47a6c718a7 (diff)
cmd/fscrypt: remove ErrMaxPassphrase
This isn't actually a valid error since crypto.NewKeyFromReader() handles re-allocating the buffer to a larger size if it fills up.
Diffstat (limited to 'cmd/fscrypt/keys.go')
-rw-r--r--cmd/fscrypt/keys.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/fscrypt/keys.go b/cmd/fscrypt/keys.go
index 872ca2a..77e3900 100644
--- a/cmd/fscrypt/keys.go
+++ b/cmd/fscrypt/keys.go
@@ -55,14 +55,14 @@ var (
// struct is empty as the reader needs to maintain no internal state.
type passphraseReader struct{}
-// Read gets input from the terminal until a newline is encountered. This read
-// should be called with the maximum buffer size for the passphrase.
+// Read gets input from the terminal until a newline is encountered or the given
+// buffer is full.
func (p passphraseReader) Read(buf []byte) (int, error) {
// We read one byte at a time to handle backspaces
position := 0
for {
if position == len(buf) {
- return position, ErrMaxPassphrase
+ return position, nil
}
if _, err := io.ReadFull(os.Stdin, buf[position:position+1]); err != nil {
return position, err