Add missing ctype.h
[openssl.git] / apps / smime.c
index 532446f49ff6778e30dcb69970f0ffe0e897e1e7..3f48278cd1c670a7ebf412a7cd0185b19bae24e3 100644 (file)
@@ -164,7 +164,7 @@ int smime_main(int argc, char **argv)
     X509_VERIFY_PARAM *vpm = NULL;
     const EVP_CIPHER *cipher = NULL;
     const EVP_MD *sign_md = NULL;
-    char *CAfile = NULL, *CApath = NULL, *inrand = NULL, *engine = NULL;
+    char *CAfile = NULL, *CApath = NULL, *inrand = NULL;
     char *certfile = NULL, *keyfile = NULL, *contfile = NULL, *prog;
     char *infile = NULL, *outfile = NULL, *signerfile = NULL, *recipfile =
         NULL;
@@ -177,9 +177,7 @@ int smime_main(int argc, char **argv)
     int informat = FORMAT_SMIME, outformat = FORMAT_SMIME, keyform =
         FORMAT_PEM;
     int vpmtouched = 0, rv = 0;
-#ifndef OPENSSL_NO_ENGINE
     ENGINE *e = NULL;
-#endif
 
     if ((vpm = X509_VERIFY_PARAM_new()) == NULL)
         return 1;
@@ -276,7 +274,7 @@ int smime_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();
@@ -408,10 +406,6 @@ int smime_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");
         goto end;
@@ -469,16 +463,16 @@ int smime_main(int argc, char **argv)
     }
 
     if (certfile) {
-        if (!(other = load_certs(certfile, FORMAT_PEM, NULL,
-                                 e, "certificate file"))) {
+        if ((other = load_certs(certfile, FORMAT_PEM, NULL,
+                                 e, "certificate file")) == NULL) {
             ERR_print_errors(bio_err);
             goto end;
         }
     }
 
     if (recipfile && (operation == SMIME_DECRYPT)) {
-        if (!(recip = load_cert(recipfile, FORMAT_PEM, NULL,
-                                e, "recipient certificate file"))) {
+        if ((recip = load_cert(recipfile, FORMAT_PEM, NULL,
+                                e, "recipient certificate file")) == NULL) {
             ERR_print_errors(bio_err);
             goto end;
         }
@@ -521,7 +515,7 @@ int smime_main(int argc, char **argv)
         }
         if (contfile) {
             BIO_free(indata);
-            if (!(indata = BIO_new_file(contfile, "rb"))) {
+            if ((indata = BIO_new_file(contfile, "rb")) == NULL) {
                 BIO_printf(bio_err, "Can't read content file %s\n", contfile);
                 goto end;
             }
@@ -533,7 +527,7 @@ int smime_main(int argc, char **argv)
         goto end;
 
     if (operation == SMIME_VERIFY) {
-        if (!(store = setup_verify(CAfile, CApath)))
+        if ((store = setup_verify(CAfile, CApath)) == NULL)
             goto end;
         X509_STORE_set_verify_cb(store, smime_cb);
         if (vpmtouched)
@@ -656,12 +650,9 @@ int smime_main(int argc, char **argv)
         ERR_print_errors(bio_err);
     sk_X509_pop_free(encerts, X509_free);
     sk_X509_pop_free(other, X509_free);
-    if (vpm)
-        X509_VERIFY_PARAM_free(vpm);
-    if (sksigners)
-        sk_OPENSSL_STRING_free(sksigners);
-    if (skkeys)
-        sk_OPENSSL_STRING_free(skkeys);
+    X509_VERIFY_PARAM_free(vpm);
+    sk_OPENSSL_STRING_free(sksigners);
+    sk_OPENSSL_STRING_free(skkeys);
     X509_STORE_free(store);
     X509_free(cert);
     X509_free(recip);
@@ -671,8 +662,7 @@ int smime_main(int argc, char **argv)
     BIO_free(in);
     BIO_free(indata);
     BIO_free_all(out);
-    if (passin)
-        OPENSSL_free(passin);
+    OPENSSL_free(passin);
     return (ret);
 }
 
@@ -703,7 +693,7 @@ static int smime_cb(int ok, X509_STORE_CTX *ctx)
         && ((error != X509_V_OK) || (ok != 2)))
         return ok;
 
-    policies_print(bio_err, ctx);
+    policies_print(ctx);
 
     return ok;