2 * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
15 #include <openssl/evp.h>
16 #include <openssl/crypto.h>
17 #include <openssl/bn.h>
18 #ifndef OPENSSL_NO_MD2
19 # include <openssl/md2.h>
21 #ifndef OPENSSL_NO_RC4
22 # include <openssl/rc4.h>
24 #ifndef OPENSSL_NO_DES
25 # include <openssl/des.h>
27 #ifndef OPENSSL_NO_IDEA
28 # include <openssl/idea.h>
31 # include <openssl/blowfish.h>
34 typedef enum OPTION_choice {
35 OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
36 OPT_B, OPT_D, OPT_E, OPT_M, OPT_F, OPT_O, OPT_P, OPT_V, OPT_A, OPT_R, OPT_C
39 const OPTIONS version_options[] = {
40 OPT_SECTION("General"),
41 {"help", OPT_HELP, '-', "Display this summary"},
43 OPT_SECTION("Output"),
44 {"a", OPT_A, '-', "Show all data"},
45 {"b", OPT_B, '-', "Show build date"},
46 {"d", OPT_D, '-', "Show configuration directory"},
47 {"e", OPT_E, '-', "Show engines directory"},
48 {"m", OPT_M, '-', "Show modules directory"},
49 {"f", OPT_F, '-', "Show compiler flags used"},
50 {"o", OPT_O, '-', "Show some internal datatype options"},
51 {"p", OPT_P, '-', "Show target build platform"},
52 {"r", OPT_R, '-', "Show random seeding options"},
53 {"v", OPT_V, '-', "Show library version"},
54 {"c", OPT_C, '-', "Show CPU settings info"},
58 int version_main(int argc, char **argv)
60 int ret = 1, dirty = 0, seed = 0;
61 int cflags = 0, version = 0, date = 0, options = 0, platform = 0, dir = 0;
62 int engdir = 0, moddir = 0, cpuinfo = 0;
66 prog = opt_init(argc, argv, version_options);
67 while ((o = opt_next()) != OPT_EOF) {
72 BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
75 opt_help(version_options);
109 seed = options = cflags = version = date = platform
110 = dir = engdir = moddir = cpuinfo
115 if (opt_num_rest() != 0) {
116 BIO_printf(bio_err, "Extra parameters given.\n");
123 printf("%s (Library: %s)\n",
124 OPENSSL_VERSION_TEXT, OpenSSL_version(OPENSSL_VERSION));
126 printf("%s\n", OpenSSL_version(OPENSSL_BUILT_ON));
128 printf("%s\n", OpenSSL_version(OPENSSL_PLATFORM));
131 printf(" %s", BN_options());
132 #ifndef OPENSSL_NO_MD2
133 printf(" %s", MD2_options());
135 #ifndef OPENSSL_NO_RC4
136 printf(" %s", RC4_options());
138 #ifndef OPENSSL_NO_DES
139 printf(" %s", DES_options());
141 #ifndef OPENSSL_NO_IDEA
142 printf(" %s", IDEA_options());
144 #ifndef OPENSSL_NO_BF
145 printf(" %s", BF_options());
150 printf("%s\n", OpenSSL_version(OPENSSL_CFLAGS));
152 printf("%s\n", OpenSSL_version(OPENSSL_DIR));
154 printf("%s\n", OpenSSL_version(OPENSSL_ENGINES_DIR));
156 printf("%s\n", OpenSSL_version(OPENSSL_MODULES_DIR));
158 const char *src = OPENSSL_info(OPENSSL_INFO_SEED_SOURCE);
159 printf("Seeding source: %s\n", src ? src : "N/A");
162 printf("%s\n", OpenSSL_version(OPENSSL_CPU_INFO));