summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-08-24 12:40:10 +0200
committerRichard Levitte <levitte@openssl.org>2019-08-27 18:44:36 +0200
commit096978f09908ba0f679ff905b0db4861a57eb1c8 (patch)
tree68410e1446437b1a891a6036aa308e497459d479 /apps
parentb5a276884b8e945815732845540af3c8143e8457 (diff)
OPENSSL_info(): add the item OPENSSL_INFO_SEED_SOURCE and use it
'openssl version -r' prints the seed source based on compiler macros. This does not necessarily reflect the library's idea of what seed sources to use, so we reimplement the list of seed sources as a OPENSSL_info() item and display that instead. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9689)
Diffstat (limited to 'apps')
-rw-r--r--apps/info.c7
-rw-r--r--apps/version.c36
2 files changed, 8 insertions, 35 deletions
diff --git a/apps/info.c b/apps/info.c
index a2c359e0f8..d67ed87df3 100644
--- a/apps/info.c
+++ b/apps/info.c
@@ -14,7 +14,7 @@
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_CONFIGDIR, OPT_ENGINESDIR, OPT_MODULESDIR, OPT_DSOEXT, OPT_DIRNAMESEP,
- OPT_LISTSEP
+ OPT_LISTSEP, OPT_SEEDS
} OPTION_CHOICE;
const OPTIONS info_options[] = {
@@ -30,6 +30,7 @@ const OPTIONS info_options[] = {
{"dsoext", OPT_DSOEXT, '-', "Configured extension for modules"},
{"dirnamesep", OPT_DIRNAMESEP, '-', "Directory-filename separator"},
{"listsep", OPT_LISTSEP, '-', "List separator character"},
+ {"seeds", OPT_SEEDS, '-', "Seed sources"},
{NULL}
};
@@ -74,6 +75,10 @@ opthelp:
type = OPENSSL_INFO_LIST_SEPARATOR;
dirty++;
break;
+ case OPT_SEEDS:
+ type = OPENSSL_INFO_SEED_SOURCE;
+ dirty++;
+ break;
}
}
if (opt_num_rest() != 0) {
diff --git a/apps/version.c b/apps/version.c
index 35bfb95c09..caa3e76ffe 100644
--- a/apps/version.c
+++ b/apps/version.c
@@ -157,40 +157,8 @@ opthelp:
printf("%s\n", OpenSSL_version(OPENSSL_ENGINES_DIR));
if (moddir)
printf("%s\n", OpenSSL_version(OPENSSL_MODULES_DIR));
- if (seed) {
- printf("Seeding source:");
-#ifdef OPENSSL_RAND_SEED_RTDSC
- printf(" rtdsc");
-#endif
-#ifdef OPENSSL_RAND_SEED_RDCPU
- printf(" rdrand ( rdseed rdrand )");
-#endif
-#ifdef OPENSSL_RAND_SEED_LIBRANDOM
- printf(" C-library-random");
-#endif
-#ifdef OPENSSL_RAND_SEED_GETRANDOM
- printf(" getrandom-syscall");
-#endif
-#ifdef OPENSSL_RAND_SEED_DEVRANDOM
- {
- static const char *dev[] = { DEVRANDOM, NULL };
- printlist(" random-device", dev);
- }
-#endif
-#ifdef OPENSSL_RAND_SEED_EGD
- {
- static const char *dev[] = { DEVRANDOM_EGD, NULL };
- printlist(" EGD", dev);
- }
-#endif
-#ifdef OPENSSL_RAND_SEED_NONE
- printf(" none");
-#endif
-#ifdef OPENSSL_RAND_SEED_OS
- printf(" os-specific");
-#endif
- printf("\n");
- }
+ if (seed)
+ printf("Seeding source: %s\n", OPENSSL_info(OPENSSL_INFO_SEED_SOURCE));
ret = 0;
end:
return ret;