mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
Remove GENCB_TEST compile flag
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2790)
This commit is contained in:
parent
4d118fe007
commit
a2b22cd6a8
@ -24,24 +24,12 @@ NON_EMPTY_TRANSLATION_UNIT
|
|||||||
# include <openssl/x509.h>
|
# include <openssl/x509.h>
|
||||||
# include <openssl/pem.h>
|
# include <openssl/pem.h>
|
||||||
|
|
||||||
# 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);
|
static int dsa_cb(int p, int n, BN_GENCB *cb);
|
||||||
|
|
||||||
typedef enum OPTION_choice {
|
typedef enum OPTION_choice {
|
||||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||||
OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_TEXT, OPT_C,
|
OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_TEXT, OPT_C,
|
||||||
OPT_NOOUT, OPT_GENKEY, OPT_RAND, OPT_ENGINE,
|
OPT_NOOUT, OPT_GENKEY, OPT_RAND, OPT_ENGINE
|
||||||
OPT_TIMEBOMB
|
|
||||||
} OPTION_CHOICE;
|
} OPTION_CHOICE;
|
||||||
|
|
||||||
const OPTIONS dsaparam_options[] = {
|
const OPTIONS dsaparam_options[] = {
|
||||||
@ -55,9 +43,6 @@ const OPTIONS dsaparam_options[] = {
|
|||||||
{"noout", OPT_NOOUT, '-', "No output"},
|
{"noout", OPT_NOOUT, '-', "No output"},
|
||||||
{"genkey", OPT_GENKEY, '-', "Generate a DSA key"},
|
{"genkey", OPT_GENKEY, '-', "Generate a DSA key"},
|
||||||
{"rand", OPT_RAND, 's', "Files to use for random number input"},
|
{"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
|
# ifndef OPENSSL_NO_ENGINE
|
||||||
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
|
{"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
|
||||||
# endif
|
# endif
|
||||||
@ -73,9 +58,6 @@ int dsaparam_main(int argc, char **argv)
|
|||||||
int numbits = -1, num = 0, genkey = 0, need_rand = 0;
|
int numbits = -1, num = 0, genkey = 0, need_rand = 0;
|
||||||
int informat = FORMAT_PEM, outformat = FORMAT_PEM, noout = 0, C = 0;
|
int informat = FORMAT_PEM, outformat = FORMAT_PEM, noout = 0, C = 0;
|
||||||
int ret = 1, i, text = 0, private = 0;
|
int ret = 1, i, text = 0, private = 0;
|
||||||
# ifdef GENCB_TEST
|
|
||||||
int timebomb = 0;
|
|
||||||
# endif
|
|
||||||
char *infile = NULL, *outfile = NULL, *prog, *inrand = NULL;
|
char *infile = NULL, *outfile = NULL, *prog, *inrand = NULL;
|
||||||
OPTION_CHOICE o;
|
OPTION_CHOICE o;
|
||||||
|
|
||||||
@ -108,11 +90,6 @@ int dsaparam_main(int argc, char **argv)
|
|||||||
case OPT_ENGINE:
|
case OPT_ENGINE:
|
||||||
e = setup_engine(opt_arg(), 0);
|
e = setup_engine(opt_arg(), 0);
|
||||||
break;
|
break;
|
||||||
case OPT_TIMEBOMB:
|
|
||||||
# ifdef GENCB_TEST
|
|
||||||
timebomb = atoi(opt_arg());
|
|
||||||
break;
|
|
||||||
# endif
|
|
||||||
case OPT_TEXT:
|
case OPT_TEXT:
|
||||||
text = 1;
|
text = 1;
|
||||||
break;
|
break;
|
||||||
@ -173,30 +150,7 @@ int dsaparam_main(int argc, char **argv)
|
|||||||
BIO_printf(bio_err, "Generating DSA parameters, %d bit long prime\n",
|
BIO_printf(bio_err, "Generating DSA parameters, %d bit long prime\n",
|
||||||
num);
|
num);
|
||||||
BIO_printf(bio_err, "This could take some time\n");
|
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)) {
|
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);
|
ERR_print_errors(bio_err);
|
||||||
BIO_printf(bio_err, "Error, DSA key generation failed\n");
|
BIO_printf(bio_err, "Error, DSA key generation failed\n");
|
||||||
goto end;
|
goto end;
|
||||||
@ -304,10 +258,6 @@ static int dsa_cb(int p, int n, BN_GENCB *cb)
|
|||||||
c = '\n';
|
c = '\n';
|
||||||
BIO_write(BN_GENCB_get_arg(cb), &c, 1);
|
BIO_write(BN_GENCB_get_arg(cb), &c, 1);
|
||||||
(void)BIO_flush(BN_GENCB_get_arg(cb));
|
(void)BIO_flush(BN_GENCB_get_arg(cb));
|
||||||
# ifdef GENCB_TEST
|
|
||||||
if (stop_keygen_flag)
|
|
||||||
return 0;
|
|
||||||
# endif
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user