From 71849dff56d62802bef11b0643446588ae25122e Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Fri, 5 Apr 2019 10:58:16 +0200 Subject: [PATCH] Rename the PROVIDER_CONF trace to CONF Other configuration modules may have use for tracing, and having one tracing category for each of them is a bit much. Instead, we make one category for them all. Reviewed-by: Paul Dale Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/8680) --- crypto/provider_conf.c | 19 ++++++++++++------- crypto/trace.c | 2 +- include/openssl/trace.h | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/crypto/provider_conf.c b/crypto/provider_conf.c index 9d9b7a1348..74162a88b3 100644 --- a/crypto/provider_conf.c +++ b/crypto/provider_conf.c @@ -35,14 +35,14 @@ static int provider_conf_params(OSSL_PROVIDER *prov, STACK_OF(CONF_VALUE) *sect; int ok = 1; - OSSL_TRACE2(PROVIDER_CONF, "PROVIDER conf: %s = %s\n", name, value); - sect = NCONF_get_section(cnf, value); if (sect != NULL) { int i; char buffer[512]; size_t buffer_len = 0; + OSSL_TRACE1(CONF, "Provider params: start section %s\n", value); + if (name != NULL) { OPENSSL_strlcpy(buffer, name, sizeof(buffer)); OPENSSL_strlcat(buffer, ".", sizeof(buffer)); @@ -59,7 +59,10 @@ static int provider_conf_params(OSSL_PROVIDER *prov, if (!provider_conf_params(prov, buffer, sectconf->value, cnf)) return 0; } + + OSSL_TRACE1(CONF, "Provider params: finish section %s\n", value); } else { + OSSL_TRACE2(CONF, "Provider params: %s = %s\n", name, value); ok = ossl_provider_add_parameter(prov, name, value); } @@ -78,7 +81,7 @@ static int provider_conf_load(OPENSSL_CTX *libctx, const char *name, int ok = 0; name = skip_dot(name); - OSSL_TRACE1(PROVIDER_CONF, "Configuring provider %s\n", name); + OSSL_TRACE1(CONF, "Configuring provider %s\n", name); /* Value is a section containing PROVIDER commands */ ecmds = NCONF_get_section(cnf, value); @@ -93,7 +96,7 @@ static int provider_conf_load(OPENSSL_CTX *libctx, const char *name, const char *confname = skip_dot(ecmd->name); const char *confvalue = ecmd->value; - OSSL_TRACE2(PROVIDER_CONF, "PROVIDER conf: %s = %s\n", + OSSL_TRACE2(CONF, "Provider command: %s = %s\n", confname, confvalue); /* First handle some special pseudo confs */ @@ -145,8 +148,9 @@ static int provider_conf_init(CONF_IMODULE *md, const CONF *cnf) CONF_VALUE *cval; int i; - OSSL_TRACE2(PROVIDER_CONF, "Loading provider module: name %s, value %s\n", - CONF_imodule_get_name(md), CONF_imodule_get_value(md)); + OSSL_TRACE1(CONF, "Loading providers module: section %s\n", + CONF_imodule_get_value(md)); + /* Value is a section containing PROVIDERs to configure */ elist = NCONF_get_section(cnf, CONF_imodule_get_value(md)); @@ -170,10 +174,11 @@ static void provider_conf_deinit(CONF_IMODULE *md) { sk_OSSL_PROVIDER_pop_free(activated_providers, ossl_provider_free); activated_providers = NULL; - OSSL_TRACE(PROVIDER_CONF, "Cleaned up providers\n"); + OSSL_TRACE(CONF, "Cleaned up providers\n"); } void ossl_provider_add_conf_module(void) { + OSSL_TRACE(CONF, "Adding config module 'providers'\n"); CONF_module_add("providers", provider_conf_init, provider_conf_deinit); } diff --git a/crypto/trace.c b/crypto/trace.c index c9623b0fde..ac383fac9a 100644 --- a/crypto/trace.c +++ b/crypto/trace.c @@ -132,7 +132,7 @@ static const struct trace_category_st trace_categories[] = { TRACE_CATEGORY_(PKCS12_DECRYPT), TRACE_CATEGORY_(X509V3_POLICY), TRACE_CATEGORY_(BN_CTX), - TRACE_CATEGORY_(PROVIDER_CONF), + TRACE_CATEGORY_(CONF), }; const char *OSSL_trace_get_category_name(int num) diff --git a/include/openssl/trace.h b/include/openssl/trace.h index aff1a32a18..af513baf80 100644 --- a/include/openssl/trace.h +++ b/include/openssl/trace.h @@ -49,7 +49,7 @@ extern "C" { # define OSSL_TRACE_CATEGORY_PKCS12_DECRYPT 10 # define OSSL_TRACE_CATEGORY_X509V3_POLICY 11 # define OSSL_TRACE_CATEGORY_BN_CTX 12 -# define OSSL_TRACE_CATEGORY_PROVIDER_CONF 13 +# define OSSL_TRACE_CATEGORY_CONF 13 # define OSSL_TRACE_CATEGORY_NUM 14 /* Returns the trace category number for the given |name| */