diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-04-30 16:57:53 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-05-06 12:43:32 +0200 |
commit | d382e79632677f2457025be3d820e08d7ea12d85 (patch) | |
tree | 3a429b630ec1cce9656ee67434324c6930c677f4 /apps/cms.c | |
parent | try to document changes in salt handling for the 'enc' command (diff) | |
download | openssl-d382e79632677f2457025be3d820e08d7ea12d85.tar.xz openssl-d382e79632677f2457025be3d820e08d7ea12d85.zip |
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/cms.c')
-rw-r--r-- | apps/cms.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/apps/cms.c b/apps/cms.c index e512f1d3e8..f40049edac 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -292,7 +292,7 @@ int cms_main(int argc, char **argv) int flags = CMS_DETACHED, noout = 0, print = 0, keyidx = -1, vpmtouched = 0; int informat = FORMAT_SMIME, outformat = FORMAT_SMIME; int operation = 0, ret = 1, rr_print = 0, rr_allorfirst = -1; - int verify_retcode = 0, rctformat = FORMAT_SMIME, keyform = FORMAT_PEM; + int verify_retcode = 0, rctformat = FORMAT_SMIME, keyform = FORMAT_UNDEF; size_t secret_keylen = 0, secret_keyidlen = 0; unsigned char *pwri_pass = NULL, *pwri_tmp = NULL; unsigned char *secret_key = NULL, *secret_keyid = NULL; @@ -611,7 +611,8 @@ int cms_main(int argc, char **argv) if (operation == SMIME_ENCRYPT) { if (encerts == NULL && (encerts = sk_X509_new_null()) == NULL) goto end; - cert = load_cert(opt_arg(), "recipient certificate file"); + cert = load_cert(opt_arg(), FORMAT_UNDEF, + "recipient certificate file"); if (cert == NULL) goto end; sk_X509_push(encerts, cert); @@ -810,7 +811,8 @@ int cms_main(int argc, char **argv) if ((encerts = sk_X509_new_null()) == NULL) goto end; while (*argv) { - if ((cert = load_cert(*argv, "recipient certificate file")) == NULL) + if ((cert = load_cert(*argv, FORMAT_UNDEF, + "recipient certificate file")) == NULL) goto end; sk_X509_push(encerts, cert); cert = NULL; @@ -826,7 +828,7 @@ int cms_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; @@ -834,7 +836,7 @@ int cms_main(int argc, char **argv) } if (originatorfile != NULL) { - if ((originator = load_cert(originatorfile, + if ((originator = load_cert(originatorfile, FORMAT_UNDEF, "originator certificate file")) == NULL) { ERR_print_errors(bio_err); goto end; @@ -842,7 +844,7 @@ int cms_main(int argc, char **argv) } if (operation == SMIME_SIGN_RECEIPT) { - if ((signer = load_cert(signerfile, + if ((signer = load_cert(signerfile, FORMAT_UNDEF, "receipt signer certificate file")) == NULL) { ERR_print_errors(bio_err); goto end; @@ -1048,7 +1050,7 @@ int cms_main(int argc, char **argv) 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) { ret = 2; goto end; |