summaryrefslogtreecommitdiffstats
path: root/apps/apps.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2018-12-14 15:48:53 +0100
committerRichard Levitte <levitte@openssl.org>2019-03-06 11:15:13 +0100
commit682b444f8a78b8902a3521cd6486bdecb766e5e5 (patch)
tree9ee3ace3f57a381e85a73f1c1874bcca262bf839 /apps/apps.c
parent2390c573aa598b715eb592c9b4da50a71453347a (diff)
apps/openssl.c: Adapt to enable tracing output
Use the environment variables OPENSSL_TRACE to determine what's going to be enabled. The value of this variables is a comma separated list of trace and debugging names, which correspond to the trace category macros defined in include/openssl/trace.h. For example, setting OPENSSL_DEBUG=TRACE,SSL will enable debugging output for the types OSSL_TRACE_CATEGORY_TRACE and OSSL_TRACE_CATEGORY_SSL. This also slightly changes the handling of the prefix method in apps/apps.c. This is for the better, as the prefix method pointer was unneccessarily stored in two places. Co-authored-by: Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/8198)
Diffstat (limited to 'apps/apps.c')
-rw-r--r--apps/apps.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/apps.c b/apps/apps.c
index 44a90a338c..d095dee27c 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -2243,8 +2243,6 @@ BIO *dup_bio_in(int format)
BIO_NOCLOSE | (FMT_istext(format) ? BIO_FP_TEXT : 0));
}
-static BIO_METHOD *prefix_method = NULL;
-
BIO *dup_bio_out(int format)
{
BIO *b = BIO_new_fp(stdout,
@@ -2256,10 +2254,9 @@ BIO *dup_bio_out(int format)
b = BIO_push(BIO_new(BIO_f_linebuffer()), b);
#endif
- if (FMT_istext(format) && (prefix = getenv("HARNESS_OSSL_PREFIX")) != NULL) {
- if (prefix_method == NULL)
- prefix_method = apps_bf_prefix();
- b = BIO_push(BIO_new(prefix_method), b);
+ if (FMT_istext(format)
+ && (prefix = getenv("HARNESS_OSSL_PREFIX")) != NULL) {
+ b = BIO_push(BIO_new(apps_bf_prefix()), b);
BIO_ctrl(b, PREFIX_CTRL_SET_PREFIX, 0, prefix);
}
@@ -2277,8 +2274,13 @@ BIO *dup_bio_err(int format)
return b;
}
+/*
+ * Because the prefix method is created dynamically, we must also be able
+ * to destroy it.
+ */
void destroy_prefix_method(void)
{
+ BIO_METHOD *prefix_method = apps_bf_prefix();
BIO_meth_free(prefix_method);
prefix_method = NULL;
}