openssl/apps
Richard Levitte 8ed7bbb411 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)
2019-08-22 14:47:22 +02:00
..
demoSRP Remove unnecessary trailing whitespace 2019-02-05 16:25:11 +01:00
include Remove HEADER_X509_H and HEADER_SSL_H include detectors from apps 2019-07-24 15:48:53 +02:00
app_rand.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
apps.c Replace FUNCerr with ERR_raise_data 2019-08-02 11:41:54 +02:00
apps_ui.c Updated test command line parsing to support commmon commands 2019-02-11 15:31:51 +01:00
asn1pars.c asn1parse: avoid double free 2019-04-18 19:20:55 +02:00
bf_prefix.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
build.info Move the code for 'openssl list' to its own translation unit. 2019-07-15 07:00:29 +02:00
ca-cert.srl
ca-key.pem Fix verify(1) to report failure when verification fails 2016-01-13 17:55:17 -05:00
ca-req.pem Fix verify(1) to report failure when verification fails 2016-01-13 17:55:17 -05:00
ca.c Support SM2 certificate signing 2019-06-28 18:58:19 +08:00
CA.pl.in Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
cert.pem
ciphers.c Use fixed length for formatting standard cipher names 2019-05-27 07:22:45 +10:00
client.pem Replace expired test server and client certificates with new ones. 2011-12-08 14:44:05 +00:00
cms.c CAdES: Fix SignerInfo attribute construction order. 2019-05-29 11:14:46 +10:00
columns.c Move the code for 'openssl list' to its own translation unit. 2019-07-15 07:00:29 +02:00
crl.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
crl2p7.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
ct_log_list.cnf Remove unnecessary trailing whitespace 2019-02-05 16:25:11 +01:00
dgst.c openssl dgst, openssl enc: check for end of input 2019-08-22 14:47:22 +02:00
dh1024.pem Remove unnecessary trailing whitespace 2019-02-05 16:25:11 +01:00
dh2048.pem Remove unnecessary trailing whitespace 2019-02-05 16:25:11 +01:00
dh4096.pem Remove unnecessary trailing whitespace 2019-02-05 16:25:11 +01:00
dhparam.c Change DH parameters to generate the order q subgroup instead of 2q 2019-07-22 20:03:27 +02:00
dsa-ca.pem Fix verify(1) to report failure when verification fails 2016-01-13 17:55:17 -05:00
dsa-pca.pem Fix verify(1) to report failure when verification fails 2016-01-13 17:55:17 -05:00
dsa.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
dsa512.pem
dsa1024.pem
dsap.pem
dsaparam.c gendsa: dsaparam: introduce -verbose option to enable output 2019-05-01 16:41:49 +10:00
ec.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
ecparam.c Make the EC code available from inside the FIPS provider 2019-08-06 11:19:07 +01:00
enc.c openssl dgst, openssl enc: check for end of input 2019-08-22 14:47:22 +02:00
engine.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
errstr.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
fmt.c Updated test command line parsing to support commmon commands 2019-02-11 15:31:51 +01:00
gendsa.c gendsa: dsaparam: introduce -verbose option to enable output 2019-05-01 16:41:49 +10:00
genpkey.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
genrsa.c genrsa: introduce -verbose option to enable output 2019-05-01 16:02:56 +10:00
info.c Coverity CID 1444950: Control flow issues 2019-05-08 09:52:58 +10:00
kdf.c Added app for EVP_KDF 2019-04-24 11:56:47 +02:00
list.c Re-implement 'openssl list -mac-algorithms' 2019-08-15 22:12:25 +02:00
mac.c Adapt apps/mac.c to use provider based MACs 2019-08-15 22:12:25 +02:00
nseq.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
ocsp.c Actually silently ignore GET / OCSP requests 2019-07-16 06:11:15 -04:00
openssl-vms.cnf Remove unnecessary trailing whitespace 2019-02-05 16:25:11 +01:00
openssl.c Remove HEADER_X509_H and HEADER_SSL_H include detectors from apps 2019-07-24 15:48:53 +02:00
openssl.cnf Remove unnecessary trailing whitespace 2019-02-05 16:25:11 +01:00
opt.c Remove NextStep support 2019-07-01 13:32:46 -04:00
passwd.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
pca-cert.srl
pca-key.pem Fix verify(1) to report failure when verification fails 2016-01-13 17:55:17 -05:00
pca-req.pem Fix verify(1) to report failure when verification fails 2016-01-13 17:55:17 -05:00
pkcs7.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
pkcs8.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
pkcs12.c Fix Typos 2019-07-02 14:22:29 +02:00
pkey.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
pkeyparam.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
pkeyutl.c coverity resource leak fixes in apps/pkeyutl 2019-04-08 10:21:22 +10:00
prime.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
privkey.pem
progs.c Refactor apps/progs.* to be generate with 'make update' 2019-07-15 07:00:29 +02:00
progs.h Refactor apps/progs.* to be generate with 'make update' 2019-07-15 07:00:29 +02:00
progs.pl Refactor apps/progs.* to be generate with 'make update' 2019-07-15 07:00:29 +02:00
rand.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
rehash.c Cleanup vxworks support to be able to compile for VxWorks 7 2019-01-24 17:55:04 +01:00
req.c Avoid NULL pointer dereference. Fixes #9043. 2019-07-08 20:14:50 +10:00
req.pem
rsa.c Remove function name from errors 2019-07-16 05:26:28 +02:00
rsa8192.pem
rsautl.c Use vxRandLib for VxWorks7 2019-05-02 23:32:44 +02:00
s512-key.pem
s512-req.pem
s1024key.pem
s1024req.pem
s_cb.c Remove heartbeats completely 2019-03-29 13:50:59 +01:00
s_client.c remove end of line spaces 2019-07-16 20:35:42 +10:00
s_server.c Get rid of using deprecated function isascii 2019-08-19 20:52:25 +03:00
s_socket.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
s_time.c Remove NextStep support 2019-07-01 13:32:46 -04:00
server.pem Replace expired test server and client certificates with new ones. 2011-12-08 14:44:05 +00:00
server.srl
server2.pem Replace expired test server and client certificates with new ones. 2011-12-08 14:44:05 +00:00
sess_id.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
smime.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
speed.c Remove function name from errors 2019-07-16 05:26:28 +02:00
spkac.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
srp.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
storeutl.c Fix Typos 2019-07-02 14:22:29 +02:00
testCA.pem
testdsa.h Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
testrsa.h Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
timeouts.h Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
ts.c ts: Use sha256 as default digest for TS query 2019-06-12 11:45:57 +02:00
tsget.in apps/tsget.in: use the full version in the user agent string 2018-12-10 20:09:17 +01:00
verify.c Coverity fixes 2019-06-06 09:34:17 +10:00
version.c Avoid trailing space in "openssl version -o". 2019-05-23 10:28:02 +10:00
vms_decc_argv.c testutil: ensure good treatment of argv on non-Unix platforms 2019-03-05 08:53:19 +01:00
vms_decc_init.c VMS: move copy_argc to its own module and make it an aux source 2019-03-05 08:51:09 +01:00
vms_term_sock.c Remove tab characters from C source files. 2019-07-16 20:24:10 +10:00
vms_term_sock.h Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
win32_init.c Following the license change, modify the boilerplates in apps/ 2018-12-06 14:15:27 +01:00
x509.c Add -new and -subj options to x509 app for direct cert generation 2019-03-19 09:35:03 +10:00