When BN_add_word() reaches top, it shouldn't try to add the the corresponding
[openssl.git] / apps / smime.c
index b05bd704e88715a825c5e1fc1e5a2895f51183c5..ef0e4774644542ffca00bd19158697b7bd69db62 100644 (file)
@@ -428,7 +428,7 @@ int MAIN(int argc, char **argv)
        } else keyfile = NULL;
 
        if(keyfile) {
-               key = load_key(bio_err, keyfile, keyform, passin, e,
+               key = load_key(bio_err, keyfile, keyform, 0, passin, e,
                               "signing key file");
                if (!key) {
                        goto end;
@@ -471,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);