summaryrefslogtreecommitdiffstats
path: root/apps/smime.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-04-30 16:57:53 +0200
committerMatt Caswell <matt@openssl.org>2021-05-06 11:43:32 +0100
commitd382e79632677f2457025be3d820e08d7ea12d85 (patch)
tree3a429b630ec1cce9656ee67434324c6930c677f4 /apps/smime.c
parentb86fa8c55682169c88e14e616170d6caeb208865 (diff)
Make the -inform option to be respected if possible
Add OSSL_STORE_PARAM_INPUT_TYPE and make it possible to be set when OSSL_STORE_open_ex() or OSSL_STORE_attach() is called. The input type format is enforced only in case the file type file store is used. By default we use FORMAT_UNDEF meaning the input type is not enforced. Fixes #14569 Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15100)
Diffstat (limited to 'apps/smime.c')
-rw-r--r--apps/smime.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/smime.c b/apps/smime.c
index 011dc99c4b..ea71121fb4 100644
--- a/apps/smime.c
+++ b/apps/smime.c
@@ -151,7 +151,7 @@ int smime_main(int argc, char **argv)
int noCApath = 0, noCAfile = 0, noCAstore = 0;
int flags = PKCS7_DETACHED, operation = 0, ret = 0, indef = 0;
int informat = FORMAT_SMIME, outformat = FORMAT_SMIME, keyform =
- FORMAT_PEM;
+ FORMAT_UNDEF;
int vpmtouched = 0, rv = 0;
ENGINE *e = NULL;
const char *mime_eol = "\n";
@@ -449,7 +449,8 @@ int smime_main(int argc, char **argv)
if (encerts == NULL)
goto end;
while (*argv != NULL) {
- cert = load_cert(*argv, "recipient certificate file");
+ cert = load_cert(*argv, FORMAT_UNDEF,
+ "recipient certificate file");
if (cert == NULL)
goto end;
sk_X509_push(encerts, cert);
@@ -466,7 +467,7 @@ int smime_main(int argc, char **argv)
}
if (recipfile != NULL && (operation == SMIME_DECRYPT)) {
- if ((recip = load_cert(recipfile,
+ if ((recip = load_cert(recipfile, FORMAT_UNDEF,
"recipient certificate file")) == NULL) {
ERR_print_errors(bio_err);
goto end;
@@ -573,7 +574,7 @@ int smime_main(int argc, char **argv)
for (i = 0; i < sk_OPENSSL_STRING_num(sksigners); i++) {
signerfile = sk_OPENSSL_STRING_value(sksigners, i);
keyfile = sk_OPENSSL_STRING_value(skkeys, i);
- signer = load_cert(signerfile, "signer certificate");
+ signer = load_cert(signerfile, FORMAT_UNDEF, "signer certificate");
if (signer == NULL)
goto end;
key = load_key(keyfile, keyform, 0, passin, e, "signing key");