diff options
author | Richard Levitte <levitte@openssl.org> | 2019-08-22 13:34:16 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-08-22 14:47:22 +0200 |
commit | 8ed7bbb411d2a9e0edef928958ad955e0be3d6dd (patch) | |
tree | 37ab90b9e9af508a93be54e3af03f4cfbd41a866 /crypto/blake2 | |
parent | a45eb7e8918f055115e0a1f206f8b74a2ed06dc6 (diff) |
openssl dgst, openssl enc: check for end of input
The input reading loop in 'openssl dgst' and 'openssl enc' doesn't
check for end of input, and because of the way BIO works, it thereby
won't detect that the end is reached before the read is an error.
With the FILE BIO, an error occurs when trying to read past EOF, which
is fairly much ok, except when the command is used interactively, at
least on Unix. The result in that case is that the user has to press
Ctrl-D twice for the command to terminate.
The issue is further complicated because both these commands use
filter BIOs on top of the FILE BIO, so a naïve attempt to check
BIO_eof() doesn't quite solve it, since that only checks the state of
the source/sink BIO, and the filter BIO may have some buffered data
that still needs to be read. Fortunately, there's BIO_pending() that
checks exactly that, if any filter BIO has pending data that needs to
be processed.
We end up having to check both BIO_pending() and BIO_eof().
Thanks to Zsigmond Lőrinczy for the initial effort and inspiration.
Fixes #9355
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/9668)
Diffstat (limited to 'crypto/blake2')
0 files changed, 0 insertions, 0 deletions