projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup vxworks support to be able to compile for VxWorks 7
[openssl.git]
/
apps
/
openssl.c
diff --git
a/apps/openssl.c
b/apps/openssl.c
index c23cd4b2164bf49b5259c9d6062a1e5032be32b8..a872e2c5eeec8bd8764c7e129b75e0b9ccfd3846 100644
(file)
--- a/
apps/openssl.c
+++ b/
apps/openssl.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 1995-201
7
The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-201
8
The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@
-7,6
+7,7
@@
* https://www.openssl.org/source/license.html
*/
* https://www.openssl.org/source/license.html
*/
+#include <internal/cryptlib.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@
-26,8
+27,9
@@
#ifdef OPENSSL_SYS_VMS
# include <unixio.h>
#endif
#ifdef OPENSSL_SYS_VMS
# include <unixio.h>
#endif
-#define INCLUDE_FUNCTION_TABLE
#include "apps.h"
#include "apps.h"
+#define INCLUDE_FUNCTION_TABLE
+#include "progs.h"
/* Structure to hold the number of columns to be displayed and the
* field width used to display them.
/* Structure to hold the number of columns to be displayed and the
* field width used to display them.
@@
-72,15
+74,15
@@
static void calculate_columns(DISPLAY_COLUMNS *dc)
dc->columns = (80 - 1) / dc->width;
}
dc->columns = (80 - 1) / dc->width;
}
-static int apps_startup()
+static int apps_startup(
void
)
{
#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);
#endif
/* Set non-default library initialisation settings */
{
#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);
#endif
/* Set non-default library initialisation settings */
- if (!OPENSSL_init_
crypto
(OPENSSL_INIT_ENGINE_ALL_BUILTIN
-
| OPENSSL_INIT_LOAD_CONFIG, NULL))
+ if (!OPENSSL_init_
ssl
(OPENSSL_INIT_ENGINE_ALL_BUILTIN
+ | OPENSSL_INIT_LOAD_CONFIG, NULL))
return 0;
setup_ui_method();
return 0;
setup_ui_method();
@@
-88,12
+90,13
@@
static int apps_startup()
return 1;
}
return 1;
}
-static void apps_shutdown()
+static void apps_shutdown(
void
)
{
destroy_ui_method();
{
destroy_ui_method();
+ destroy_prefix_method();
}
}
-static char *make_config_name()
+static char *make_config_name(
void
)
{
const char *t;
size_t len;
{
const char *t;
size_t len;
@@
-187,7
+190,7
@@
int main(int argc, char *argv[])
for (;;) {
ret = 0;
/* Read a line, continue reading if line ends with \ */
for (;;) {
ret = 0;
/* Read a line, continue reading if line ends with \ */
- for (p = buf, n = sizeof
buf
, i = 0, first = 1; n > 0; first = 0) {
+ for (p = buf, n = sizeof
(buf)
, i = 0, first = 1; n > 0; first = 0) {
prompt = first ? "OpenSSL> " : "> ";
p[0] = '\0';
#ifndef READLINE
prompt = first ? "OpenSSL> " : "> ";
p[0] = '\0';
#ifndef READLINE
@@
-441,6
+444,8
@@
typedef enum HELP_CHOICE {
} HELP_CHOICE;
const OPTIONS help_options[] = {
} HELP_CHOICE;
const OPTIONS help_options[] = {
+ {OPT_HELP_STR, 1, '-', "Usage: help [options]\n"},
+ {OPT_HELP_STR, 1, '-', " help [command]\n"},
{"help", OPT_hHELP, '-', "Display this summary"},
{NULL}
};
{"help", OPT_hHELP, '-', "Display this summary"},
{NULL}
};
@@
-468,6
+473,14
@@
int help_main(int argc, char **argv)
}
}
}
}
+ if (opt_num_rest() == 1) {
+ char *new_argv[3];
+
+ new_argv[0] = opt_rest()[0];
+ new_argv[1] = "--help";
+ new_argv[2] = NULL;
+ return do_cmd(prog_init(), 2, new_argv);
+ }
if (opt_num_rest() != 0) {
BIO_printf(bio_err, "Usage: %s\n", prog);
return 1;
if (opt_num_rest() != 0) {
BIO_printf(bio_err, "Usage: %s\n", prog);
return 1;
@@
-507,7
+520,7
@@
static void list_type(FUNC_TYPE ft, int one)
{
FUNCTION *fp;
int i = 0;
{
FUNCTION *fp;
int i = 0;
- DISPLAY_COLUMNS dc;
+ DISPLAY_COLUMNS dc
= {0}
;
if (!one)
calculate_columns(&dc);
if (!one)
calculate_columns(&dc);
@@
-533,7
+546,7
@@
static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
FUNCTION f, *fp;
if (argc <= 0 || argv[0] == NULL)
FUNCTION f, *fp;
if (argc <= 0 || argv[0] == NULL)
- return
(0)
;
+ return
0
;
f.name = argv[0];
fp = lh_FUNCTION_retrieve(prog, &f);
if (fp == NULL) {
f.name = argv[0];
fp = lh_FUNCTION_retrieve(prog, &f);
if (fp == NULL) {
@@
-548,7
+561,7
@@
static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
}
}
if (fp != NULL) {
}
}
if (fp != NULL) {
- return
(fp->func(argc, argv)
);
+ return
fp->func(argc, argv
);
}
if ((strncmp(argv[0], "no-", 3)) == 0) {
/*
}
if ((strncmp(argv[0], "no-", 3)) == 0) {
/*
@@
-558,7
+571,7
@@
static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
f.name = argv[0] + 3;
if (lh_FUNCTION_retrieve(prog, &f) == NULL) {
BIO_printf(bio_out, "%s\n", argv[0]);
f.name = argv[0] + 3;
if (lh_FUNCTION_retrieve(prog, &f) == NULL) {
BIO_printf(bio_out, "%s\n", argv[0]);
- return
(0)
;
+ return
0
;
}
BIO_printf(bio_out, "%s\n", argv[0] + 3);
return 1;
}
BIO_printf(bio_out, "%s\n", argv[0] + 3);
return 1;
@@
-570,7
+583,7
@@
static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[])
BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n",
argv[0]);
BIO_printf(bio_err, "Invalid command '%s'; type \"help\" for a list.\n",
argv[0]);
- return
(1)
;
+ return
1
;
}
static void list_pkey(void)
}
static void list_pkey(void)
@@
-749,6
+762,15
@@
static void list_disabled(void)
#ifdef OPENSSL_NO_SEED
BIO_puts(bio_out, "SEED\n");
#endif
#ifdef OPENSSL_NO_SEED
BIO_puts(bio_out, "SEED\n");
#endif
+#ifdef OPENSSL_NO_SM2
+ BIO_puts(bio_out, "SM2\n");
+#endif
+#ifdef OPENSSL_NO_SM3
+ BIO_puts(bio_out, "SM3\n");
+#endif
+#ifdef OPENSSL_NO_SM4
+ BIO_puts(bio_out, "SM4\n");
+#endif
#ifdef OPENSSL_NO_SOCK
BIO_puts(bio_out, "SOCK\n");
#endif
#ifdef OPENSSL_NO_SOCK
BIO_puts(bio_out, "SOCK\n");
#endif
@@
-780,16
+802,23
@@
static void list_disabled(void)
static LHASH_OF(FUNCTION) *prog_init(void)
{
static LHASH_OF(FUNCTION) *prog_init(void)
{
- LHASH_OF(FUNCTION) *ret;
+ static LHASH_OF(FUNCTION) *ret = NULL;
+ static int prog_inited = 0;
FUNCTION *f;
size_t i;
FUNCTION *f;
size_t i;
+ if (prog_inited)
+ return ret;
+
+ prog_inited = 1;
+
/* Sort alphabetically within category. For nicer help displays. */
/* Sort alphabetically within category. For nicer help displays. */
- for (i = 0, f = functions; f->name != NULL; ++f, ++i) ;
+ for (i = 0, f = functions; f->name != NULL; ++f, ++i)
+ ;
qsort(functions, i, sizeof(*functions), SortFnByName);
if ((ret = lh_FUNCTION_new(function_hash, function_cmp)) == NULL)
qsort(functions, i, sizeof(*functions), SortFnByName);
if ((ret = lh_FUNCTION_new(function_hash, function_cmp)) == NULL)
- return
(NULL)
;
+ return
NULL
;
for (f = functions; f->name != NULL; f++)
(void)lh_FUNCTION_insert(ret, f);
for (f = functions; f->name != NULL; f++)
(void)lh_FUNCTION_insert(ret, f);