]> git.apps.os.sepia.ceph.com Git - fscrypt.git/commitdiff
cmd/fscrypt: remove ErrMaxPassphrase
authorEric Biggers <ebiggers@google.com>
Sat, 9 May 2020 21:52:07 +0000 (14:52 -0700)
committerEric Biggers <ebiggers@google.com>
Sat, 9 May 2020 22:21:31 +0000 (15:21 -0700)
This isn't actually a valid error since crypto.NewKeyFromReader()
handles re-allocating the buffer to a larger size if it fills up.

cmd/fscrypt/errors.go
cmd/fscrypt/keys.go

index ef4ae640de94f89751d492084835c0b72462a25b..4ce45045f085751ac7450961b5d2a5a125a87934 100644 (file)
@@ -47,7 +47,6 @@ const failureExitCode = 1
 var (
        ErrCanceled           = errors.New("operation canceled")
        ErrNoDestructiveOps   = errors.New("operation would be destructive")
-       ErrMaxPassphrase      = util.SystemError("max passphrase length exceeded")
        ErrInvalidSource      = errors.New("invalid source type")
        ErrPassphraseMismatch = errors.New("entered passphrases do not match")
        ErrSpecifyProtector   = errors.New("multiple protectors available")
index 872ca2a2317937b876535936a7b33183d9b6a9cb..77e3900acff27e57aaf4d8536bc3a176c242d4e5 100644 (file)
@@ -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