From 333b070ec06d7a67538ee9d5312656a19e802dc1 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Sat, 25 Apr 2015 15:41:29 -0400 Subject: fewer NO_ENGINE #ifdef's Make setup_engine be a dummy if NO_ENGINE is enabled. The option is not enabled if NO_ENGINE is enabled, so the one "wasted" variable just sits there. Removes some variables and code. Reviewed-by: Richard Levitte --- apps/s_client.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'apps/s_client.c') diff --git a/apps/s_client.c b/apps/s_client.c index 900efe7..0d03005 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -591,7 +591,6 @@ OPTIONS s_client_options[] = { {"verify_quiet", OPT_VERIFY_QUIET, '-'}, {"brief", OPT_BRIEF, '-'}, {"prexit", OPT_PREXIT, '-'}, - {"ssl_client_engine", OPT_SSL_CLIENT_ENGINE, 's'}, {"trace", OPT_TRACE, '-'}, {"security_debug", OPT_SECURITY_DEBUG, '-'}, {"security_debug_verbose", OPT_SECURITY_DEBUG_VERBOSE, '-'}, @@ -603,6 +602,7 @@ OPTIONS s_client_options[] = { {"verifyCAfile", OPT_VERIFYCAFILE, '<'}, #ifndef OPENSSL_NO_ENGINE {"engine", OPT_ENGINE, 's', "Use engine, possibly a hardware device"}, + {"ssl_client_engine", OPT_SSL_CLIENT_ENGINE, 's'}, #endif OPT_S_OPTIONS, OPT_V_OPTIONS, @@ -649,7 +649,6 @@ int s_client_main(int argc, char **argv) NULL; char *passarg = NULL, *pass = NULL, *vfyCApath = NULL, *vfyCAfile = NULL; char *sess_in = NULL, *sess_out = NULL, *crl_file = NULL, *p; - char *engine_id = NULL, *ssl_client_engine_id = NULL; char *jpake_secret = NULL; const char *unix_path = NULL; struct sockaddr peer; @@ -674,8 +673,8 @@ int s_client_main(int argc, char **argv) #endif #ifndef OPENSSL_NO_ENGINE ENGINE *ssl_client_engine = NULL; - ENGINE *e = NULL; #endif + ENGINE *e = NULL; #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) struct timeval tv; #endif @@ -829,10 +828,17 @@ int s_client_main(int argc, char **argv) #endif break; case OPT_ENGINE: - engine_id = opt_arg(); + e = setup_engine(opt_arg(), 1); break; case OPT_SSL_CLIENT_ENGINE: - ssl_client_engine_id = opt_arg(); +#ifndef OPENSSL_NO_ENGINE + ssl_client_engine = ENGINE_by_id(opt_arg()); + if (ssl_client_engine == NULL) { + BIO_printf(bio_err, "Error getting client auth engine\n"); + goto opthelp; + } + break; +#endif break; case OPT_RAND: inrand = opt_arg(); @@ -1075,17 +1081,6 @@ int s_client_main(int argc, char **argv) next_proto.data = NULL; #endif -#ifndef OPENSSL_NO_ENGINE - e = setup_engine(engine_id, 1); - if (ssl_client_engine_id) { - ssl_client_engine = ENGINE_by_id(ssl_client_engine_id); - if (ssl_client_engine == NULL) { - BIO_printf(bio_err, "Error getting client auth engine\n"); - goto end; - } - } -#endif - if (!app_passwd(passarg, NULL, &pass, NULL)) { BIO_printf(bio_err, "Error getting password\n"); goto end; -- cgit v1.1