[openssl] master update

Richard Levitte levitte at openssl.org
Sat Jun 22 07:02:28 UTC 2019


The branch master has been updated
       via  fe26f798526c14a3f8c9bb55d0eaf8eaa0d086e1 (commit)
      from  f8922b5107d098c78f846c8c999f96111345de8d (commit)


- Log -----------------------------------------------------------------
commit fe26f798526c14a3f8c9bb55d0eaf8eaa0d086e1
Author: Richard Levitte <levitte at openssl.org>
Date:   Fri Jun 21 11:20:15 2019 +0200

    OSSL_TRACE: ensure it's initialised
    
    When OSSL_TRACE functionality is called before anything else, it finds
    itself uninitialised, i.e. its global lock hasn't been created yet.
    
    Fortunately, we have an internal general setup function for the trace
    functionality, that makes for a perfect spot to trigger initialisation.
    
    Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
    (Merged from https://github.com/openssl/openssl/pull/9212)

-----------------------------------------------------------------------

Summary of changes:
 crypto/trace.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/crypto/trace.c b/crypto/trace.c
index ecfc6d4..f4b9686 100644
--- a/crypto/trace.c
+++ b/crypto/trace.c
@@ -132,6 +132,8 @@ static const struct trace_category_st trace_categories[] = {
     TRACE_CATEGORY_(PKCS12_DECRYPT),
     TRACE_CATEGORY_(X509V3_POLICY),
     TRACE_CATEGORY_(BN_CTX),
+    TRACE_CATEGORY_(PROV),
+    TRACE_CATEGORY_(FETCH),
 };
 
 const char *OSSL_trace_get_category_name(int num)
@@ -223,9 +225,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) {


More information about the openssl-commits mailing list