3333
3434typedef enum OPTION_choice {
3535 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
36+ OPT_B , OPT_D , OPT_E , OPT_M , OPT_F , OPT_O , OPT_P , OPT_V , OPT_A , OPT_R , OPT_C
3737} OPTION_CHOICE ;
3838
3939const OPTIONS version_options [] = {
@@ -48,24 +48,15 @@ const OPTIONS version_options[] = {
4848 {"p" , OPT_P , '-' , "Show target build platform" },
4949 {"r" , OPT_R , '-' , "Show random seeding options" },
5050 {"v" , OPT_V , '-' , "Show library version" },
51+ {"c" , OPT_C , '-' , "Show CPU settings info" },
5152 {NULL }
5253};
5354
54- #if defined(OPENSSL_RAND_SEED_DEVRANDOM ) || defined(OPENSSL_RAND_SEED_EGD )
55- static void printlist (const char * prefix , const char * * dev )
56- {
57- printf ("%s (" , prefix );
58- for ( ; * dev != NULL ; dev ++ )
59- printf (" \"%s\"" , * dev );
60- printf (" )" );
61- }
62- #endif
63-
6455int version_main (int argc , char * * argv )
6556{
6657 int ret = 1 , dirty = 0 , seed = 0 ;
6758 int cflags = 0 , version = 0 , date = 0 , options = 0 , platform = 0 , dir = 0 ;
68- int engdir = 0 , moddir = 0 ;
59+ int engdir = 0 , moddir = 0 , cpuinfo = 0 ;
6960 char * prog ;
7061 OPTION_CHOICE o ;
7162
@@ -108,9 +99,12 @@ int version_main(int argc, char **argv)
10899 case OPT_V :
109100 dirty = version = 1 ;
110101 break ;
102+ case OPT_C :
103+ dirty = cpuinfo = 1 ;
104+ break ;
111105 case OPT_A :
112106 seed = options = cflags = version = date = platform
113- = dir = engdir = moddir
107+ = dir = engdir = moddir = cpuinfo
114108 = 1 ;
115109 break ;
116110 }
@@ -157,8 +151,12 @@ int version_main(int argc, char **argv)
157151 printf ("%s\n" , OpenSSL_version (OPENSSL_ENGINES_DIR ));
158152 if (moddir )
159153 printf ("%s\n" , OpenSSL_version (OPENSSL_MODULES_DIR ));
160- if (seed )
161- printf ("Seeding source: %s\n" , OPENSSL_info (OPENSSL_INFO_SEED_SOURCE ));
154+ if (seed ) {
155+ const char * src = OPENSSL_info (OPENSSL_INFO_SEED_SOURCE );
156+ printf ("Seeding source: %s\n" , src ? src : "N/A" );
157+ }
158+ if (cpuinfo )
159+ printf ("%s\n" , OpenSSL_version (OPENSSL_CPU_INFO ));
162160 ret = 0 ;
163161 end :
164162 return ret ;
0 commit comments