docs: private int nextChunk() throws IOException {
          abortIfNeeded();
          if (eof)
              return -1;
          bufout = null;
          int len = in.read(bufin);
          if (len == -1) {
              eof = true;
              // Skip doFinal if it's a multi-part upload but not the last part 
              if (!multipart || lastMultiPart) {
                  try {
                      bufout = cipherLite.doFinal();
                      if (bufout == null) {
                          // bufout can be null, for example, when it was the
                          // javax.crypto.NullCipher 
                          return -1;
                      }
                      curr_pos = 0;
                      return max_pos = bufout.length;
                  } catch (IllegalBlockSizeException ignore) {
                      // like the RI
                  } catch (BadPaddingException e) {
                      if (S3CryptoScheme.isAesGcm(cipherLite.getCipherAlgorithm()))
                          throw new SecurityException(e);
                  }
              }
              return -1;
          }
          bufout = cipherLite.update(bufin, 0, len);
          curr_pos = 0;
          return max_pos = (bufout == null ? 0 : bufout.length);
      }