[openssl] master update

Richard Levitte levitte at openssl.org
Thu Mar 14 07:12:57 UTC 2019


The branch master has been updated
       via  d33d76168fb7642916cdcb7ccb0513abdb6f5f05 (commit)
      from  81d61a62faa809e6c51f5fc2b86fb0d31146fd5e (commit)


- Log -----------------------------------------------------------------
commit d33d76168fb7642916cdcb7ccb0513abdb6f5f05
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Mar 14 00:39:28 2019 +0100

    Don't fail when tracing is disabled
    
    When tracing is disabled, don't generate errors, especially during
    init.  Instead, just pretend the everything is fine.
    
    Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
    (Merged from https://github.com/openssl/openssl/pull/8475)

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

Summary of changes:
 crypto/trace.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/crypto/trace.c b/crypto/trace.c
index 8ead944..c0b3ab2 100644
--- a/crypto/trace.c
+++ b/crypto/trace.c
@@ -287,11 +287,11 @@ int ossl_trace_init(void)
 {
 #ifndef OPENSSL_NO_TRACE
     trace_lock = CRYPTO_THREAD_lock_new();
-    if (trace_lock != NULL)
-        return 1;
+    if (trace_lock == NULL)
+        return 0;
 #endif
 
-    return 0;
+    return 1;
 }
 
 void ossl_trace_cleanup(void)
@@ -321,15 +321,11 @@ int OSSL_trace_set_channel(int category, BIO *channel)
     if (category < 0 || category >= OSSL_TRACE_CATEGORY_NUM
         || !set_trace_data(category, &channel, NULL, NULL,
                            trace_attach_cb, trace_detach_cb))
-        goto err;
+        return 0;
 
     trace_channels[category].type = t_channel;
-    return 1;
-
- err:
 #endif
-
-    return 0;
+    return 1;
 }
 
 #ifndef OPENSSL_NO_TRACE
@@ -383,36 +379,41 @@ int OSSL_trace_set_callback(int category, OSSL_trace_cb callback, void *data)
         goto err;
 
     trace_channels[category].type = t_callback;
-    return 1;
+    goto done;
 
  err:
     BIO_free(channel);
     OPENSSL_free(trace_data);
-#endif
-
     return 0;
+ done:
+#endif
+    return 1;
 }
 
 int OSSL_trace_set_prefix(int category, const char *prefix)
 {
+    int rv = 1;
+
 #ifndef OPENSSL_NO_TRACE
     if (category >= 0 || category < OSSL_TRACE_CATEGORY_NUM)
         return set_trace_data(category, NULL, &prefix, NULL,
                               trace_attach_cb, trace_detach_cb);
+    rv = 0;
 #endif
-
-    return 0;
+    return rv;
 }
 
 int OSSL_trace_set_suffix(int category, const char *suffix)
 {
+    int rv = 1;
+
 #ifndef OPENSSL_NO_TRACE
     if (category >= 0 || category < OSSL_TRACE_CATEGORY_NUM)
         return set_trace_data(category, NULL, NULL, &suffix,
                               trace_attach_cb, trace_detach_cb);
+    rv = 0;
 #endif
-
-    return 0;
+    return rv;
 }
 
 #ifndef OPENSSL_NO_TRACE


More information about the openssl-commits mailing list