From fe5c4c885be98b9804e539cc62ebc048485b13bb Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Wed, 12 Sep 2007 21:35:39 +0000 Subject: [PATCH] Exit dsa test program if key gen error. --- fips/dsa/fips_dssvs.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/fips/dsa/fips_dssvs.c b/fips/dsa/fips_dssvs.c index 6aa82d0e31..c896351981 100644 --- a/fips/dsa/fips_dssvs.c +++ b/fips/dsa/fips_dssvs.c @@ -94,7 +94,10 @@ void pqg() dsa = FIPS_dsa_new(); if (!DSA_generate_parameters_ex(dsa, nmod,seed,0,&counter,&h,NULL)) + { do_print_errors(); + exit(1); + } pbn("P",dsa->p); pbn("Q",dsa->q); pbn("G",dsa->g); @@ -133,7 +136,10 @@ void keypair() printf("[mod = %d]\n\n",nmod); dsa = FIPS_dsa_new(); if (!DSA_generate_parameters_ex(dsa, nmod,NULL,0,NULL,NULL,NULL)) + { do_print_errors(); + exit(1); + } pbn("P",dsa->p); pbn("Q",dsa->q); pbn("G",dsa->g); @@ -142,8 +148,10 @@ void keypair() while(n--) { if (!DSA_generate_key(dsa)) + { do_print_errors(); - + exit(1); + } pbn("X",dsa->priv_key); pbn("Y",dsa->pub_key); @@ -176,7 +184,10 @@ void siggen() FIPS_dsa_free(dsa); dsa = FIPS_dsa_new(); if (!DSA_generate_parameters_ex(dsa, nmod,NULL,0,NULL,NULL,NULL)) + { do_print_errors(); + exit(1); + } pbn("P",dsa->p); pbn("Q",dsa->q); pbn("G",dsa->g); @@ -197,7 +208,10 @@ void siggen() pv("Msg",msg,n); if (!DSA_generate_key(dsa)) + { do_print_errors(); + exit(1); + } pk.type = EVP_PKEY_DSA; pk.pkey.dsa = dsa; pbn("Y",dsa->pub_key); -- 2.25.1