trace: don't pretend success if it's not enabled
authorDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Tue, 19 Mar 2019 07:53:35 +0000 (08:53 +0100)
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Fri, 29 Mar 2019 22:59:06 +0000 (23:59 +0100)
commit0fda9f7c291de7b3a1e576ce43801dfa91b42f0e
tree87fe5371010eb4fe3596bbf62df36f2e0d1ab537
parent2e6b615f795e8ca8ae830a00079c4ea064eaae42
trace: don't pretend success if it's not enabled

Partially reverts d33d76168fb7 Don't fail when tracing is disabled

Commit d33d76168fb7 fixed the problem that the initialization of
libcrypto failed when tracing was disabled, because the unoperational
ossl_trace_init() function returned a failure code. The problem was
fixed by changing its return value from failure to success.

As part of the fix the return values of other unimplemented trace API
functions (like OSSL_trace_set_channel(),OSSL_trace_set_callback())
was changed from failure to success, too. This change was not necessary
and is a bit problematic IMHO, because nobody expects an unimplemented
function to pretend it succeeded.

It's the application's duty to handle the case correctly when the trace
API is not enabled (i.e., OPENSSL_NO_TRACE is defined), not the API's job
to pretend success just to prevent the application from failing.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8552)
apps/openssl.c
crypto/trace.c