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>
19 typedef enum OPTION_choice {
20 OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
21 OPT_B, OPT_D, OPT_E, OPT_M, OPT_F, OPT_O, OPT_P, OPT_V, OPT_A, OPT_R, OPT_C
24 const OPTIONS version_options[] = {
25 OPT_SECTION("General"),
26 {"help", OPT_HELP, '-', "Display this summary"},
28 OPT_SECTION("Output"),
29 {"a", OPT_A, '-', "Show all data"},
30 {"b", OPT_B, '-', "Show build date"},
31 {"d", OPT_D, '-', "Show configuration directory"},
32 {"e", OPT_E, '-', "Show engines directory"},
33 {"m", OPT_M, '-', "Show modules directory"},
34 {"f", OPT_F, '-', "Show compiler flags used"},
35 {"o", OPT_O, '-', "Show some internal datatype options"},
36 {"p", OPT_P, '-', "Show target build platform"},
37 {"r", OPT_R, '-', "Show random seeding options"},
38 {"v", OPT_V, '-', "Show library version"},
39 {"c", OPT_C, '-', "Show CPU settings info"},
43 int version_main(int argc, char **argv)
45 int ret = 1, dirty = 0, seed = 0;
46 int cflags = 0, version = 0, date = 0, options = 0, platform = 0, dir = 0;
47 int engdir = 0, moddir = 0, cpuinfo = 0;
51 prog = opt_init(argc, argv, version_options);
52 while ((o = opt_next()) != OPT_EOF) {
57 BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
60 opt_help(version_options);
94 seed = options = cflags = version = date = platform
95 = dir = engdir = moddir = cpuinfo
100 if (opt_num_rest() != 0) {
101 BIO_printf(bio_err, "Extra parameters given.\n");
108 printf("%s (Library: %s)\n",
109 OPENSSL_VERSION_TEXT, OpenSSL_version(OPENSSL_VERSION));
111 printf("%s\n", OpenSSL_version(OPENSSL_BUILT_ON));
113 printf("%s\n", OpenSSL_version(OPENSSL_PLATFORM));
116 printf(" %s", BN_options());
120 printf("%s\n", OpenSSL_version(OPENSSL_CFLAGS));
122 printf("%s\n", OpenSSL_version(OPENSSL_DIR));
124 printf("%s\n", OpenSSL_version(OPENSSL_ENGINES_DIR));
126 printf("%s\n", OpenSSL_version(OPENSSL_MODULES_DIR));
128 const char *src = OPENSSL_info(OPENSSL_INFO_SEED_SOURCE);
129 printf("Seeding source: %s\n", src ? src : "N/A");
132 printf("%s\n", OpenSSL_version(OPENSSL_CPU_INFO));