From a2b22cd6a857f249cae5d4eacb099d92e2ca3bea Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Tue, 28 Feb 2017 12:08:54 -0500 Subject: [PATCH] Remove GENCB_TEST compile flag Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/2790) --- apps/dsaparam.c | 52 +------------------------------------------------ 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/apps/dsaparam.c b/apps/dsaparam.c index 2522f1fb4b..26fcf1e9d7 100644 --- a/apps/dsaparam.c +++ b/apps/dsaparam.c @@ -24,24 +24,12 @@ NON_EMPTY_TRANSLATION_UNIT # include # include -# ifdef GENCB_TEST - -static int stop_keygen_flag = 0; - -static void timebomb_sigalarm(int foo) -{ - stop_keygen_flag = 1; -} - -# endif - static int dsa_cb(int p, int n, BN_GENCB *cb); typedef enum OPTION_choice { OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_TEXT, OPT_C, - OPT_NOOUT, OPT_GENKEY, OPT_RAND, OPT_ENGINE, - OPT_TIMEBOMB + OPT_NOOUT, OPT_GENKEY, OPT_RAND, OPT_ENGINE } OPTION_CHOICE; const OPTIONS dsaparam_options[] = { @@ -55,9 +43,6 @@ const OPTIONS dsaparam_options[] = { {"noout", OPT_NOOUT, '-', "No output"}, {"genkey", OPT_GENKEY, '-', "Generate a DSA key"}, {"rand", OPT_RAND, 's', "Files to use for random number input"}, -# ifdef GENCB_TEST - {"timebomb", OPT_TIMEBOMB, 'p', "Interrupt keygen after 'pnum' seconds"}, -# endif # ifndef OPENSSL_NO_ENGINE {"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"}, # endif @@ -73,9 +58,6 @@ int dsaparam_main(int argc, char **argv) int numbits = -1, num = 0, genkey = 0, need_rand = 0; int informat = FORMAT_PEM, outformat = FORMAT_PEM, noout = 0, C = 0; int ret = 1, i, text = 0, private = 0; -# ifdef GENCB_TEST - int timebomb = 0; -# endif char *infile = NULL, *outfile = NULL, *prog, *inrand = NULL; OPTION_CHOICE o; @@ -108,11 +90,6 @@ int dsaparam_main(int argc, char **argv) case OPT_ENGINE: e = setup_engine(opt_arg(), 0); break; - case OPT_TIMEBOMB: -# ifdef GENCB_TEST - timebomb = atoi(opt_arg()); - break; -# endif case OPT_TEXT: text = 1; break; @@ -173,30 +150,7 @@ int dsaparam_main(int argc, char **argv) BIO_printf(bio_err, "Generating DSA parameters, %d bit long prime\n", num); BIO_printf(bio_err, "This could take some time\n"); -# ifdef GENCB_TEST - if (timebomb > 0) { - struct sigaction act; - act.sa_handler = timebomb_sigalarm; - act.sa_flags = 0; - BIO_printf(bio_err, - "(though I'll stop it if not done within %d secs)\n", - timebomb); - if (sigaction(SIGALRM, &act, NULL) != 0) { - BIO_printf(bio_err, "Error, couldn't set SIGALRM handler\n"); - goto end; - } - alarm(timebomb); - } -# endif if (!DSA_generate_parameters_ex(dsa, num, NULL, 0, NULL, NULL, cb)) { -# ifdef GENCB_TEST - if (stop_keygen_flag) { - BIO_printf(bio_err, "DSA key generation time-stopped\n"); - /* This is an asked-for behaviour! */ - ret = 0; - goto end; - } -# endif ERR_print_errors(bio_err); BIO_printf(bio_err, "Error, DSA key generation failed\n"); goto end; @@ -304,10 +258,6 @@ static int dsa_cb(int p, int n, BN_GENCB *cb) c = '\n'; BIO_write(BN_GENCB_get_arg(cb), &c, 1); (void)BIO_flush(BN_GENCB_get_arg(cb)); -# ifdef GENCB_TEST - if (stop_keygen_flag) - return 0; -# endif return 1; } #endif -- 2.25.1