summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-04-13 02:43:45 +0200
committerRichard Levitte <levitte@openssl.org>2016-04-13 02:43:45 +0200
commit7a82f778bd23eec978d57679de48def0e5010284 (patch)
tree9671de39feb2975e451bfa6236374861b15de332
parentAdd SSL_CTX_get_ciphers() (diff)
downloadopenssl-7a82f778bd23eec978d57679de48def0e5010284.tar.xz
openssl-7a82f778bd23eec978d57679de48def0e5010284.zip
Fix setting of debug callback in apps/enc.c
Setting the debug callback on the in and out BIOs were done too early. No debug callback was set on the zlib filter BIO. Reviewed-by: Tim Hudson <tjh@openssl.org>
-rw-r--r--apps/enc.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/apps/enc.c b/apps/enc.c
index 77df79d953..7869987bf1 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -323,13 +323,6 @@ int enc_main(int argc, char **argv)
strbuf = app_malloc(SIZE, "strbuf");
buff = app_malloc(EVP_ENCODE_LENGTH(bsize), "evp buffer");
- if (debug) {
- BIO_set_callback(in, BIO_debug_callback);
- BIO_set_callback(out, BIO_debug_callback);
- BIO_set_callback_arg(in, (char *)bio_err);
- BIO_set_callback_arg(out, (char *)bio_err);
- }
-
if (infile == NULL) {
unbuffer(stdin);
in = dup_bio_in(informat);
@@ -381,6 +374,13 @@ int enc_main(int argc, char **argv)
if (out == NULL)
goto end;
+ if (debug) {
+ BIO_set_callback(in, BIO_debug_callback);
+ BIO_set_callback(out, BIO_debug_callback);
+ BIO_set_callback_arg(in, (char *)bio_err);
+ BIO_set_callback_arg(out, (char *)bio_err);
+ }
+
rbio = in;
wbio = out;
@@ -388,6 +388,10 @@ int enc_main(int argc, char **argv)
if (do_zlib) {
if ((bzl = BIO_new(BIO_f_zlib())) == NULL)
goto end;
+ if (debug) {
+ BIO_set_callback(bzl, BIO_debug_callback);
+ BIO_set_callback_arg(bzl, (char *)bio_err);
+ }
if (enc)
wbio = BIO_push(bzl, wbio);
else