Add the possibility to build without the ENGINE framework.
[openssl.git] / apps / ca.c
index 0ef23ad79fe54a45e97f34d203191663ae10d9ad..6722c5dbc95ccb8e259b174389c907f1ceeb5bed 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -196,7 +196,9 @@ static char *ca_usage[]={
 " -extensions ..  - Extension section (override value in config file)\n",
 " -extfile file   - Configuration file with X509v3 extentions to add\n",
 " -crlexts ..     - CRL extension section (override value in config file)\n",
+#ifndef OPENSSL_NO_ENGINE
 " -engine e       - use engine e, possibly a hardware device.\n",
+#endif
 " -status serial  - Shows certificate status given the serial number\n",
 " -updatedb       - Updates db for expired certificates\n",
 NULL
@@ -333,7 +335,9 @@ int MAIN(int argc, char **argv)
 #define BSIZE 256
        MS_STATIC char buf[3][BSIZE];
        char *randfile=NULL;
+#ifndef OPENSSL_NO_ENGINE
        char *engine = NULL;
+#endif
        char *tofree=NULL;
 
 #ifdef EFENCE
@@ -537,11 +541,13 @@ EF_ALIGNMENT=0;
                        rev_arg = *(++argv);
                        rev_type = REV_CA_COMPROMISE;
                        }
+#ifndef OPENSSL_NO_ENGINE
                else if (strcmp(*argv,"-engine") == 0)
                        {
                        if (--argc < 1) goto bad;
                        engine= *(++argv);
                        }
+#endif
                else
                        {
 bad:
@@ -562,7 +568,9 @@ bad:
 
        ERR_load_crypto_strings();
 
+#ifndef OPENSSL_NO_ENGINE
        e = setup_engine(bio_err, engine, 0);
+#endif
 
        /*****************************************************************/
        tofree=NULL;
@@ -1641,11 +1649,12 @@ err:
        BIO_free_all(out);
        BIO_free_all(in);
 
-       sk_X509_pop_free(cert_sk,X509_free);
+       if (cert_sk)
+               sk_X509_pop_free(cert_sk,X509_free);
 
        if (ret) ERR_print_errors(bio_err);
        app_RAND_write_file(randfile, bio_err);
-       if (free_key & key)
+       if (free_key && key)
                OPENSSL_free(key);
        BN_free(serial);
        TXT_DB_free(db);