diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-04-30 16:57:53 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-05-06 11:43:32 +0100 |
commit | d382e79632677f2457025be3d820e08d7ea12d85 (patch) | |
tree | 3a429b630ec1cce9656ee67434324c6930c677f4 /apps/s_server.c | |
parent | b86fa8c55682169c88e14e616170d6caeb208865 (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/s_server.c')
-rw-r--r-- | apps/s_server.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/apps/s_server.c b/apps/s_server.c index 6adee7ec6d..5d9e8cd568 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -978,11 +978,11 @@ int s_server_main(int argc, char *argv[]) int no_dhe = 0; int nocert = 0, ret = 1; int noCApath = 0, noCAfile = 0, noCAstore = 0; - int s_cert_format = FORMAT_PEM, s_key_format = FORMAT_PEM; - int s_dcert_format = FORMAT_PEM, s_dkey_format = FORMAT_PEM; + int s_cert_format = FORMAT_UNDEF, s_key_format = FORMAT_UNDEF; + int s_dcert_format = FORMAT_UNDEF, s_dkey_format = FORMAT_UNDEF; int rev = 0, naccept = -1, sdebug = 0; int socket_family = AF_UNSPEC, socket_type = SOCK_STREAM, protocol = 0; - int state = 0, crl_format = FORMAT_PEM, crl_download = 0; + int state = 0, crl_format = FORMAT_UNDEF, crl_download = 0; char *host = NULL; char *port = OPENSSL_strdup(PORT); unsigned char *context = NULL; @@ -1688,7 +1688,8 @@ int s_server_main(int argc, char *argv[]) if (s_key == NULL) goto end; - s_cert = load_cert_pass(s_cert_file, 1, pass, "server certificate"); + s_cert = load_cert_pass(s_cert_file, s_cert_format, 1, pass, + "server certificate"); if (s_cert == NULL) goto end; @@ -1704,7 +1705,7 @@ int s_server_main(int argc, char *argv[]) if (s_key2 == NULL) goto end; - s_cert2 = load_cert_pass(s_cert_file2, 1, pass, + s_cert2 = load_cert_pass(s_cert_file2, s_cert_format, 1, pass, "second server certificate"); if (s_cert2 == NULL) @@ -1727,7 +1728,7 @@ int s_server_main(int argc, char *argv[]) if (crl_file != NULL) { X509_CRL *crl; - crl = load_crl(crl_file, 0, "CRL"); + crl = load_crl(crl_file, crl_format, 0, "CRL"); if (crl == NULL) goto end; crls = sk_X509_CRL_new_null(); @@ -1749,7 +1750,7 @@ int s_server_main(int argc, char *argv[]) if (s_dkey == NULL) goto end; - s_dcert = load_cert_pass(s_dcert_file, 1, dpass, + s_dcert = load_cert_pass(s_dcert_file, s_dcert_format, 1, dpass, "second server certificate"); if (s_dcert == NULL) { @@ -1975,9 +1976,9 @@ int s_server_main(int argc, char *argv[]) EVP_PKEY *dhpkey = NULL; if (dhfile != NULL) - dhpkey = load_keyparams(dhfile, 0, "DH", "DH parameters"); + dhpkey = load_keyparams(dhfile, FORMAT_UNDEF, 0, "DH", "DH parameters"); else if (s_cert_file != NULL) - dhpkey = load_keyparams(s_cert_file, 0, "DH", "DH parameters"); + dhpkey = load_keyparams(s_cert_file, FORMAT_UNDEF, 0, "DH", "DH parameters"); if (dhpkey != NULL) { BIO_printf(bio_s_out, "Setting temp DH parameters\n"); @@ -2009,7 +2010,8 @@ int s_server_main(int argc, char *argv[]) if (ctx2 != NULL) { if (dhfile != NULL) { - EVP_PKEY *dhpkey2 = load_keyparams(s_cert_file2, 0, "DH", + EVP_PKEY *dhpkey2 = load_keyparams(s_cert_file2, FORMAT_UNDEF, + 0, "DH", "DH parameters"); if (dhpkey2 != NULL) { |