Only use DSA-functions if available.
[openssl.git] / apps / smime.c
index 28a11066392d7ed0f0b9e19e554ed375768e2948..90fe026f567781d86445d240c0e3be6e63eebe4e 100644 (file)
@@ -109,6 +109,12 @@ int MAIN(int argc, char **argv)
        args = argv + 1;
        ret = 1;
 
+       apps_startup();
+
+       if (bio_err == NULL)
+               if ((bio_err = BIO_new(BIO_s_file())) != NULL)
+                       BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT);
+
        if (!load_config(bio_err, NULL))
                goto end;
 
@@ -465,7 +471,10 @@ int MAIN(int argc, char **argv)
                p7 = PKCS7_encrypt(encerts, in, cipher, flags);
        } else if(operation == SMIME_SIGN) {
                p7 = PKCS7_sign(signer, key, other, in, flags);
-               BIO_reset(in);
+               if (BIO_reset(in) != 0 && (flags & PKCS7_DETACHED)) {
+                 BIO_printf(bio_err, "Can't rewind input file\n");
+                 goto end;
+               }
        } else {
                if(informat == FORMAT_SMIME) 
                        p7 = SMIME_read_PKCS7(in, &indata);
@@ -505,9 +514,9 @@ int MAIN(int argc, char **argv)
        } else if(operation == SMIME_VERIFY) {
                STACK_OF(X509) *signers;
                if(PKCS7_verify(p7, other, store, indata, out, flags)) {
-                       BIO_printf(bio_err, "Verification Successful\n");
+                       BIO_printf(bio_err, "Verification successful\n");
                } else {
-                       BIO_printf(bio_err, "Verification Failure\n");
+                       BIO_printf(bio_err, "Verification failure\n");
                        goto end;
                }
                signers = PKCS7_get0_signers(p7, other, flags);