openssl/apps
Richard Levitte 8be96f2369 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)

(cherry picked from commit 8ed7bbb411)
2019-08-22 14:48:06 +02:00
..
demoSRP Remove unnecessary trailing whitespace 2019-02-05 16:29:17 +01:00
app_rand.c Update copyright year 2018-11-20 13:27:36 +00:00
apps.c Remove HEADER_X509_H include detector from apps 2019-07-24 17:08:38 +02:00
apps.h Remove HEADER_X509_H include detector from apps 2019-07-24 17:08:38 +02:00
asn1pars.c Update copyright year 2019-05-28 14:49:38 +02:00
bf_prefix.c Fix of prefix bio filter (bf_prefix.c): rely on the given length 2018-02-01 22:09:41 +01:00
build.info Make sure the 'tsget' script is called 'tsget.pl' everywhere 2018-07-23 18:33:48 +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 apps/ca.c: only output DER with SPKAC input and when -out is chosen 2019-06-10 22:00:20 +02:00
CA.pl.in Update copyright year 2018-03-20 13:08:46 +00:00
cert.pem
ciphers.c Split configuration of TLSv1.3 ciphers from older ciphers 2018-03-14 10:15:50 +00:00
client.pem
cms.c Update copyright year 2019-05-28 14:49:38 +02:00
crl.c Update copyright year 2018-02-13 13:59:25 +00:00
crl2p7.c Update copyright year 2018-02-13 13:59:25 +00:00
ct_log_list.cnf Remove unnecessary trailing whitespace 2019-02-05 16:29:17 +01:00
dgst.c openssl dgst, openssl enc: check for end of input 2019-08-22 14:48:06 +02:00
dh1024.pem Remove unnecessary trailing whitespace 2019-02-05 16:29:17 +01:00
dh2048.pem Remove unnecessary trailing whitespace 2019-02-05 16:29:17 +01:00
dh4096.pem Remove unnecessary trailing whitespace 2019-02-05 16:29:17 +01:00
dhparam.c apps/dsaparam.c generates code that is intended to be pasted or included 2018-07-30 07:34:32 +10: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 Update copyright year 2018-02-13 13:59:25 +00:00
dsa512.pem
dsa1024.pem
dsap.pem
dsaparam.c apps/dsaparam.c generates code that is intended to be pasted or included 2018-07-30 07:34:32 +10:00
ec.c Update copyright year 2018-02-13 13:59:25 +00:00
ecparam.c Use the new non-curve type specific EC functions internally 2018-07-31 09:08:38 +01:00
enc.c openssl dgst, openssl enc: check for end of input 2019-08-22 14:48:06 +02:00
engine.c Update copyright year 2018-02-13 13:59:25 +00:00
errstr.c Update copyright year 2018-02-13 13:59:25 +00:00
gendsa.c Issue warnings for large DSA and RSA keys 2018-06-05 18:08:01 +02:00
genpkey.c add 'unsupported cipher mode' diagnostics to evp_lib.c and genpkey.c 2018-06-18 10:45:35 +01:00
genrsa.c Issue warnings for large DSA and RSA keys 2018-06-05 18:08:01 +02:00
nseq.c Update copyright year 2018-02-13 13:59:25 +00:00
ocsp.c Actually silently ignore GET / OCSP requests 2019-07-16 06:14:36 -04:00
openssl-vms.cnf Remove unnecessary trailing whitespace 2019-02-05 16:29:17 +01:00
openssl.c Remove HEADER_X509_H include detector from apps 2019-07-24 17:08:38 +02:00
openssl.cnf Remove unnecessary trailing whitespace 2019-02-05 16:29:17 +01:00
opt.c apps: Stop pretending to care about Netscape keys 2018-11-02 10:59:17 +01:00
passwd.c Update copyright year 2018-02-13 13:59:25 +00: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 Update copyright year 2018-02-13 13:59:25 +00:00
pkcs8.c Update copyright year 2018-02-13 13:59:25 +00:00
pkcs12.c Fix Typos 2019-07-31 19:48:30 +02:00
pkey.c Do not ignore EVP_PKEY_print_public/EVP_PKEY_print_private return values 2018-08-24 15:33:26 +03:00
pkeyparam.c Update copyright year 2018-02-13 13:59:25 +00:00
pkeyutl.c Add a sanity check on the length of pkeyutl inputs 2018-05-24 17:26:03 +01:00
prime.c Update copyright year 2018-02-13 13:59:25 +00:00
privkey.pem
progs.pl Enable all implemented digests 2018-04-19 21:03:53 +02:00
rand.c Update copyright year 2018-02-13 13:59:25 +00:00
rehash.c Update copyright year 2019-02-26 14:05:09 +00:00
req.c Avoid NULL pointer dereference. Fixes #9043. 2019-07-08 20:15:44 +10:00
req.pem
rsa.c Check return value of EVP_PKEY_new 2018-11-10 04:42:29 +02:00
rsa8192.pem
rsautl.c Update copyright year 2018-02-13 13:59:25 +00:00
s512-key.pem
s512-req.pem
s1024key.pem
s1024req.pem
s_apps.h Remove HEADER_X509_H include detector from apps 2019-07-24 17:08:38 +02:00
s_cb.c Reorganized signature-scheme detection in 'apps/s_cb.c:security_callback_debug' callback-function. 2019-03-20 13:48:16 +00:00
s_client.c Fix Typos 2019-07-01 02:02:06 +08:00
s_server.c Update copyright year 2019-02-26 14:05:09 +00:00
s_socket.c Only set TCP_NODELAY if the protocol is TCP 2018-05-31 10:39:13 +01:00
s_time.c Don't call setsockopt with an invalid fd 2018-05-31 10:39:13 +01:00
server.pem
server.srl
server2.pem
sess_id.c Fix the type of -out option 2018-02-28 18:44:56 +01:00
smime.c Update copyright year 2018-02-13 13:59:25 +00:00
speed.c Fix Typos 2019-07-31 19:48:30 +02:00
spkac.c Fix mixed indentation (and other whitespace issues) 2018-04-26 21:34:46 +02:00
srp.c update SRP copyright notice 2018-03-13 18:33:44 +10:00
storeutl.c Fix Typos 2019-07-31 19:48:30 +02:00
testCA.pem
testdsa.h Clean up a bundle of codingstyle stuff in apps directory 2017-06-12 16:11:05 -04:00
testrsa.h Copyright consolidation 01/10 2016-05-17 14:19:19 -04:00
timeouts.h Copyright consolidation 01/10 2016-05-17 14:19:19 -04:00
ts.c Update copyright year 2018-02-13 13:59:25 +00:00
tsget.in Update copyright year 2018-03-20 13:08:46 +00:00
verify.c Update copyright year 2019-02-26 14:05:09 +00:00
version.c Restore the display of options with 'openssl version -a' 2018-03-09 14:28:51 +01:00
vms_decc_init.c Copyright consolidation 01/10 2016-05-17 14:19:19 -04:00
vms_term_sock.c Consistent formatting for sizeof(foo) 2017-12-07 19:11:49 -05:00
vms_term_sock.h Cleanup some copyright stuff 2017-06-30 21:56:44 -04:00
win32_init.c Fix not-c code 2016-10-19 00:56:48 +02:00
x509.c apps: Stop pretending to care about Netscape keys 2018-11-02 10:59:17 +01:00