[openssl] master update

matthias.st.pierre at ncp-e.com matthias.st.pierre at ncp-e.com
Fri Mar 15 07:50:07 UTC 2019


The branch master has been updated
       via  c37e635065a5bcb744dfb282f59e978e41490ce4 (commit)
       via  fe50e115718edb8938443a45c8014d6568537bd0 (commit)
       via  13d06925e8cb15bf4247f14280d535618e7a4b2b (commit)
       via  5afb177c3c84d36244fd1b25b96a204ae6777a51 (commit)
       via  e474a286f55966cd14b96334a621e53df62d3ef6 (commit)
      from  355417eb4611014767480e5d3e96b1b08eb02700 (commit)


- Log -----------------------------------------------------------------
commit c37e635065a5bcb744dfb282f59e978e41490ce4
Author: Dr. Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
Date:   Tue Mar 12 23:35:45 2019 +0100

    trace: update the documentation
    
    This commit adds some missing symbols and other minor enhancements.
    In particular, it establishes the term 'channel' as a synonym for
    a BIO object attached to a trace category, and introduces the
    concept of a 'simple' channel versus a 'callback' channel.
    
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/8463)

commit fe50e115718edb8938443a45c8014d6568537bd0
Author: Dr. Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
Date:   Wed Mar 13 00:14:55 2019 +0100

    trace: ensure correct grouping
    
    It is important that output to the trace channels occurs only inside
    a trace group. This precondtion is satisfied whenever the standard
    TRACE macros are used. It can be violated only by a bad programming
    mistake, like copying the 'trc_out' pointer and using it outside
    the trace group.
    
    This commit enforces correct pairing of the OSSL_TRACE_CTRL_BEGIN and
    OSSL_TRACE_CTRL_END callbacks, and checks that OSSL_TRACE_CTRL_WRITE
    callbacks only occur within such groups.
    
    While implementing it, it turned out that the group assertion failed
    
      apps/openssl.c:152: OpenSSL internal error: \
                          Assertion failed: trace_data->ingroup
    
    because the set_trace_data() function invokes some callbacks which
    generate trace output, but the correct channel type was set only
    after the set_trace_data() call.
    
    To fix the failed assertions, the correct channel type is now set
    inside the set_trace_data() call, instead of doing it afterwards.
    
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/8463)

commit 13d06925e8cb15bf4247f14280d535618e7a4b2b
Author: Dr. Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
Date:   Tue Mar 12 23:04:14 2019 +0100

    trace: don't leak the line prefix
    
    The openssl app registers trace callbacks which automatically
    set a line prefix in the OSSL_TRACE_CTRL_BEGIN callback.
    This prefix needs to be cleared in the OSSL_TRACE_CTRL_END
    callback, otherwise a memory leak is reported when openssl
    is built with crypto-mdebug enabled.
    
    This leak causes the tests to fail when tracing and memory
    debugging are enabled.
    
    The leak can be observed by any command that produces trace
    output, e.g. by
    
      OPENSSL_TRACE=ANY util/shlib_wrap.sh  apps/openssl version
      ...
      [00:19:14]  4061 file=apps/bf_prefix.c, line=152, ...
      26 bytes leaked in 1 chunks
    
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/8463)

commit 5afb177c3c84d36244fd1b25b96a204ae6777a51
Author: Dr. Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
Date:   Sun Mar 10 11:07:27 2019 +0100

    trace: rename the trace channel types
    
    Since the term 'channel' is already used as synonym for a BIO object attached
    to a trace category, having a 't_channel' channel type and a 't_callback' channel
    type somehow overburdens this term. For that reason the type enum constants are
    renamed to 'SIMPE_CHANNEL' and 'CALLBACK_CHANNEL'.
    (The conversion to capital letters was done to comply to the coding style.)
    
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/8463)

commit e474a286f55966cd14b96334a621e53df62d3ef6
Author: Dr. Matthias St. Pierre <Matthias.St.Pierre at ncp-e.com>
Date:   Sun Mar 10 01:35:16 2019 +0100

    trace: remove some magic numbers
    
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/8463)

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

Summary of changes:
 apps/openssl.c                      | 43 ++++++++++++-----------
 crypto/trace.c                      | 69 ++++++++++++++++++++-----------------
 doc/man3/OSSL_trace_enabled.pod     | 55 ++++++++++++++++++++++++++---
 doc/man3/OSSL_trace_set_channel.pod | 30 +++++++++++-----
 include/openssl/trace.h             |  2 +-
 util/private.num                    |  6 ++++
 6 files changed, 140 insertions(+), 65 deletions(-)

diff --git a/apps/openssl.c b/apps/openssl.c
index 72a0bb0..119d3e8 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -126,30 +126,19 @@ typedef struct tracedata_st {
 static size_t internal_trace_cb(const char *buf, size_t cnt,
                                 int category, int cmd, void *vdata)
 {
-    int ret;
+    int ret = 0;
     tracedata *trace_data = vdata;
-    int set_prefix = 0;
+    union {
+        CRYPTO_THREAD_ID tid;
+        unsigned long ltid;
+    } tid;
+    char buffer[256];
 
     switch (cmd) {
     case OSSL_TRACE_CTRL_BEGIN:
+        if (!ossl_assert(!trace_data->ingroup))
+            return 0;
         trace_data->ingroup = 1;
-        set_prefix = 1;
-        break;
-    case OSSL_TRACE_CTRL_DURING:
-        if (!trace_data->ingroup)
-            set_prefix = 1;
-        break;
-    case OSSL_TRACE_CTRL_END:
-        trace_data->ingroup = 0;
-        break;
-    }
-
-    if (set_prefix) {
-        union {
-            CRYPTO_THREAD_ID tid;
-            unsigned long ltid;
-        } tid;
-        char buffer[256];
 
         tid.ltid = 0;
         tid.tid = CRYPTO_THREAD_get_current_id();
@@ -158,8 +147,22 @@ static size_t internal_trace_cb(const char *buf, size_t cnt,
                      OSSL_trace_get_category_name(category));
         BIO_ctrl(trace_data->bio, PREFIX_CTRL_SET_PREFIX,
                  strlen(buffer), buffer);
+        break;
+    case OSSL_TRACE_CTRL_WRITE:
+        if (!ossl_assert(trace_data->ingroup))
+            return 0;
+
+        ret = BIO_write(trace_data->bio, buf, cnt);
+        break;
+    case OSSL_TRACE_CTRL_END:
+        if (!ossl_assert(trace_data->ingroup))
+            return 0;
+        trace_data->ingroup = 0;
+
+        BIO_ctrl(trace_data->bio, PREFIX_CTRL_SET_PREFIX, 0, NULL);
+
+        break;
     }
-    ret = BIO_write(trace_data->bio, buf, cnt);
 
     return ret < 0 ? 0 : ret;
 }
diff --git a/crypto/trace.c b/crypto/trace.c
index c0b3ab2..613664c 100644
--- a/crypto/trace.c
+++ b/crypto/trace.c
@@ -65,7 +65,7 @@ static int trace_write(BIO *channel,
                        const char *buf, size_t num, size_t *written)
 {
     struct trace_data_st *ctx = BIO_get_data(channel);
-    size_t cnt = ctx->callback(buf, num, ctx->category, OSSL_TRACE_CTRL_DURING,
+    size_t cnt = ctx->callback(buf, num, ctx->category, OSSL_TRACE_CTRL_WRITE,
                                ctx->data);
 
     *written = cnt;
@@ -158,7 +158,7 @@ int OSSL_trace_get_category_num(const char *name)
 
 /* We use one trace channel for each trace category */
 static struct {
-    enum { t_channel, t_callback } type;
+    enum { SIMPLE_CHANNEL, CALLBACK_CHANNEL } type;
     BIO *bio;
     char *prefix;
     char *suffix;
@@ -169,18 +169,25 @@ static struct {
 #endif
 
 #ifndef OPENSSL_NO_TRACE
+
+enum {
+    CHANNEL,
+    PREFIX,
+    SUFFIX
+};
+
 static int trace_attach_cb(int category, int type, const void *data)
 {
     switch (type) {
-    case 0:                      /* Channel */
+    case CHANNEL:
         OSSL_TRACE2(TRACE, "Attach channel %p to category '%s'\n",
                     data, trace_categories[category].name);
         break;
-    case 1:                      /* Prefix */
+    case PREFIX:
         OSSL_TRACE2(TRACE, "Attach prefix \"%s\" to category '%s'\n",
                     (const char *)data, trace_categories[category].name);
         break;
-    case 2:                      /* Suffix */
+    case SUFFIX:
         OSSL_TRACE2(TRACE, "Attach suffix \"%s\" to category '%s'\n",
                     (const char *)data, trace_categories[category].name);
         break;
@@ -193,15 +200,15 @@ static int trace_attach_cb(int category, int type, const void *data)
 static int trace_detach_cb(int category, int type, const void *data)
 {
     switch (type) {
-    case 0:                      /* Channel */
+    case CHANNEL:
         OSSL_TRACE2(TRACE, "Detach channel %p from category '%s'\n",
                     data, trace_categories[category].name);
         break;
-    case 1:                      /* Prefix */
+    case PREFIX:
         OSSL_TRACE2(TRACE, "Detach prefix \"%s\" from category '%s'\n",
                     (const char *)data, trace_categories[category].name);
         break;
-    case 2:                      /* Suffix */
+    case SUFFIX:
         OSSL_TRACE2(TRACE, "Detach suffix \"%s\" from category '%s'\n",
                     (const char *)data, trace_categories[category].name);
         break;
@@ -211,7 +218,7 @@ static int trace_detach_cb(int category, int type, const void *data)
     return 1;
 }
 
-static int set_trace_data(int category, BIO **channel,
+static int set_trace_data(int category, int type, BIO **channel,
                           const char **prefix, const char **suffix,
                           int (*attach_cb)(int, int, const void *),
                           int (*detach_cb)(int, int, const void *))
@@ -222,15 +229,15 @@ static int set_trace_data(int category, BIO **channel,
 
     /* Make sure to run the detach callback first on all data */
     if (prefix != NULL && curr_prefix != NULL) {
-        detach_cb(category, 1, curr_prefix);
+        detach_cb(category, PREFIX, curr_prefix);
     }
 
     if (suffix != NULL && curr_suffix != NULL) {
-        detach_cb(category, 2, curr_suffix);
+        detach_cb(category, SUFFIX, curr_suffix);
     }
 
     if (channel != NULL && curr_channel != NULL) {
-        detach_cb(category, 0, curr_channel);
+        detach_cb(category, CHANNEL, curr_channel);
     }
 
     /* After detach callbacks are done, clear data where appropriate */
@@ -246,11 +253,13 @@ static int set_trace_data(int category, BIO **channel,
 
     if (channel != NULL && curr_channel != NULL) {
         BIO_free(curr_channel);
+        trace_channels[category].type = 0;
         trace_channels[category].bio = NULL;
     }
 
     /* Before running callbacks are done, set new data where appropriate */
     if (channel != NULL && *channel != NULL) {
+        trace_channels[category].type = type;
         trace_channels[category].bio = *channel;
     }
 
@@ -268,15 +277,15 @@ static int set_trace_data(int category, BIO **channel,
 
     /* Finally, run the attach callback on the new data */
     if (channel != NULL && *channel != NULL) {
-        attach_cb(category, 0, *channel);
+        attach_cb(category, CHANNEL, *channel);
     }
 
     if (prefix != NULL && *prefix != NULL) {
-        attach_cb(category, 1, *prefix);
+        attach_cb(category, PREFIX, *prefix);
     }
 
     if (suffix != NULL && *suffix != NULL) {
-        attach_cb(category, 2, *suffix);
+        attach_cb(category, SUFFIX, *suffix);
     }
 
     return 1;
@@ -306,10 +315,11 @@ void ossl_trace_cleanup(void)
         /* We force the TRACE category to be treated last */
         if (category == OSSL_TRACE_CATEGORY_TRACE)
             continue;
-        set_trace_data(category, &channel, &prefix, &suffix,
+        set_trace_data(category, 0, &channel, &prefix, &suffix,
                        trace_attach_cb, trace_detach_cb);
     }
-    set_trace_data(OSSL_TRACE_CATEGORY_TRACE, &channel, &prefix, &suffix,
+    set_trace_data(OSSL_TRACE_CATEGORY_TRACE, 0, &channel,
+                   &prefix, &suffix,
                    trace_attach_cb, trace_detach_cb);
     CRYPTO_THREAD_lock_free(trace_lock);
 #endif
@@ -319,11 +329,9 @@ int OSSL_trace_set_channel(int category, BIO *channel)
 {
 #ifndef OPENSSL_NO_TRACE
     if (category < 0 || category >= OSSL_TRACE_CATEGORY_NUM
-        || !set_trace_data(category, &channel, NULL, NULL,
+        || !set_trace_data(category, SIMPLE_CHANNEL, &channel, NULL, NULL,
                            trace_attach_cb, trace_detach_cb))
         return 0;
-
-    trace_channels[category].type = t_channel;
 #endif
     return 1;
 }
@@ -332,16 +340,16 @@ int OSSL_trace_set_channel(int category, BIO *channel)
 static int trace_attach_w_callback_cb(int category, int type, const void *data)
 {
     switch (type) {
-    case 0:                      /* Channel */
+    case CHANNEL:
         OSSL_TRACE2(TRACE,
                     "Attach channel %p to category '%s' (with callback)\n",
                     data, trace_categories[category].name);
         break;
-    case 1:                      /* Prefix */
+    case PREFIX:
         OSSL_TRACE2(TRACE, "Attach prefix \"%s\" to category '%s'\n",
                     (const char *)data, trace_categories[category].name);
         break;
-    case 2:                      /* Suffix */
+    case SUFFIX:
         OSSL_TRACE2(TRACE, "Attach suffix \"%s\" to category '%s'\n",
                     (const char *)data, trace_categories[category].name);
         break;
@@ -374,11 +382,10 @@ int OSSL_trace_set_callback(int category, OSSL_trace_cb callback, void *data)
         BIO_set_data(channel, trace_data);
     }
 
-    if (!set_trace_data(category, &channel, NULL, NULL,
+    if (!set_trace_data(category, CALLBACK_CHANNEL, &channel, NULL, NULL,
                         trace_attach_w_callback_cb, trace_detach_cb))
         goto err;
 
-    trace_channels[category].type = t_callback;
     goto done;
 
  err:
@@ -396,7 +403,7 @@ int OSSL_trace_set_prefix(int category, const char *prefix)
 
 #ifndef OPENSSL_NO_TRACE
     if (category >= 0 || category < OSSL_TRACE_CATEGORY_NUM)
-        return set_trace_data(category, NULL, &prefix, NULL,
+        return set_trace_data(category, 0, NULL, &prefix, NULL,
                               trace_attach_cb, trace_detach_cb);
     rv = 0;
 #endif
@@ -409,7 +416,7 @@ int OSSL_trace_set_suffix(int category, const char *suffix)
 
 #ifndef OPENSSL_NO_TRACE
     if (category >= 0 || category < OSSL_TRACE_CATEGORY_NUM)
-        return set_trace_data(category, NULL, NULL, &suffix,
+        return set_trace_data(category, 0, NULL, NULL, &suffix,
                               trace_attach_cb, trace_detach_cb);
     rv = 0;
 #endif
@@ -451,13 +458,13 @@ BIO *OSSL_trace_begin(int category)
         CRYPTO_THREAD_write_lock(trace_lock);
         current_channel = channel;
         switch (trace_channels[category].type) {
-        case t_channel:
+        case SIMPLE_CHANNEL:
             if (prefix != NULL) {
                 (void)BIO_puts(channel, prefix);
                 (void)BIO_puts(channel, "\n");
             }
             break;
-        case t_callback:
+        case CALLBACK_CHANNEL:
             (void)BIO_ctrl(channel, OSSL_TRACE_CTRL_BEGIN,
                            prefix == NULL ? 0 : strlen(prefix), prefix);
             break;
@@ -478,13 +485,13 @@ void OSSL_trace_end(int category, BIO * channel)
         && ossl_assert(channel == current_channel)) {
         (void)BIO_flush(channel);
         switch (trace_channels[category].type) {
-        case t_channel:
+        case SIMPLE_CHANNEL:
             if (suffix != NULL) {
                 (void)BIO_puts(channel, suffix);
                 (void)BIO_puts(channel, "\n");
             }
             break;
-        case t_callback:
+        case CALLBACK_CHANNEL:
             (void)BIO_ctrl(channel, OSSL_TRACE_CTRL_END,
                            suffix == NULL ? 0 : strlen(suffix), suffix);
             break;
diff --git a/doc/man3/OSSL_trace_enabled.pod b/doc/man3/OSSL_trace_enabled.pod
index db3f99c..98e3bd6 100644
--- a/doc/man3/OSSL_trace_enabled.pod
+++ b/doc/man3/OSSL_trace_enabled.pod
@@ -2,7 +2,8 @@
 
 =head1 NAME
 
-OSSL_trace_enabled, OSSL_trace_begin, OSSL_trace_end
+OSSL_trace_enabled, OSSL_trace_begin, OSSL_trace_end,
+OSSL_TRACE_BEGIN, OSSL_TRACE_END, OSSL_TRACE1, OSSL_TRACE2, OSSL_TRACE9
 - OpenSSL Tracing API
 
 =head1 SYNOPSIS
@@ -14,6 +15,18 @@ OSSL_trace_enabled, OSSL_trace_begin, OSSL_trace_end
  BIO *OSSL_trace_begin(int category);
  void OSSL_trace_end(int category, BIO *channel);
 
+ /* trace group macros */
+ OSSL_TRACE_BEGIN(category) {
+    ...
+ } OSSL_TRACE_END(category);
+
+ /* one-shot trace macros */
+ OSSL_TRACE1(category, format, arg1)
+ OSSL_TRACE2(category, format, arg1, arg2)
+ ...
+ OSSL_TRACE9(category, format, arg1, ..., arg9)
+
+
 =head1 DESCRIPTION
 
 The functions described here are mainly interesting for those who provide
@@ -30,6 +43,30 @@ L<OSSL_trace_set_callback(3)/Trace types>.
 The fallback type C<OSSL_TRACE_CATEGORY_ANY> should I<not> be used
 with the functions described here.
 
+Tracing for a specific category is enabled if a so called
+I<trace channel> is attached to it. A trace channel is simply a
+BIO object to which the application can write its trace output.
+
+The application has two different ways of registering a trace channel,
+either by directly providing a BIO object using OSSL_trace_set_channel(),
+or by providing a callback routine using OSSL_trace_set_callback().
+The latter is wrapped internally by a dedicated BIO object, so for the
+tracing code both channel types are effectively indistinguishable.
+We call them a I<simple trace channel> and a I<callback trace channel>,
+respectively.
+
+To produce trace output, it is necessary to obtain a pointer to the
+trace channel (i.e., the BIO object) using OSSL_trace_begin(), write
+to it using arbitrary BIO output routines, and finally releases the
+channel using OSSL_trace_end(). The OSSL_trace_begin()/OSSL_trace_end()
+calls surrounding the trace output create a group, which acts as a
+critical section (guarded by a mutex) to ensure that the trace output
+of different threads does not get mixed up.
+
+The tracing code normally does not call OSSL_trace_{begin,end}() directly,
+but rather uses a set of convenience macros, see the L</Macros> section below.
+
+
 =head2 Functions
 
 OSSL_trace_enabled() can be used to check if tracing for the given
@@ -46,7 +83,7 @@ is I<mandatory>.
 The result of trying to produce tracing output outside of such
 sections is undefined.
 
-=head2 Convenience Macros
+=head2 Macros
 
 There are a number of convenience macros defined, to make tracing
 easy and consistent.
@@ -60,7 +97,7 @@ the B<BIO> C<trc_out> and are used as follows to wrap a trace section:
 
  } OSSL_TRACE_END(TLS);
 
-This will normally expands to:
+This will normally expand to:
 
  do {
      BIO *trc_out = OSSL_trace_begin(OSSL_TRACE_CATEGORY_TLS);
@@ -98,6 +135,16 @@ This will normally expand to:
      OSSL_trace_end(OSSL_TRACE_CATEGORY_TLS, trc_out);
  } while (0);
 
+
+C<OSSL_TRACE1()>, ... C<OSSL_TRACE9()> are one-shot macros which essentially wrap
+a single BIO_printf() into a tracing group.
+
+The call OSSL_TRACEn(category, format, arg1, ..., argN) expands to:
+
+  OSSL_TRACE_BEGIN(category) {
+    BIO_printf(trc_out, format, arg1, ..., argN)
+  } OSSL_TRACE_END(category)
+
 =head1 NOTES
 
 It is advisable to always check that a trace type is enabled with
@@ -133,7 +180,7 @@ nothing.
 =item *
 
 the convenience macros are defined to produce dead code.
-For example, take this example from L</Convenience Macros> above:
+For example, take this example from L</Macros> section above:
 
  OSSL_TRACE_BEGIN(TLS) {
 
diff --git a/doc/man3/OSSL_trace_set_channel.pod b/doc/man3/OSSL_trace_set_channel.pod
index fb680a5..773a6b1 100644
--- a/doc/man3/OSSL_trace_set_channel.pod
+++ b/doc/man3/OSSL_trace_set_channel.pod
@@ -25,14 +25,21 @@ This output comes in form of free text for humans to read.
 
 The trace output is divided into categories which can be
 enabled individually.
-They are enabled by giving them a channel in form of a BIO, or a
-tracer callback, which is responsible for performing the actual
-output.
+Every category can be enabled individually by attaching a so called
+I<trace channel> to it, which in the simplest case is just a BIO object
+to which the application can write the tracing output for this category.
+Alternatively, the application can provide a tracer callback in order to
+get more finegrained trace information. This callback will be wrapped
+internally by a dedicated BIO object.
+
+For the tracing code, both trace channel types are indistinguishable.
+These are called a I<simple trace channel> and a I<callback trace channel>,
+respectively.
 
 =head2 Functions
 
 OSSL_trace_set_channel() is used to enable the given trace C<category>
-by giving it the B<BIO> C<bio>.
+by attaching the B<BIO> C<bio> object as (simple) trace channel.
 
 OSSL_trace_set_prefix() and OSSL_trace_set_suffix() can be used to add
 an extra line for each channel, to be output before and after group of
@@ -46,7 +53,8 @@ OSSL_trace_set_callback() instead.
 OSSL_trace_set_callback() is used to enable the given trace
 C<category> by giving it the tracer callback C<cb> with the associated
 data C<data>, which will simply be passed through to C<cb> whenever
-it's called.
+it's called. The callback function is internally wrapped by a
+dedicated BIO object, the so called I<callback trace channel>.
 This should be used when it's desirable to do form the trace output to
 something suitable for application needs where a prefix and suffix
 line aren't enough.
@@ -78,9 +86,13 @@ callback the possibility to output a dynamic starting line, or set a
 prefix that should be output at the beginning of each line, or
 something other.
 
-=item C<OSSL_TRACE_CTRL_DURING>
+=item C<OSSL_TRACE_CTRL_WRITE>
 
-The callback is called from any regular BIO output routine.
+This callback is called whenever data is written to the BIO by some
+regular BIO output routine.
+An arbitrary number of C<OSSL_TRACE_CTRL_WRITE> callbacks can occur
+inside a group marked by a pair of C<OSSL_TRACE_CTRL_BEGIN> and
+C<OSSL_TRACE_CTRL_END> calls, but never outside such a group.
 
 =item C<OSSL_TRACE_CTRL_END>
 
@@ -177,8 +189,8 @@ success, or 0 on failure.
 
 =head1 EXAMPLES
 
-In all examples below, we assume that the trace producing code is
-this:
+In all examples below, the trace producing code is assumed to be
+the following:
 
  int foo = 42;
  const char bar[] = { 0,  1,  2,  3,  4,  5,  6,  7,
diff --git a/include/openssl/trace.h b/include/openssl/trace.h
index da0ba0b..767b19f 100644
--- a/include/openssl/trace.h
+++ b/include/openssl/trace.h
@@ -95,7 +95,7 @@ typedef size_t (*OSSL_trace_cb)(const char *buffer, size_t count,
  * Possible |cmd| numbers.
  */
 # define OSSL_TRACE_CTRL_BEGIN  0
-# define OSSL_TRACE_CTRL_DURING 1
+# define OSSL_TRACE_CTRL_WRITE  1
 # define OSSL_TRACE_CTRL_END    2
 
 /*
diff --git a/util/private.num b/util/private.num
index 1fbc160..6c37fc0 100644
--- a/util/private.num
+++ b/util/private.num
@@ -503,3 +503,9 @@ ASYNC_STATUS_EAGAIN                     define
 ASYNC_STATUS_OK                         define
 ASYNC_STATUS_ERR                        define
 ASYNC_STATUS_UNSUPPORTED                define
+OSSL_TRACE_BEGIN                        define
+OSSL_TRACE_END                          define
+OSSL_TRACE_CANCEL                       define
+OSSL_TRACE1                             define
+OSSL_TRACE2                             define
+OSSL_TRACE9                             define


More information about the openssl-commits mailing list