Latest update.
This commit is contained in:
+18
-24
@@ -113,10 +113,10 @@ static size_t internal_trace_cb(const char *buf, size_t cnt,
|
||||
tid = CRYPTO_THREAD_get_current_id();
|
||||
hex = OPENSSL_buf2hexstr((const unsigned char *)&tid, sizeof(tid));
|
||||
BIO_snprintf(buffer, sizeof(buffer), "TRACE[%s]:%s: ",
|
||||
hex, OSSL_trace_get_category_name(category));
|
||||
hex == NULL ? "<null>" : hex,
|
||||
OSSL_trace_get_category_name(category));
|
||||
OPENSSL_free(hex);
|
||||
BIO_ctrl(trace_data->bio, PREFIX_CTRL_SET_PREFIX,
|
||||
strlen(buffer), buffer);
|
||||
BIO_set_prefix(trace_data->bio, buffer);
|
||||
break;
|
||||
case OSSL_TRACE_CTRL_WRITE:
|
||||
if (!ossl_assert(trace_data->ingroup))
|
||||
@@ -129,7 +129,7 @@ static size_t internal_trace_cb(const char *buf, size_t cnt,
|
||||
return 0;
|
||||
trace_data->ingroup = 0;
|
||||
|
||||
BIO_ctrl(trace_data->bio, PREFIX_CTRL_SET_PREFIX, 0, NULL);
|
||||
BIO_set_prefix(trace_data->bio, NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -161,8 +161,7 @@ static void setup_trace_category(int category)
|
||||
if (OSSL_trace_enabled(category))
|
||||
return;
|
||||
|
||||
channel = BIO_push(BIO_new(apps_bf_prefix()),
|
||||
dup_bio_err(FORMAT_TEXT));
|
||||
channel = BIO_push(BIO_new(BIO_f_prefix()), dup_bio_err(FORMAT_TEXT));
|
||||
trace_data = OPENSSL_zalloc(sizeof(*trace_data));
|
||||
|
||||
if (trace_data == NULL
|
||||
@@ -246,22 +245,10 @@ int main(int argc, char *argv[])
|
||||
win32_utf8argv(&argc, &argv);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We use the prefix method to get the trace output we want. Since some
|
||||
* trace outputs happen with OPENSSL_cleanup(), which is run automatically
|
||||
* after exit(), we need to destroy the prefix method as late as possible.
|
||||
*/
|
||||
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)
|
||||
CRYPTO_set_mem_debug(1);
|
||||
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
|
||||
|
||||
if (getenv("OPENSSL_FIPS")) {
|
||||
BIO_printf(bio_err, "FIPS mode not supported.\n");
|
||||
return 1;
|
||||
@@ -276,6 +263,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
prog = prog_init();
|
||||
if (prog == NULL) {
|
||||
BIO_printf(bio_err,
|
||||
"FATAL: Startup failure (dev note: prog_init() failed)\n");
|
||||
ERR_print_errors(bio_err);
|
||||
ret = 1;
|
||||
goto end;
|
||||
}
|
||||
pname = opt_progname(argv[0]);
|
||||
|
||||
/* first check the program name */
|
||||
@@ -371,10 +365,6 @@ int main(int argc, char *argv[])
|
||||
BIO_free(bio_in);
|
||||
BIO_free_all(bio_out);
|
||||
apps_shutdown();
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
if (CRYPTO_mem_leaks(bio_err) <= 0)
|
||||
ret = 1;
|
||||
#endif
|
||||
BIO_free(bio_err);
|
||||
EXIT(ret);
|
||||
}
|
||||
@@ -384,9 +374,13 @@ typedef enum HELP_CHOICE {
|
||||
} HELP_CHOICE;
|
||||
|
||||
const OPTIONS help_options[] = {
|
||||
{OPT_HELP_STR, 1, '-', "Usage: help [options]\n"},
|
||||
{OPT_HELP_STR, 1, '-', " help [command]\n"},
|
||||
{OPT_HELP_STR, 1, '-', "Usage: help [options] [command]\n"},
|
||||
|
||||
OPT_SECTION("General"),
|
||||
{"help", OPT_hHELP, '-', "Display this summary"},
|
||||
|
||||
OPT_PARAMETERS(),
|
||||
{"command", 0, 0, "Name of command to display help (optional)"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user