Use macros internally for algorithm names
[openssl.git] / crypto / trace.c
index ac383fac9a116ce85d61187a3678476949971d50..d9524da1a6878e0370cb01e94f4ff0ef84e76d2a 100644 (file)
@@ -124,7 +124,7 @@ static const struct trace_category_st trace_categories[] = {
     TRACE_CATEGORY_(INIT),
     TRACE_CATEGORY_(TLS),
     TRACE_CATEGORY_(TLS_CIPHER),
-    TRACE_CATEGORY_(ENGINE_CONF),
+    TRACE_CATEGORY_(CONF),
     TRACE_CATEGORY_(ENGINE_TABLE),
     TRACE_CATEGORY_(ENGINE_REF_COUNT),
     TRACE_CATEGORY_(PKCS5V2),
@@ -132,7 +132,6 @@ static const struct trace_category_st trace_categories[] = {
     TRACE_CATEGORY_(PKCS12_DECRYPT),
     TRACE_CATEGORY_(X509V3_POLICY),
     TRACE_CATEGORY_(BN_CTX),
-    TRACE_CATEGORY_(CONF),
 };
 
 const char *OSSL_trace_get_category_name(int num)
@@ -224,9 +223,16 @@ static int set_trace_data(int category, int type, BIO **channel,
                           int (*attach_cb)(int, int, const void *),
                           int (*detach_cb)(int, int, const void *))
 {
-    BIO *curr_channel = trace_channels[category].bio;
-    char *curr_prefix = trace_channels[category].prefix;
-    char *curr_suffix = trace_channels[category].suffix;
+    BIO *curr_channel = NULL;
+    char *curr_prefix = NULL;
+    char *curr_suffix = NULL;
+
+    /* Ensure ossl_trace_init() is called */
+    OPENSSL_init_crypto(0, NULL);
+
+    curr_channel = trace_channels[category].bio;
+    curr_prefix = trace_channels[category].prefix;
+    curr_suffix = trace_channels[category].suffix;
 
     /* Make sure to run the detach callback first on all data */
     if (prefix != NULL && curr_prefix != NULL) {