Do not call ENGINE_setup_bsd_cryptodev() when OPENSSL_NO_ENGINE is defined.
[openssl.git] / apps / rsautl.c
index e4bc219063a7942a3b54454d75f0174387b734ef..5a6fd115f41b9c783d9e5c6b0cefb497bcc22dc6 100644 (file)
@@ -85,7 +85,9 @@ int MAIN(int argc, char **argv)
        ENGINE *e = NULL;
        BIO *in = NULL, *out = NULL;
        char *infile = NULL, *outfile = NULL;
+#ifndef OPENSSL_NO_ENGINE
        char *engine = NULL;
+#endif
        char *keyfile = NULL;
        char rsa_mode = RSA_VERIFY, key_type = KEY_PRIVKEY;
        int keyform = FORMAT_PEM;
@@ -104,6 +106,9 @@ int MAIN(int argc, char **argv)
        argv++;
 
        if(!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
+
+       if (!load_config(bio_err, NULL))
+               goto end;
        ERR_load_crypto_strings();
        OpenSSL_add_all_algorithms();
        pad = RSA_PKCS1_PADDING;
@@ -120,11 +125,13 @@ int MAIN(int argc, char **argv)
                        if (--argc < 1) badarg = 1;
                        keyfile = *(++argv);
                } else if (strcmp(*argv,"-keyform") == 0) {
-                       if (--argc < 1) goto bad;
+                       if (--argc < 1) badarg = 1;
                        keyform=str2fmt(*(++argv));
+#ifndef OPENSSL_NO_ENGINE
                } else if(!strcmp(*argv, "-engine")) {
                        if (--argc < 1) badarg = 1;
                        engine = *(++argv);
+#endif
                } else if(!strcmp(*argv, "-pubin")) {
                        key_type = KEY_PUBKEY;
                } else if(!strcmp(*argv, "-certin")) {
@@ -159,19 +166,21 @@ int MAIN(int argc, char **argv)
                goto end;
        }
 
+#ifndef OPENSSL_NO_ENGINE
         e = setup_engine(bio_err, engine, 0);
+#endif
 
 /* FIXME: seed PRNG only if needed */
        app_RAND_load_file(NULL, bio_err, 0);
        
        switch(key_type) {
                case KEY_PRIVKEY:
-               pkey = load_key(bio_err, keyfile, keyform,
+               pkey = load_key(bio_err, keyfile, keyform, 0,
                        NULL, e, "Private Key");
                break;
 
                case KEY_PUBKEY:
-               pkey = load_pubkey(bio_err, keyfile, keyform,
+               pkey = load_pubkey(bio_err, keyfile, keyform, 0,
                        NULL, e, "Public Key");
                break;
 
@@ -302,7 +311,9 @@ static void usage()
        BIO_printf(bio_err, "-encrypt        encrypt with public key\n");
        BIO_printf(bio_err, "-decrypt        decrypt with private key\n");
        BIO_printf(bio_err, "-hexdump        hex dump output\n");
+#ifndef OPENSSL_NO_ENGINE
        BIO_printf(bio_err, "-engine e       use engine e, possibly a hardware device.\n");
+#endif
 
 }