projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Synchronise VMS build system with the Unixly one
[openssl.git]
/
apps
/
smime.c
diff --git
a/apps/smime.c
b/apps/smime.c
index 8c010b3e4717b2dc603424fda2d0ebb4bc4a8f9e..04161540b64cce53343a531e6f5ce1b734a72e3d 100644
(file)
--- a/
apps/smime.c
+++ b/
apps/smime.c
@@
-1,5
+1,5
@@
/* smime.c */
/* smime.c */
-/* Written by Dr Stephen N Henson (s
henson@bigfoot.com
) for the OpenSSL
+/* Written by Dr Stephen N Henson (s
teve@openssl.org
) for the OpenSSL
* project.
*/
/* ====================================================================
* project.
*/
/* ====================================================================
@@
-93,7
+93,7
@@
int MAIN(int argc, char **argv)
const char *inmode = "r", *outmode = "w";
char *infile = NULL, *outfile = NULL;
char *signerfile = NULL, *recipfile = NULL;
const char *inmode = "r", *outmode = "w";
char *infile = NULL, *outfile = NULL;
char *signerfile = NULL, *recipfile = NULL;
- STACK *sksigners = NULL, *skkeys = NULL;
+ STACK
_OF(STRING)
*sksigners = NULL, *skkeys = NULL;
char *certfile = NULL, *keyfile = NULL, *contfile=NULL;
const EVP_CIPHER *cipher = NULL;
PKCS7 *p7 = NULL;
char *certfile = NULL, *keyfile = NULL, *contfile=NULL;
const EVP_CIPHER *cipher = NULL;
PKCS7 *p7 = NULL;
@@
-109,6
+109,7
@@
int MAIN(int argc, char **argv)
char *passargin = NULL, *passin = NULL;
char *inrand = NULL;
int need_rand = 0;
char *passargin = NULL, *passin = NULL;
char *inrand = NULL;
int need_rand = 0;
+ int indef = 0;
const EVP_MD *sign_md = NULL;
int informat = FORMAT_SMIME, outformat = FORMAT_SMIME;
int keyform = FORMAT_PEM;
const EVP_MD *sign_md = NULL;
int informat = FORMAT_SMIME, outformat = FORMAT_SMIME;
int keyform = FORMAT_PEM;
@@
-152,6
+153,10
@@
int MAIN(int argc, char **argv)
else if (!strcmp (*args, "-des"))
cipher = EVP_des_cbc();
#endif
else if (!strcmp (*args, "-des"))
cipher = EVP_des_cbc();
#endif
+#ifndef OPENSSL_NO_SEED
+ else if (!strcmp (*args, "-seed"))
+ cipher = EVP_seed_cbc();
+#endif
#ifndef OPENSSL_NO_RC2
else if (!strcmp (*args, "-rc2-40"))
cipher = EVP_rc2_40_cbc();
#ifndef OPENSSL_NO_RC2
else if (!strcmp (*args, "-rc2-40"))
cipher = EVP_rc2_40_cbc();
@@
-196,6
+201,12
@@
int MAIN(int argc, char **argv)
flags |= PKCS7_BINARY;
else if (!strcmp (*args, "-nosigs"))
flags |= PKCS7_NOSIGS;
flags |= PKCS7_BINARY;
else if (!strcmp (*args, "-nosigs"))
flags |= PKCS7_NOSIGS;
+ else if (!strcmp (*args, "-stream"))
+ indef = 1;
+ else if (!strcmp (*args, "-indef"))
+ indef = 1;
+ else if (!strcmp (*args, "-noindef"))
+ indef = 0;
else if (!strcmp (*args, "-nooldmime"))
flags |= PKCS7_NOOLDMIMETYPE;
else if (!strcmp (*args, "-crlfeol"))
else if (!strcmp (*args, "-nooldmime"))
flags |= PKCS7_NOOLDMIMETYPE;
else if (!strcmp (*args, "-crlfeol"))
@@
-249,13
+260,13
@@
int MAIN(int argc, char **argv)
if (signerfile)
{
if (!sksigners)
if (signerfile)
{
if (!sksigners)
- sksigners = sk_new_null();
- sk_push(sksigners, signerfile);
+ sksigners = sk_
STRING_
new_null();
+ sk_
STRING_
push(sksigners, signerfile);
if (!keyfile)
keyfile = signerfile;
if (!skkeys)
if (!keyfile)
keyfile = signerfile;
if (!skkeys)
- skkeys = sk_new_null();
- sk_push(skkeys, keyfile);
+ skkeys = sk_
STRING_
new_null();
+ sk_
STRING_
push(skkeys, keyfile);
keyfile = NULL;
}
signerfile = *++args;
keyfile = NULL;
}
signerfile = *++args;
@@
-291,12
+302,12
@@
int MAIN(int argc, char **argv)
goto argerr;
}
if (!sksigners)
goto argerr;
}
if (!sksigners)
- sksigners = sk_new_null();
- sk_push(sksigners, signerfile);
+ sksigners = sk_
STRING_
new_null();
+ sk_
STRING_
push(sksigners, signerfile);
signerfile = NULL;
if (!skkeys)
signerfile = NULL;
if (!skkeys)
- skkeys = sk_new_null();
- sk_push(skkeys, keyfile);
+ skkeys = sk_
STRING_
new_null();
+ sk_
STRING_
push(skkeys, keyfile);
}
keyfile = *++args;
}
}
keyfile = *++args;
}
@@
-378,13
+389,13
@@
int MAIN(int argc, char **argv)
if (signerfile)
{
if (!sksigners)
if (signerfile)
{
if (!sksigners)
- sksigners = sk_new_null();
- sk_push(sksigners, signerfile);
+ sksigners = sk_
STRING_
new_null();
+ sk_
STRING_
push(sksigners, signerfile);
if (!skkeys)
if (!skkeys)
- skkeys = sk_new_null();
+ skkeys = sk_
STRING_
new_null();
if (!keyfile)
keyfile = signerfile;
if (!keyfile)
keyfile = signerfile;
- sk_push(skkeys, keyfile);
+ sk_
STRING_
push(skkeys, keyfile);
}
if (!sksigners)
{
}
if (!sksigners)
{
@@
-429,6
+440,9
@@
int MAIN(int argc, char **argv)
BIO_printf (bio_err, "-des3 encrypt with triple DES\n");
BIO_printf (bio_err, "-des encrypt with DES\n");
#endif
BIO_printf (bio_err, "-des3 encrypt with triple DES\n");
BIO_printf (bio_err, "-des encrypt with DES\n");
#endif
+#ifndef OPENSSL_NO_SEED
+ BIO_printf (bio_err, "-seed encrypt with SEED\n");
+#endif
#ifndef OPENSSL_NO_RC2
BIO_printf (bio_err, "-rc2-40 encrypt with RC2-40 (default)\n");
BIO_printf (bio_err, "-rc2-64 encrypt with RC2-64\n");
#ifndef OPENSSL_NO_RC2
BIO_printf (bio_err, "-rc2-40 encrypt with RC2-40 (default)\n");
BIO_printf (bio_err, "-rc2-64 encrypt with RC2-64\n");
@@
-666,27
+680,37
@@
int MAIN(int argc, char **argv)
ret = 3;
if (operation == SMIME_ENCRYPT)
ret = 3;
if (operation == SMIME_ENCRYPT)
+ {
+ if (indef)
+ flags |= PKCS7_STREAM;
p7 = PKCS7_encrypt(encerts, in, cipher, flags);
p7 = PKCS7_encrypt(encerts, in, cipher, flags);
+ }
else if (operation & SMIME_SIGNERS)
{
int i;
else if (operation & SMIME_SIGNERS)
{
int i;
- /* If detached data
and SMIME output enable partial
- *
signing
.
+ /* If detached data
content we only enable streaming if
+ *
S/MIME output format
.
*/
if (operation == SMIME_SIGN)
{
*/
if (operation == SMIME_SIGN)
{
- if ((flags & PKCS7_DETACHED)
- && (outformat == FORMAT_SMIME))
+ if (flags & PKCS7_DETACHED)
+ {
+ if (outformat == FORMAT_SMIME)
+ flags |= PKCS7_STREAM;
+ }
+ else if (indef)
flags |= PKCS7_STREAM;
flags |= PKCS7_PARTIAL;
p7 = PKCS7_sign(NULL, NULL, other, in, flags);
flags |= PKCS7_STREAM;
flags |= PKCS7_PARTIAL;
p7 = PKCS7_sign(NULL, NULL, other, in, flags);
+ if (!p7)
+ goto end;
}
else
flags |= PKCS7_REUSE_DIGEST;
}
else
flags |= PKCS7_REUSE_DIGEST;
- for (i = 0; i < sk_num(sksigners); i++)
+ for (i = 0; i < sk_
STRING_
num(sksigners); i++)
{
{
- signerfile = sk_value(sksigners, i);
- keyfile = sk_value(skkeys, i);
+ signerfile = sk_
STRING_
value(sksigners, i);
+ keyfile = sk_
STRING_
value(skkeys, i);
signer = load_cert(bio_err, signerfile,FORMAT_PEM, NULL,
e, "signer certificate");
if (!signer)
signer = load_cert(bio_err, signerfile,FORMAT_PEM, NULL,
e, "signer certificate");
if (!signer)
@@
-764,9
+788,9
@@
int MAIN(int argc, char **argv)
SMIME_write_PKCS7(out, p7, in, flags);
}
else if (outformat == FORMAT_PEM)
SMIME_write_PKCS7(out, p7, in, flags);
}
else if (outformat == FORMAT_PEM)
- PEM_write_bio_PKCS7
(out,p7
);
+ PEM_write_bio_PKCS7
_stream(out, p7, in, flags
);
else if (outformat == FORMAT_ASN1)
else if (outformat == FORMAT_ASN1)
- i2d_PKCS7_bio
(out,p7
);
+ i2d_PKCS7_bio
_stream(out,p7, in, flags
);
else
{
BIO_printf(bio_err, "Bad output format for PKCS#7 file\n");
else
{
BIO_printf(bio_err, "Bad output format for PKCS#7 file\n");
@@
-783,9
+807,9
@@
end:
if (vpm)
X509_VERIFY_PARAM_free(vpm);
if (sksigners)
if (vpm)
X509_VERIFY_PARAM_free(vpm);
if (sksigners)
- sk_free(sksigners);
+ sk_
STRING_
free(sksigners);
if (skkeys)
if (skkeys)
- sk_free(skkeys);
+ sk_
STRING_
free(skkeys);
X509_STORE_free(store);
X509_free(cert);
X509_free(recip);
X509_STORE_free(store);
X509_free(cert);
X509_free(recip);