Commit 333b070e authored by Rich Salz's avatar Rich Salz
Browse files

fewer NO_ENGINE #ifdef's



Make setup_engine be a dummy if NO_ENGINE is enabled.
The option is not enabled if NO_ENGINE is enabled, so the one "wasted"
variable just sits there. Removes some variables and code.

Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
parent c54cc2b1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -431,7 +431,9 @@ STACK_OF(X509_CRL) *load_crls(const char *file, int format,
X509_STORE *setup_verify(char *CAfile, char *CApath);
int ctx_set_verify_locations(SSL_CTX *ctx,
                             const char *CAfile, const char *CApath);
# ifndef OPENSSL_NO_ENGINE
# ifdef OPENSSL_NO_ENGINE
#  define setup_engine(engine, debug) NULL
# else
ENGINE *setup_engine(const char *engine, int debug);
# endif
# ifndef OPENSSL_NO_OCSP
+6 −11
Original line number Diff line number Diff line
@@ -292,17 +292,15 @@ int ca_main(int argc, char **argv)
    X509_CRL *crl = NULL;
    const EVP_MD *dgst = NULL;
    char *configfile = NULL, *md = NULL, *policy = NULL, *keyfile = NULL;
    char *certfile = NULL, *crl_ext = NULL, *crlnumberfile = NULL, *enddate =
        NULL;
    char *certfile = NULL, *crl_ext = NULL, *crlnumberfile = NULL;
    char *infile = NULL, *spkac_file = NULL, *ss_cert_file = NULL;
    char *extensions = NULL, *extfile = NULL, *key = NULL, *passinarg = NULL;
    char *outdir = NULL, *outfile = NULL, *rev_arg = NULL, *ser_status = NULL;
    char *serialfile = NULL, *startdate = NULL, *subj = NULL, *tmp_email_dn =
        NULL;
    char *prog;
    char *const *pp;
    char *dbfile = NULL, *engine = NULL, *f, *randfile = NULL, *tofree = NULL;
    char *serialfile = NULL, *startdate = NULL, *subj = NULL;
    char *prog, *enddate = NULL, *tmp_email_dn = NULL;
    char *dbfile = NULL, *f, *randfile = NULL, *tofree = NULL;
    char buf[3][BSIZE];
    char *const *pp;
    const char *p;
    int create_ser = 0, free_key = 0, total = 0, total_done = 0;
    int batch = 0, default_op = 1, doupdatedb = 0, ext_copy = EXT_COPY_NONE;
@@ -488,7 +486,7 @@ opthelp:
            rev_type = REV_CA_COMPROMISE;
            break;
        case OPT_ENGINE:
            engine = opt_arg();
            e = setup_engine(opt_arg(), 0);
            break;
        }
    }
@@ -542,9 +540,6 @@ end_of_options:
        OPENSSL_free(tofree);
        tofree = NULL;
    }
#ifndef OPENSSL_NO_ENGINE
    e = setup_engine(engine, 0);
#endif

    /* Lets get the config section we are using */
    if (section == NULL) {
+2 −5
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ int cms_main(int argc, char **argv)
    X509_STORE *store = NULL;
    X509_VERIFY_PARAM *vpm = NULL;
    char *certfile = NULL, *keyfile = NULL, *contfile = NULL;
    char *CAfile = NULL, *CApath = NULL, *certsoutfile = NULL, *engine = NULL;
    char *CAfile = NULL, *CApath = NULL, *certsoutfile = NULL;
    char *infile = NULL, *outfile = NULL, *rctfile = NULL, *inrand = NULL;
    char *passinarg = NULL, *passin = NULL, *signerfile = NULL, *recipfile =
        NULL;
@@ -475,7 +475,7 @@ int cms_main(int argc, char **argv)
            need_rand = 1;
            break;
        case OPT_ENGINE:
            engine = opt_arg();
            e = setup_engine(opt_arg(), 0);
            break;
        case OPT_PASSIN:
            passinarg = opt_arg();
@@ -668,9 +668,6 @@ int cms_main(int argc, char **argv)
    } else if (!operation)
        goto opthelp;

# ifndef OPENSSL_NO_ENGINE
    e = setup_engine(engine, 0);
# endif

    if (!app_passwd(passinarg, NULL, &passin, NULL)) {
        BIO_printf(bio_err, "Error getting password\n");
+5 −13
Original line number Diff line number Diff line
@@ -101,10 +101,6 @@ OPTIONS dgst_options[] = {
     "Verify a signature using private key in file"},
    {"signature", OPT_SIGNATURE, '<', "File with signature to verify"},
    {"keyform", OPT_KEYFORM, 'f', "Key file format (PEM or ENGINE)"},
#ifndef OPENSSL_NO_ENGINE
    {"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
#endif
    {"engine_impl", OPT_ENGINE_IMPL, '-'},
    {"hex", OPT_HEX, '-', "Print as hex dump"},
    {"binary", OPT_BINARY, '-', "Print in binary form"},
    {"d", OPT_DEBUG, '-', "Print debug info"},
@@ -115,6 +111,10 @@ OPTIONS dgst_options[] = {
    {"mac", OPT_MAC, 's', "Create MAC (not neccessarily HMAC)"},
    {"sigop", OPT_SIGOPT, 's', "Signature parameter in n:v form"},
    {"macop", OPT_MACOPT, 's', "MAC algorithm parameters in n:v form or key"},
#ifndef OPENSSL_NO_ENGINE
    {"engine", OPT_ENGINE, 's', "Use engine e, possibly a hardware device"},
    {"engine_impl", OPT_ENGINE_IMPL, '-'},
#endif
    {"", OPT_DIGEST, '-', "Any supported digest"},
    {NULL}
};
@@ -136,10 +136,7 @@ int dgst_main(int argc, char **argv)
    int i, ret = 1, out_bin = -1, want_pub = 0, do_verify =
        0, non_fips_allow = 0;
    unsigned char *buf = NULL, *sigbuf = NULL;
#ifndef OPENSSL_NO_ENGINE
    char *engine = NULL;
    int engine_impl = 0;
#endif

    prog = opt_progname(argv[0]);
    if ((buf = (unsigned char *)OPENSSL_malloc(BUFSIZE)) == NULL) {
@@ -193,15 +190,12 @@ int dgst_main(int argc, char **argv)
            if (!opt_format(opt_arg(), OPT_FMT_ANY, &keyform))
                goto opthelp;
            break;
#ifndef OPENSSL_NO_ENGINE
        case OPT_ENGINE:
            engine = opt_arg();
            e = setup_engine(engine, 0);
            e = setup_engine(opt_arg(), 0);
            break;
        case OPT_ENGINE_IMPL:
            engine_impl = 1;
            break;
#endif
        case OPT_HEX:
            out_bin = 0;
            break;
@@ -250,10 +244,8 @@ int dgst_main(int argc, char **argv)
                   "No signature to verify: use the -signature option\n");
        goto end;
    }
#ifndef OPENSSL_NO_ENGINE
    if (engine_impl)
        impl = e;
#endif

    in = BIO_new(BIO_s_file());
    bmd = BIO_new(BIO_f_md());
+2 −7
Original line number Diff line number Diff line
@@ -167,8 +167,7 @@ int dhparam_main(int argc, char **argv)
{
    BIO *in = NULL, *out = NULL;
    DH *dh = NULL;
    char *engine = NULL, *infile = NULL, *outfile = NULL, *prog, *inrand =
        NULL;
    char *infile = NULL, *outfile = NULL, *prog, *inrand = NULL;
    int dsaparam = 0, i, text = 0, C = 0, ret = 1, num = 0, g = 0;
    int informat = FORMAT_PEM, outformat = FORMAT_PEM, check = 0, noout = 0;
    OPTION_CHOICE o;
@@ -200,7 +199,7 @@ int dhparam_main(int argc, char **argv)
            outfile = opt_arg();
            break;
        case OPT_ENGINE:
            engine = opt_arg();
            (void)setup_engine(opt_arg(), 0);
            break;
        case OPT_CHECK:
            check = 1;
@@ -234,10 +233,6 @@ int dhparam_main(int argc, char **argv)
    if (argv[0] && (!opt_int(argv[0], &num) || num <= 0))
        goto end;

# ifndef OPENSSL_NO_ENGINE
    setup_engine(engine, 0);
# endif

    if (g && !num)
        num = DEFBITS;

Loading