diff options
author | David von Oheimb <David.von.Oheimb@siemens.com> | 2017-12-15 20:50:37 +0100 |
---|---|---|
committer | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-04-24 18:00:24 +0200 |
commit | 9d5aca655323d795ad8c28fa6be47250a08c18c7 (patch) | |
tree | df73c17256c994c1f43ea708f18fc172cd17e7f9 /apps/req.c | |
parent | 852c2ed260860b6b85c84f9fe96fb4d23d49c9f2 (diff) |
Add function load_csr(file,format,desc) to apps/lib/apps.c
Make use of new load_csr() in 'ca', 'req', and 'x509' app
Add '-inform' and '-certform' option to 'ca' app
Add 'desc' parameter to load_crl() function defined in apps/lib/apps.c
Allow 'desc' parameter to be NULL (gives option to suppress error output)
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/4940)
Diffstat (limited to 'apps/req.c')
-rw-r--r-- | apps/req.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/apps/req.c b/apps/req.c index 9ab120c34f..6740f21c35 100644 --- a/apps/req.c +++ b/apps/req.c @@ -230,7 +230,7 @@ static int duplicated(LHASH_OF(OPENSSL_STRING) *addexts, char *kv) int req_main(int argc, char **argv) { ASN1_INTEGER *serial = NULL; - BIO *in = NULL, *out = NULL; + BIO *out = NULL; ENGINE *e = NULL, *gen_eng = NULL; EVP_PKEY *pkey = NULL; EVP_PKEY_CTX *genctx = NULL; @@ -469,7 +469,7 @@ int req_main(int argc, char **argv) BIO_printf(bio_err, "Using configuration from %s\n", template); if ((req_conf = app_load_config(template)) == NULL) goto end; - if (addext_bio) { + if (addext_bio != NULL) { if (verbose) BIO_printf(bio_err, "Using additional configuration from command line\n"); @@ -715,18 +715,9 @@ int req_main(int argc, char **argv) } if (!newreq) { - in = bio_open_default(infile, 'r', informat); - if (in == NULL) + req = load_csr(infile, informat, "X509 request"); + if (req == NULL) goto end; - - if (informat == FORMAT_ASN1) - req = d2i_X509_REQ_bio(in, NULL); - else - req = PEM_read_bio_X509_REQ(in, NULL, NULL, NULL); - if (req == NULL) { - BIO_printf(bio_err, "unable to load X509 request\n"); - goto end; - } } if (newreq || x509) { @@ -992,7 +983,6 @@ int req_main(int argc, char **argv) NCONF_free(req_conf); NCONF_free(addext_conf); BIO_free(addext_bio); - BIO_free(in); BIO_free_all(out); EVP_PKEY_free(pkey); EVP_PKEY_CTX_free(genctx); |