Start to reduce some of the header bloat.
[openssl.git] / apps / rsautl.c
index 1bbf33d5d90f2b82238c07f9b14da58fcab5086c..56025c5f0cc1719bcca6f5a36543139c85d31e42 100644 (file)
@@ -56,7 +56,7 @@
  *
  */
 
-#ifndef NO_RSA
+#ifndef OPENSSL_NO_RSA
 
 #include "apps.h"
 #include <string.h>
@@ -157,38 +157,25 @@ int MAIN(int argc, char **argv)
                goto end;
        }
 
-       if (engine != NULL)
-               {
-               if((e = ENGINE_by_id(engine)) == NULL)
-                       {
-                       BIO_printf(bio_err,"invalid engine \"%s\"\n",
-                               engine);
-                       goto end;
-                       }
-               if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
-                       {
-                       BIO_printf(bio_err,"can't use that engine\n");
-                       goto end;
-                       }
-               BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
-               /* Free our "structural" reference. */
-               ENGINE_free(e);
-               }
+        e = setup_engine(bio_err, engine, 0);
 
 /* 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, NULL, e);
+               pkey = load_key(bio_err, keyfile, keyform,
+                       NULL, e, "Private Key");
                break;
 
                case KEY_PUBKEY:
-               pkey = load_pubkey(bio_err, keyfile, keyform, e);
+               pkey = load_pubkey(bio_err, keyfile, keyform,
+                       NULL, e, "Public Key");
                break;
 
                case KEY_CERT:
-               x = load_cert(bio_err, keyfile, keyform);
+               x = load_cert(bio_err, keyfile, keyform,
+                       NULL, e, "Certificate");
                if(x) {
                        pkey = X509_get_pubkey(x);
                        X509_free(x);
@@ -197,7 +184,6 @@ int MAIN(int argc, char **argv)
        }
 
        if(!pkey) {
-               BIO_printf(bio_err, "Error loading key\n");
                return 1;
        }
 
@@ -227,7 +213,7 @@ int MAIN(int argc, char **argv)
                }
        } else {
                out = BIO_new_fp(stdout, BIO_NOCLOSE);
-#ifdef VMS
+#ifdef OPENSSL_SYS_VMS
                {
                    BIO *tmpbio = BIO_new(BIO_f_linebuffer());
                    out = BIO_push(tmpbio, out);