]> granicus.if.org Git - openssl/commitdiff
Use the default_md config file value when signing CRLs.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 11 Nov 2004 13:46:44 +0000 (13:46 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 11 Nov 2004 13:46:44 +0000 (13:46 +0000)
PR:662

apps/ca.c

index cacacb6ffd622203b4fd27451c301abf432c3719..e98885d7e3d07743bc23b39c126970d0099bcd8b 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -994,25 +994,27 @@ bad:
                        }
                }
 
+       if ((md == NULL) && ((md=NCONF_get_string(conf,
+               section,ENV_DEFAULT_MD)) == NULL))
+               {
+               lookup_fail(section,ENV_DEFAULT_MD);
+               goto err;
+               }
+
+       if ((dgst=EVP_get_digestbyname(md)) == NULL)
+               {
+               BIO_printf(bio_err,"%s is an unsupported message digest type\n",md);
+               goto err;
+               }
+
        if (req)
                {
-               if ((md == NULL) && ((md=NCONF_get_string(conf,
-                       section,ENV_DEFAULT_MD)) == NULL))
-                       {
-                       lookup_fail(section,ENV_DEFAULT_MD);
-                       goto err;
-                       }
                if ((email_dn == 1) && ((tmp_email_dn=NCONF_get_string(conf,
                        section,ENV_DEFAULT_EMAIL_DN)) != NULL ))
                        {
                        if(strcmp(tmp_email_dn,"no") == 0)
                                email_dn=0;
                        }
-               if ((dgst=EVP_get_digestbyname(md)) == NULL)
-                       {
-                       BIO_printf(bio_err,"%s is an unsupported message digest type\n",md);
-                       goto err;
-                       }
                if (verbose)
                        BIO_printf(bio_err,"message digest is %s\n",
                                OBJ_nid2ln(dgst->type));
@@ -1395,23 +1397,10 @@ bad:
 
                /* we now have a CRL */
                if (verbose) BIO_printf(bio_err,"signing CRL\n");
-               if (md != NULL)
-                       {
-                       if ((dgst=EVP_get_digestbyname(md)) == NULL)
-                               {
-                               BIO_printf(bio_err,"%s is an unsupported message digest type\n",md);
-                               goto err;
-                               }
-                       }
-               else
-                       {
 #ifndef OPENSSL_NO_DSA
-                       if (pkey->type == EVP_PKEY_DSA) 
-                               dgst=EVP_dss1();
-                       else
+               if (pkey->type == EVP_PKEY_DSA) 
+                       dgst=EVP_dss1();
 #endif
-                               dgst=EVP_md5();
-                       }
 
                /* Add any extensions asked for */