Adapt ENGINE_CONF_DEBUG to the new generic trace API

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)
This commit is contained in:
Richard Levitte 2018-12-13 01:37:10 +01:00
parent 5c64173586
commit f4db05df0e
3 changed files with 9 additions and 14 deletions

View file

@ -9,8 +9,7 @@
#include "eng_int.h" #include "eng_int.h"
#include <openssl/conf.h> #include <openssl/conf.h>
#include <openssl/trace.h>
/* #define ENGINE_CONF_DEBUG */
/* ENGINE config module */ /* ENGINE config module */
@ -50,9 +49,7 @@ static int int_engine_configure(const char *name, const char *value, const CONF
int soft = 0; int soft = 0;
name = skip_dot(name); name = skip_dot(name);
#ifdef ENGINE_CONF_DEBUG OSSL_TRACE1(ENGINE_CONF, "Configuring engine %s\n", name);
fprintf(stderr, "Configuring engine %s\n", name);
#endif
/* Value is a section containing ENGINE commands */ /* Value is a section containing ENGINE commands */
ecmds = NCONF_get_section(cnf, value); ecmds = NCONF_get_section(cnf, value);
@ -66,10 +63,8 @@ static int int_engine_configure(const char *name, const char *value, const CONF
ecmd = sk_CONF_VALUE_value(ecmds, i); ecmd = sk_CONF_VALUE_value(ecmds, i);
ctrlname = skip_dot(ecmd->name); ctrlname = skip_dot(ecmd->name);
ctrlvalue = ecmd->value; ctrlvalue = ecmd->value;
#ifdef ENGINE_CONF_DEBUG OSSL_TRACE2(ENGINE_CONF, "ENGINE conf: doing ctrl(%s,%s)\n",
fprintf(stderr, "ENGINE conf: doing ctrl(%s,%s)\n", ctrlname, ctrlname, ctrlvalue);
ctrlvalue);
#endif
/* First handle some special pseudo ctrls */ /* First handle some special pseudo ctrls */
@ -153,10 +148,8 @@ static int int_engine_module_init(CONF_IMODULE *md, const CONF *cnf)
STACK_OF(CONF_VALUE) *elist; STACK_OF(CONF_VALUE) *elist;
CONF_VALUE *cval; CONF_VALUE *cval;
int i; int i;
#ifdef ENGINE_CONF_DEBUG OSSL_TRACE2(ENGINE_CONF, "Called engine module: name %s, value %s\n",
fprintf(stderr, "Called engine module: name %s, value %s\n", CONF_imodule_get_name(md), CONF_imodule_get_value(md));
CONF_imodule_get_name(md), CONF_imodule_get_value(md));
#endif
/* Value is a section containing ENGINEs to configure */ /* Value is a section containing ENGINEs to configure */
elist = NCONF_get_section(cnf, CONF_imodule_get_value(md)); elist = NCONF_get_section(cnf, CONF_imodule_get_value(md));

View file

@ -123,6 +123,7 @@ static const struct trace_category_st trace_categories[] = {
TRACE_CATEGORY_(INIT), TRACE_CATEGORY_(INIT),
TRACE_CATEGORY_(TLS), TRACE_CATEGORY_(TLS),
TRACE_CATEGORY_(TLS_CIPHER), TRACE_CATEGORY_(TLS_CIPHER),
TRACE_CATEGORY_(ENGINE_CONF),
}; };
const char *OSSL_trace_get_category_name(int num) const char *OSSL_trace_get_category_name(int num)

View file

@ -36,7 +36,8 @@ extern "C" {
# define OSSL_TRACE_CATEGORY_INIT 1 # define OSSL_TRACE_CATEGORY_INIT 1
# define OSSL_TRACE_CATEGORY_TLS 2 # define OSSL_TRACE_CATEGORY_TLS 2
# define OSSL_TRACE_CATEGORY_TLS_CIPHER 3 # define OSSL_TRACE_CATEGORY_TLS_CIPHER 3
# define OSSL_TRACE_CATEGORY_NUM 4 # define OSSL_TRACE_CATEGORY_ENGINE_CONF 4
# define OSSL_TRACE_CATEGORY_NUM 5
/* Returns the trace category number for the given |name| */ /* Returns the trace category number for the given |name| */
int OSSL_trace_get_category_num(const char *name); int OSSL_trace_get_category_num(const char *name);