return p;
}
+
+#ifndef OPENSSL_NO_TRACE
typedef struct tracedata_st {
BIO *bio;
unsigned int ingroup:1;
OPENSSL_free(val);
atexit(cleanup_trace);
}
+#endif /* OPENSSL_NO_TRACE */
int main(int argc, char *argv[])
{
*/
atexit(destroy_prefix_method);
+#ifndef OPENSSL_NO_TRACE
setup_trace(getenv("OPENSSL_TRACE"));
+#endif
p = getenv("OPENSSL_DEBUG_MEMORY");
if (p != NULL && strcmp(p, "on") == 0)
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, SIMPLE_CHANNEL, &channel, NULL, NULL,
- trace_attach_cb, trace_detach_cb))
- return 0;
+ if (category >= 0 && category < OSSL_TRACE_CATEGORY_NUM)
+ return set_trace_data(category, SIMPLE_CHANNEL, &channel, NULL, NULL,
+ trace_attach_cb, trace_detach_cb))
#endif
- return 1;
+ return 0;
}
#ifndef OPENSSL_NO_TRACE
struct trace_data_st *trace_data = NULL;
if (category < 0 || category >= OSSL_TRACE_CATEGORY_NUM)
- goto err;
+ return 0;
if (callback != NULL) {
if ((channel = BIO_new(&trace_method)) == NULL
trace_attach_w_callback_cb, trace_detach_cb))
goto err;
- goto done;
+ return 1;
err:
BIO_free(channel);
OPENSSL_free(trace_data);
- return 0;
- done:
#endif
- return 1;
+
+ return 0;
}
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)
+ if (category >= 0 && category < OSSL_TRACE_CATEGORY_NUM)
return set_trace_data(category, 0, NULL, &prefix, NULL,
trace_attach_cb, trace_detach_cb);
- rv = 0;
#endif
- return rv;
+ return 0;
}
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)
+ if (category >= 0 && category < OSSL_TRACE_CATEGORY_NUM)
return set_trace_data(category, 0, NULL, NULL, &suffix,
trace_attach_cb, trace_detach_cb);
- rv = 0;
#endif
- return rv;
+ return 0;
}
#ifndef OPENSSL_NO_TRACE