@@ -653,6 +653,9 @@ static char *srtp_profiles = NULL;
653653
654654typedef enum OPTION_choice {
655655 OPT_ERR = -1 , OPT_EOF = 0 , OPT_HELP , OPT_ENGINE ,
656+ #ifndef OPENSSL_NO_SKF
657+ OPT_CONFIG ,
658+ #endif
656659 OPT_4 , OPT_6 , OPT_ACCEPT , OPT_PORT , OPT_UNIX , OPT_UNLINK , OPT_NACCEPT ,
657660 OPT_VERIFY , OPT_UPPER_V_VERIFY , OPT_CONTEXT , OPT_CERT , OPT_CRL ,
658661 OPT_CRL_DOWNLOAD , OPT_SERVERINFO , OPT_CERTFORM , OPT_KEY , OPT_KEYFORM ,
@@ -866,6 +869,9 @@ OPTIONS s_server_options[] = {
866869 "Set the advertised protocols for the ALPN extension (comma-separated list)" },
867870#ifndef OPENSSL_NO_ENGINE
868871 {"engine" , OPT_ENGINE , 's' , "Use engine, possibly a hardware device" },
872+ # ifndef OPENSSL_NO_SKF
873+ {"config" , OPT_CONFIG , 's' , "Engine config file" },
874+ # endif
869875#endif
870876 {NULL , OPT_EOF , 0 , NULL }
871877};
@@ -943,6 +949,10 @@ int s_server_main(int argc, char *argv[])
943949 int no_resume_ephemeral = 0 ;
944950 unsigned int split_send_fragment = 0 , max_pipelines = 0 ;
945951 const char * s_serverinfo_file = NULL ;
952+ #ifndef OPENSSL_NO_SKF
953+ CONF * conf = NULL ;
954+ char * configfile = default_config_file ;
955+ #endif
946956
947957 /* Init of few remaining global variables */
948958 local_argc = argc ;
@@ -1388,6 +1398,11 @@ int s_server_main(int argc, char *argv[])
13881398 case OPT_ENGINE :
13891399 engine = setup_engine (opt_arg (), 1 );
13901400 break ;
1401+ #ifndef OPENSSL_NO_SKF
1402+ case OPT_CONFIG :
1403+ configfile = opt_arg ();
1404+ break ;
1405+ #endif
13911406 case OPT_RAND :
13921407 inrand = opt_arg ();
13931408 break ;
@@ -1447,6 +1462,16 @@ int s_server_main(int argc, char *argv[])
14471462 argc = opt_num_rest ();
14481463 argv = opt_rest ();
14491464
1465+ #ifndef OPENSSL_NO_SKF
1466+ if (engine )
1467+ BIO_printf (bio_err , "Using configuration from %s\n" , configfile );
1468+
1469+ if ((conf = app_load_config (configfile )) == NULL )
1470+ goto end ;
1471+ if (configfile != default_config_file && !app_load_modules (conf ))
1472+ goto end ;
1473+ #endif
1474+
14501475#ifndef OPENSSL_NO_DTLS
14511476 if (www && socket_type == SOCK_DGRAM ) {
14521477 BIO_printf (bio_err , "Can't use -HTTP, -www or -WWW with DTLS\n" );
@@ -1981,6 +2006,9 @@ int s_server_main(int argc, char *argv[])
19812006 bio_s_msg = NULL ;
19822007#ifdef CHARSET_EBCDIC
19832008 BIO_meth_free (methods_ebcdic );
2009+ #endif
2010+ #ifndef OPENSSL_NO_SKF
2011+ NCONF_free (conf );
19842012#endif
19852013 return (ret );
19862014}
0 commit comments