From 46f4e7fa2def442f27dc6774b7bc07a16ae49e80 Mon Sep 17 00:00:00 2001 From: joshua Date: Fri, 11 Nov 2022 17:07:38 +0000 Subject: [PATCH] Remove the legacy interactive mode from openssl(1). This removes the legacy interactive mode from openssl(1) since it is rarely used, complicates the code, and has also been removed from OpenSSL in version 3.x.x. ok tb@ jsing@ --- usr.bin/openssl/asn1pars.c | 10 +-- usr.bin/openssl/ca.c | 10 +-- usr.bin/openssl/certhash.c | 10 +-- usr.bin/openssl/ciphers.c | 10 +-- usr.bin/openssl/cms.c | 10 +-- usr.bin/openssl/crl.c | 10 +-- usr.bin/openssl/crl2p7.c | 10 +-- usr.bin/openssl/dgst.c | 10 +-- usr.bin/openssl/dh.c | 10 +-- usr.bin/openssl/dhparam.c | 10 +-- usr.bin/openssl/dsa.c | 10 +-- usr.bin/openssl/dsaparam.c | 10 +-- usr.bin/openssl/ec.c | 10 +-- usr.bin/openssl/ecparam.c | 10 +-- usr.bin/openssl/enc.c | 10 +-- usr.bin/openssl/errstr.c | 10 +-- usr.bin/openssl/gendh.c | 10 +-- usr.bin/openssl/gendsa.c | 10 +-- usr.bin/openssl/genpkey.c | 10 +-- usr.bin/openssl/genrsa.c | 10 +-- usr.bin/openssl/nseq.c | 10 +-- usr.bin/openssl/ocsp.c | 10 +-- usr.bin/openssl/openssl.c | 157 ++++++++++++------------------------ usr.bin/openssl/passwd.c | 10 +-- usr.bin/openssl/pkcs12.c | 10 +-- usr.bin/openssl/pkcs7.c | 10 +-- usr.bin/openssl/pkcs8.c | 10 +-- usr.bin/openssl/pkey.c | 10 +-- usr.bin/openssl/pkeyparam.c | 10 +-- usr.bin/openssl/pkeyutl.c | 10 +-- usr.bin/openssl/prime.c | 10 +-- usr.bin/openssl/rand.c | 10 +-- usr.bin/openssl/req.c | 10 +-- usr.bin/openssl/rsa.c | 10 +-- usr.bin/openssl/rsautl.c | 10 +-- usr.bin/openssl/s_client.c | 10 +-- usr.bin/openssl/s_server.c | 10 +-- usr.bin/openssl/s_time.c | 10 +-- usr.bin/openssl/sess_id.c | 10 +-- usr.bin/openssl/smime.c | 10 +-- usr.bin/openssl/speed.c | 10 +-- usr.bin/openssl/spkac.c | 10 +-- usr.bin/openssl/ts.c | 10 +-- usr.bin/openssl/verify.c | 10 +-- usr.bin/openssl/version.c | 10 +-- usr.bin/openssl/x509.c | 10 +-- 46 files changed, 231 insertions(+), 376 deletions(-) diff --git a/usr.bin/openssl/asn1pars.c b/usr.bin/openssl/asn1pars.c index 38d12f61fc2..6f7fa18512e 100644 --- a/usr.bin/openssl/asn1pars.c +++ b/usr.bin/openssl/asn1pars.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1pars.c,v 1.11 2022/01/12 22:55:51 tb Exp $ */ +/* $OpenBSD: asn1pars.c,v 1.12 2022/11/11 17:07:38 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -247,11 +247,9 @@ asn1parse_main(int argc, char **argv) BUF_MEM *buf = NULL; ASN1_TYPE *at = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&asn1pars_config, 0, sizeof(asn1pars_config)); diff --git a/usr.bin/openssl/ca.c b/usr.bin/openssl/ca.c index bbc5403e3c9..e13354f4aff 100644 --- a/usr.bin/openssl/ca.c +++ b/usr.bin/openssl/ca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ca.c,v 1.53 2022/02/03 17:44:04 tb Exp $ */ +/* $OpenBSD: ca.c,v 1.54 2022/11/11 17:07:38 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -685,11 +685,9 @@ ca_main(int argc, char **argv) char *tofree = NULL; DB_ATTR db_attr; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&ca_config, 0, sizeof(ca_config)); diff --git a/usr.bin/openssl/certhash.c b/usr.bin/openssl/certhash.c index a4417a2b267..785f1216ad9 100644 --- a/usr.bin/openssl/certhash.c +++ b/usr.bin/openssl/certhash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: certhash.c,v 1.19 2021/10/23 08:13:48 tb Exp $ */ +/* $OpenBSD: certhash.c,v 1.20 2022/11/11 17:07:38 joshua Exp $ */ /* * Copyright (c) 2014, 2015 Joel Sing * @@ -653,11 +653,9 @@ certhash_main(int argc, char **argv) int argsused; int i, cwdfd, ret = 0; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&certhash_config, 0, sizeof(certhash_config)); diff --git a/usr.bin/openssl/ciphers.c b/usr.bin/openssl/ciphers.c index 583db1167ba..eb63a358907 100644 --- a/usr.bin/openssl/ciphers.c +++ b/usr.bin/openssl/ciphers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ciphers.c,v 1.15 2022/07/19 20:15:19 tb Exp $ */ +/* $OpenBSD: ciphers.c,v 1.16 2022/11/11 17:07:38 joshua Exp $ */ /* * Copyright (c) 2014 Joel Sing * @@ -114,11 +114,9 @@ ciphers_main(int argc, char **argv) int i, rv = 0; char *desc; - if (single_execution) { - if (pledge("stdio rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&ciphers_config, 0, sizeof(ciphers_config)); diff --git a/usr.bin/openssl/cms.c b/usr.bin/openssl/cms.c index a3004e8af34..e3f4aaf3a8c 100644 --- a/usr.bin/openssl/cms.c +++ b/usr.bin/openssl/cms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms.c,v 1.30 2022/03/23 15:16:59 tb Exp $ */ +/* $OpenBSD: cms.c,v 1.31 2022/11/11 17:07:38 joshua Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -1165,11 +1165,9 @@ cms_main(int argc, char **argv) char *passin = NULL; unsigned char *pwri_tmp = NULL; - if (single_execution) { - if (pledge("stdio rpath wpath cpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio rpath wpath cpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&cms_config, 0, sizeof(cms_config)); diff --git a/usr.bin/openssl/crl.c b/usr.bin/openssl/crl.c index 031360854c7..6b7bc5b72e7 100644 --- a/usr.bin/openssl/crl.c +++ b/usr.bin/openssl/crl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crl.c,v 1.15 2021/10/31 16:47:27 tb Exp $ */ +/* $OpenBSD: crl.c,v 1.16 2022/11/11 17:07:38 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -230,11 +230,9 @@ crl_main(int argc, char **argv) const EVP_MD *digest; char *digest_name = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } if (bio_out == NULL) { diff --git a/usr.bin/openssl/crl2p7.c b/usr.bin/openssl/crl2p7.c index 8e5bf6a4366..0b0eae2a991 100644 --- a/usr.bin/openssl/crl2p7.c +++ b/usr.bin/openssl/crl2p7.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crl2p7.c,v 1.9 2019/07/14 03:30:45 guenther Exp $ */ +/* $OpenBSD: crl2p7.c,v 1.10 2022/11/11 17:07:38 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -169,11 +169,9 @@ crl2pkcs7_main(int argc, char **argv) STACK_OF(X509) *cert_stack = NULL; int ret = 1; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&crl2p7_config, 0, sizeof(crl2p7_config)); diff --git a/usr.bin/openssl/dgst.c b/usr.bin/openssl/dgst.c index 689591cd224..d29bc6f98cf 100644 --- a/usr.bin/openssl/dgst.c +++ b/usr.bin/openssl/dgst.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dgst.c,v 1.19 2022/01/14 09:28:07 tb Exp $ */ +/* $OpenBSD: dgst.c,v 1.20 2022/11/11 17:07:38 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -338,11 +338,9 @@ dgst_main(int argc, char **argv) int siglen = 0; char *passin = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } if ((buf = malloc(BUFSIZE)) == NULL) { diff --git a/usr.bin/openssl/dh.c b/usr.bin/openssl/dh.c index c2c5d689e1c..200233c0f26 100644 --- a/usr.bin/openssl/dh.c +++ b/usr.bin/openssl/dh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh.c,v 1.13 2022/01/14 09:21:54 tb Exp $ */ +/* $OpenBSD: dh.c,v 1.14 2022/11/11 17:07:38 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -158,11 +158,9 @@ dh_main(int argc, char **argv) BIO *in = NULL, *out = NULL; int ret = 1; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&dh_config, 0, sizeof(dh_config)); diff --git a/usr.bin/openssl/dhparam.c b/usr.bin/openssl/dhparam.c index da9075f5bec..8c4cc198c66 100644 --- a/usr.bin/openssl/dhparam.c +++ b/usr.bin/openssl/dhparam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhparam.c,v 1.14 2022/01/14 09:22:50 tb Exp $ */ +/* $OpenBSD: dhparam.c,v 1.15 2022/11/11 17:07:38 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -244,11 +244,9 @@ dhparam_main(int argc, char **argv) int ret = 1; int i; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&dhparam_config, 0, sizeof(dhparam_config)); diff --git a/usr.bin/openssl/dsa.c b/usr.bin/openssl/dsa.c index df45cd6ebec..0a3772dff78 100644 --- a/usr.bin/openssl/dsa.c +++ b/usr.bin/openssl/dsa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa.c,v 1.16 2022/01/14 09:23:42 tb Exp $ */ +/* $OpenBSD: dsa.c,v 1.17 2022/11/11 17:07:38 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -236,11 +236,9 @@ dsa_main(int argc, char **argv) BIO *in = NULL, *out = NULL; char *passin = NULL, *passout = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&dsa_config, 0, sizeof(dsa_config)); diff --git a/usr.bin/openssl/dsaparam.c b/usr.bin/openssl/dsaparam.c index 33bde035aae..892ae72ba1b 100644 --- a/usr.bin/openssl/dsaparam.c +++ b/usr.bin/openssl/dsaparam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsaparam.c,v 1.13 2022/01/14 09:24:20 tb Exp $ */ +/* $OpenBSD: dsaparam.c,v 1.14 2022/11/11 17:07:38 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -169,11 +169,9 @@ dsaparam_main(int argc, char **argv) int numbits = -1; char *strbits = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&dsaparam_config, 0, sizeof(dsaparam_config)); diff --git a/usr.bin/openssl/ec.c b/usr.bin/openssl/ec.c index 3aa9b0c2c55..3dace88d6fc 100644 --- a/usr.bin/openssl/ec.c +++ b/usr.bin/openssl/ec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec.c,v 1.14 2019/07/14 03:30:45 guenther Exp $ */ +/* $OpenBSD: ec.c,v 1.15 2022/11/11 17:07:38 joshua Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -267,11 +267,9 @@ ec_main(int argc, char **argv) BIO *in = NULL, *out = NULL; char *passin = NULL, *passout = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&ec_config, 0, sizeof(ec_config)); diff --git a/usr.bin/openssl/ecparam.c b/usr.bin/openssl/ecparam.c index 01974a7f466..52ccc491fc5 100644 --- a/usr.bin/openssl/ecparam.c +++ b/usr.bin/openssl/ecparam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecparam.c,v 1.21 2021/05/10 20:58:32 tb Exp $ */ +/* $OpenBSD: ecparam.c,v 1.22 2022/11/11 17:07:38 joshua Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -259,11 +259,9 @@ ecparam_main(int argc, char **argv) BIO *in = NULL, *out = NULL; int i, ret = 1; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&ecparam_config, 0, sizeof(ecparam_config)); diff --git a/usr.bin/openssl/enc.c b/usr.bin/openssl/enc.c index 7955d9b9401..5a07113f7cc 100644 --- a/usr.bin/openssl/enc.c +++ b/usr.bin/openssl/enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: enc.c,v 1.24 2021/12/07 20:13:15 tb Exp $ */ +/* $OpenBSD: enc.c,v 1.25 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -344,11 +344,9 @@ enc_main(int argc, char **argv) char pname[PROG_NAME_SIZE + 1]; int i; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&enc_config, 0, sizeof(enc_config)); diff --git a/usr.bin/openssl/errstr.c b/usr.bin/openssl/errstr.c index bb6bfc785f8..4d7ba02def0 100644 --- a/usr.bin/openssl/errstr.c +++ b/usr.bin/openssl/errstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: errstr.c,v 1.7 2019/07/14 03:30:45 guenther Exp $ */ +/* $OpenBSD: errstr.c,v 1.8 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -98,11 +98,9 @@ errstr_main(int argc, char **argv) char buf[256]; int ret = 0; - if (single_execution) { - if (pledge("stdio rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&errstr_config, 0, sizeof(errstr_config)); diff --git a/usr.bin/openssl/gendh.c b/usr.bin/openssl/gendh.c index c6564e047b8..b4e4f29111b 100644 --- a/usr.bin/openssl/gendh.c +++ b/usr.bin/openssl/gendh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gendh.c,v 1.12 2021/11/20 18:10:48 tb Exp $ */ +/* $OpenBSD: gendh.c,v 1.13 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -134,11 +134,9 @@ gendh_main(int argc, char **argv) BIO *out = NULL; char *strbits = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } if ((cb = BN_GENCB_new()) == NULL) { diff --git a/usr.bin/openssl/gendsa.c b/usr.bin/openssl/gendsa.c index 6d69957e852..fa83ea2c67a 100644 --- a/usr.bin/openssl/gendsa.c +++ b/usr.bin/openssl/gendsa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gendsa.c,v 1.15 2022/01/14 09:25:00 tb Exp $ */ +/* $OpenBSD: gendsa.c,v 1.16 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -229,11 +229,9 @@ gendsa_main(int argc, char **argv) char *passout = NULL; BIO *out = NULL, *in = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&gendsa_config, 0, sizeof(gendsa_config)); diff --git a/usr.bin/openssl/genpkey.c b/usr.bin/openssl/genpkey.c index e2b46b77961..61b24af3305 100644 --- a/usr.bin/openssl/genpkey.c +++ b/usr.bin/openssl/genpkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: genpkey.c,v 1.13 2019/07/14 03:30:46 guenther Exp $ */ +/* $OpenBSD: genpkey.c,v 1.14 2022/11/11 17:07:39 joshua Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006 */ @@ -224,11 +224,9 @@ genpkey_main(int argc, char **argv) char *pass = NULL; int ret = 1, rv; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&genpkey_config, 0, sizeof(genpkey_config)); diff --git a/usr.bin/openssl/genrsa.c b/usr.bin/openssl/genrsa.c index 647b691e7f0..e1628a682e8 100644 --- a/usr.bin/openssl/genrsa.c +++ b/usr.bin/openssl/genrsa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: genrsa.c,v 1.20 2022/10/04 15:31:02 espie Exp $ */ +/* $OpenBSD: genrsa.c,v 1.21 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -280,11 +280,9 @@ genrsa_main(int argc, char **argv) RSA *rsa = NULL; char *rsa_e_hex = NULL, *rsa_e_dec = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } if ((bn = BN_new()) == NULL) diff --git a/usr.bin/openssl/nseq.c b/usr.bin/openssl/nseq.c index 516bde34d21..7be116e67bf 100644 --- a/usr.bin/openssl/nseq.c +++ b/usr.bin/openssl/nseq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nseq.c,v 1.9 2019/07/14 03:30:46 guenther Exp $ */ +/* $OpenBSD: nseq.c,v 1.10 2022/11/11 17:07:39 joshua Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -109,11 +109,9 @@ nseq_main(int argc, char **argv) NETSCAPE_CERT_SEQUENCE *seq = NULL; int i, ret = 1; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&nseq_config, 0, sizeof(nseq_config)); diff --git a/usr.bin/openssl/ocsp.c b/usr.bin/openssl/ocsp.c index f954d9697b6..026bd49b0a5 100644 --- a/usr.bin/openssl/ocsp.c +++ b/usr.bin/openssl/ocsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp.c,v 1.21 2020/10/13 18:25:35 tb Exp $ */ +/* $OpenBSD: ocsp.c,v 1.22 2022/11/11 17:07:39 joshua Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -750,11 +750,9 @@ ocsp_main(int argc, char **argv) X509 *rca_cert = NULL; CA_DB *rdb = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath inet dns tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath inet dns tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&ocsp_config, 0, sizeof(ocsp_config)); diff --git a/usr.bin/openssl/openssl.c b/usr.bin/openssl/openssl.c index 42b9b91b7ac..e931b7a33e0 100644 --- a/usr.bin/openssl/openssl.c +++ b/usr.bin/openssl/openssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openssl.c,v 1.30 2019/11/04 15:25:54 jsing Exp $ */ +/* $OpenBSD: openssl.c,v 1.31 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -137,8 +137,6 @@ #define FUNC_TYPE_MD_ALG 5 #define FUNC_TYPE_CIPHER_ALG 6 -int single_execution = 0; - typedef struct { int type; const char *name; @@ -349,6 +347,7 @@ static void openssl_shutdown(void); static LHASH_OF(FUNCTION) *prog_init(void); static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[]); +static void print_help(void); static void list_pkey(BIO * out); static void list_cipher(BIO * out); static void list_md(BIO * out); @@ -385,13 +384,8 @@ int main(int argc, char **argv) { ARGS arg; -#define PROG_NAME_SIZE 39 - char pname[PROG_NAME_SIZE + 1]; - FUNCTION f, *fp; - const char *prompt; - char buf[1024]; char *to_free = NULL; - int n, i, ret = 0; + int i, ret = 0; char *p; LHASH_OF(FUNCTION) * prog = NULL; long errline; @@ -453,74 +447,21 @@ main(int argc, char **argv) prog = prog_init(); - /* first check the program name */ - program_name(argv[0], pname, sizeof pname); - - f.name = pname; - fp = lh_FUNCTION_retrieve(prog, &f); - if (fp != NULL) { - argv[0] = pname; - - single_execution = 1; - ret = fp->func(argc, argv); - goto end; - } /* * ok, now check that there are not arguments, if there are, run with - * them, shifting the ssleay off the front + * them, shifting the executable name off the front */ - if (argc != 1) { - argc--; - argv++; - - single_execution = 1; - ret = do_cmd(prog, argc, argv); - if (ret < 0) - ret = 0; + argc--; + argv++; + + if (argc < 1) { + print_help(); goto end; } - /* ok, lets enter the old 'OpenSSL>' mode */ - for (;;) { + ret = do_cmd(prog, argc, argv); + if (ret < 0) ret = 0; - p = buf; - n = sizeof buf; - i = 0; - for (;;) { - p[0] = '\0'; - if (i++) - prompt = ">"; - else - prompt = "OpenSSL> "; - fputs(prompt, stdout); - fflush(stdout); - if (!fgets(p, n, stdin)) - goto end; - if (p[0] == '\0') - goto end; - i = strlen(p); - if (i <= 1) - break; - if (p[i - 2] != '\\') - break; - i -= 2; - p += i; - n -= i; - } - if (!chopup_args(&arg, buf, &argc, &argv)) - break; - - ret = do_cmd(prog, argc, argv); - if (ret < 0) { - ret = 0; - goto end; - } - if (ret != 0) - BIO_printf(bio_err, "error in %s\n", argv[0]); - (void) BIO_flush(bio_err); - } - BIO_printf(bio_err, "bad exit\n"); - ret = 1; end: free(to_free); @@ -554,7 +495,7 @@ static int do_cmd(LHASH_OF(FUNCTION) * prog, int argc, char *argv[]) { FUNCTION f, *fp; - int i, ret = 1, tp, nl; + int ret = 1; if ((argc <= 0) || (argv[0] == NULL)) { ret = 0; @@ -585,12 +526,6 @@ do_cmd(LHASH_OF(FUNCTION) * prog, int argc, char *argv[]) BIO_printf(bio_stdout, "%s\n", argv[0] + 3); BIO_free_all(bio_stdout); goto end; - } else if ((strcmp(argv[0], "quit") == 0) || - (strcmp(argv[0], "q") == 0) || - (strcmp(argv[0], "exit") == 0) || - (strcmp(argv[0], "bye") == 0)) { - ret = -1; - goto end; } else if ((strcmp(argv[0], LIST_STANDARD_COMMANDS) == 0) || (strcmp(argv[0], LIST_MESSAGE_DIGEST_COMMANDS) == 0) || (strcmp(argv[0], LIST_MESSAGE_DIGEST_ALGORITHMS) == 0) || @@ -633,44 +568,54 @@ do_cmd(LHASH_OF(FUNCTION) * prog, int argc, char *argv[]) BIO_printf(bio_err, "openssl:Error: '%s' is an invalid command.\n", argv[0]); - BIO_printf(bio_err, "\nStandard commands"); - i = 0; - tp = 0; - for (fp = functions; fp->name != NULL; fp++) { - nl = 0; + print_help(); + ret = 0; + } + end: + return (ret); +} + +static void +print_help(void) +{ + FUNCTION *fp; + int i = 0; + int tp = 0; + int nl; + + BIO_printf(bio_err, "\nStandard commands"); + for (fp = functions; fp->name != NULL; fp++) { + nl = 0; #ifdef OPENSSL_NO_CAMELLIA - if (((i++) % 5) == 0) + if (((i++) % 5) == 0) #else - if (((i++) % 4) == 0) + if (((i++) % 4) == 0) #endif - { + { + BIO_printf(bio_err, "\n"); + nl = 1; + } + if (fp->type != tp) { + tp = fp->type; + if (!nl) BIO_printf(bio_err, "\n"); - nl = 1; - } - if (fp->type != tp) { - tp = fp->type; - if (!nl) - BIO_printf(bio_err, "\n"); - if (tp == FUNC_TYPE_MD) { - i = 1; - BIO_printf(bio_err, - "\nMessage Digest commands (see the `dgst' command for more details)\n"); - } else if (tp == FUNC_TYPE_CIPHER) { - i = 1; - BIO_printf(bio_err, "\nCipher commands (see the `enc' command for more details)\n"); - } + if (tp == FUNC_TYPE_MD) { + i = 1; + BIO_printf(bio_err, + "\nMessage Digest commands (see the `dgst' command for more details)\n"); + } else if (tp == FUNC_TYPE_CIPHER) { + i = 1; + BIO_printf(bio_err, "\nCipher commands (see the `enc' command for more details)\n"); } + } #ifdef OPENSSL_NO_CAMELLIA - BIO_printf(bio_err, "%-15s", fp->name); + BIO_printf(bio_err, "%-15s", fp->name); #else - BIO_printf(bio_err, "%-18s", fp->name); + BIO_printf(bio_err, "%-18s", fp->name); #endif - } - BIO_printf(bio_err, "\n\n"); - ret = 0; } - end: - return (ret); + + BIO_printf(bio_err, "\n\n"); } static int diff --git a/usr.bin/openssl/passwd.c b/usr.bin/openssl/passwd.c index 11b43d653a0..f05751f1652 100644 --- a/usr.bin/openssl/passwd.c +++ b/usr.bin/openssl/passwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: passwd.c,v 1.12 2021/12/12 20:40:25 tb Exp $ */ +/* $OpenBSD: passwd.c,v 1.13 2022/11/11 17:07:39 joshua Exp $ */ #if defined OPENSSL_NO_MD5 #define NO_MD5CRYPT_1 @@ -145,11 +145,9 @@ passwd_main(int argc, char **argv) int argsused; int ret = 1; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&passwd_config, 0, sizeof(passwd_config)); diff --git a/usr.bin/openssl/pkcs12.c b/usr.bin/openssl/pkcs12.c index fb8a1f0ea4d..6e671e92750 100644 --- a/usr.bin/openssl/pkcs12.c +++ b/usr.bin/openssl/pkcs12.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pkcs12.c,v 1.23 2022/09/14 16:31:36 tb Exp $ */ +/* $OpenBSD: pkcs12.c,v 1.24 2022/11/11 17:07:39 joshua Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -536,11 +536,9 @@ pkcs12_main(int argc, char **argv) char *cpass = NULL, *mpass = NULL; char *passin = NULL, *passout = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&pkcs12_config, 0, sizeof(pkcs12_config)); diff --git a/usr.bin/openssl/pkcs7.c b/usr.bin/openssl/pkcs7.c index 4c184911c94..4f0c529424e 100644 --- a/usr.bin/openssl/pkcs7.c +++ b/usr.bin/openssl/pkcs7.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pkcs7.c,v 1.11 2019/07/14 03:30:46 guenther Exp $ */ +/* $OpenBSD: pkcs7.c,v 1.12 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -154,11 +154,9 @@ pkcs7_main(int argc, char **argv) int ret = 1; int i; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&pkcs7_config, 0, sizeof(pkcs7_config)); diff --git a/usr.bin/openssl/pkcs8.c b/usr.bin/openssl/pkcs8.c index 0629b20c37f..ea122300063 100644 --- a/usr.bin/openssl/pkcs8.c +++ b/usr.bin/openssl/pkcs8.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pkcs8.c,v 1.14 2019/07/14 03:30:46 guenther Exp $ */ +/* $OpenBSD: pkcs8.c,v 1.15 2022/11/11 17:07:39 joshua Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999-2004. */ @@ -203,11 +203,9 @@ pkcs8_main(int argc, char **argv) char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL; int ret = 1; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&pkcs8_config, 0, sizeof(pkcs8_config)); diff --git a/usr.bin/openssl/pkey.c b/usr.bin/openssl/pkey.c index dcddd976b4c..2d9b69f5c34 100644 --- a/usr.bin/openssl/pkey.c +++ b/usr.bin/openssl/pkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pkey.c,v 1.17 2022/01/14 10:17:30 tb Exp $ */ +/* $OpenBSD: pkey.c,v 1.18 2022/11/11 17:07:39 joshua Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006 */ @@ -221,11 +221,9 @@ pkey_main(int argc, char **argv) char *passin = NULL, *passout = NULL; int ret = 1; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&pkey_config, 0, sizeof(pkey_config)); diff --git a/usr.bin/openssl/pkeyparam.c b/usr.bin/openssl/pkeyparam.c index 924c39eddb7..9c519e31a67 100644 --- a/usr.bin/openssl/pkeyparam.c +++ b/usr.bin/openssl/pkeyparam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pkeyparam.c,v 1.14 2022/01/14 10:17:30 tb Exp $ */ +/* $OpenBSD: pkeyparam.c,v 1.15 2022/11/11 17:07:39 joshua Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006 */ @@ -125,11 +125,9 @@ pkeyparam_main(int argc, char **argv) EVP_PKEY *pkey = NULL; int ret = 1; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&pkeyparam_config, 0, sizeof(pkeyparam_config)); diff --git a/usr.bin/openssl/pkeyutl.c b/usr.bin/openssl/pkeyutl.c index 09a1a9755fa..d92aa161fb6 100644 --- a/usr.bin/openssl/pkeyutl.c +++ b/usr.bin/openssl/pkeyutl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pkeyutl.c,v 1.16 2019/07/14 03:30:46 guenther Exp $ */ +/* $OpenBSD: pkeyutl.c,v 1.17 2022/11/11 17:07:39 joshua Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -263,11 +263,9 @@ pkeyutl_main(int argc, char **argv) int ret = 1, rv = -1; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&pkeyutl_config, 0, sizeof(pkeyutl_config)); diff --git a/usr.bin/openssl/prime.c b/usr.bin/openssl/prime.c index ee0c3429806..d27b234e614 100644 --- a/usr.bin/openssl/prime.c +++ b/usr.bin/openssl/prime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: prime.c,v 1.13 2019/07/14 03:30:46 guenther Exp $ */ +/* $OpenBSD: prime.c,v 1.14 2022/11/11 17:07:39 joshua Exp $ */ /* ==================================================================== * Copyright (c) 2004 The OpenSSL Project. All rights reserved. * @@ -118,11 +118,9 @@ prime_main(int argc, char **argv) char *s; int is_prime, ret = 1; - if (single_execution) { - if (pledge("stdio rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&prime_config, 0, sizeof(prime_config)); diff --git a/usr.bin/openssl/rand.c b/usr.bin/openssl/rand.c index fb639e3bc5f..6e67cf28e71 100644 --- a/usr.bin/openssl/rand.c +++ b/usr.bin/openssl/rand.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rand.c,v 1.14 2019/07/14 03:30:46 guenther Exp $ */ +/* $OpenBSD: rand.c,v 1.15 2022/11/11 17:07:39 joshua Exp $ */ /* ==================================================================== * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. * @@ -109,11 +109,9 @@ rand_main(int argc, char **argv) int i, r; BIO *out = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&rand_config, 0, sizeof(rand_config)); diff --git a/usr.bin/openssl/req.c b/usr.bin/openssl/req.c index 6d74ca0e361..abf1c53e1f2 100644 --- a/usr.bin/openssl/req.c +++ b/usr.bin/openssl/req.c @@ -1,4 +1,4 @@ -/* $OpenBSD: req.c,v 1.23 2022/02/03 17:44:04 tb Exp $ */ +/* $OpenBSD: req.c,v 1.24 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -563,11 +563,9 @@ req_main(int argc, char **argv) const EVP_MD *md_alg = NULL; char *p; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&req_config, 0, sizeof(req_config)); diff --git a/usr.bin/openssl/rsa.c b/usr.bin/openssl/rsa.c index acc05ee0a45..bdd263ce7c8 100644 --- a/usr.bin/openssl/rsa.c +++ b/usr.bin/openssl/rsa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa.c,v 1.16 2022/01/14 09:26:41 tb Exp $ */ +/* $OpenBSD: rsa.c,v 1.17 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -255,11 +255,9 @@ rsa_main(int argc, char **argv) BIO *out = NULL; char *passin = NULL, *passout = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&rsa_config, 0, sizeof(rsa_config)); diff --git a/usr.bin/openssl/rsautl.c b/usr.bin/openssl/rsautl.c index 06d7a81ae04..c3af9156355 100644 --- a/usr.bin/openssl/rsautl.c +++ b/usr.bin/openssl/rsautl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsautl.c,v 1.18 2019/07/14 03:30:46 guenther Exp $ */ +/* $OpenBSD: rsautl.c,v 1.19 2022/11/11 17:07:39 joshua Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -244,11 +244,9 @@ rsautl_main(int argc, char **argv) int keysize; int ret = 1; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&rsautl_config, 0, sizeof(rsautl_config)); diff --git a/usr.bin/openssl/s_client.c b/usr.bin/openssl/s_client.c index 15ebb0c0a7c..41f65023258 100644 --- a/usr.bin/openssl/s_client.c +++ b/usr.bin/openssl/s_client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_client.c,v 1.58 2022/02/03 17:44:04 tb Exp $ */ +/* $OpenBSD: s_client.c,v 1.59 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -923,11 +923,9 @@ s_client_main(int argc, char **argv) struct sockaddr_storage peer; int peerlen = sizeof(peer); - if (single_execution) { - if (pledge("stdio cpath wpath rpath inet dns tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath inet dns tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&s_client_config, 0, sizeof(s_client_config)); diff --git a/usr.bin/openssl/s_server.c b/usr.bin/openssl/s_server.c index 9b06856ac9c..adf98451ec2 100644 --- a/usr.bin/openssl/s_server.c +++ b/usr.bin/openssl/s_server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_server.c,v 1.54 2021/12/06 11:06:58 tb Exp $ */ +/* $OpenBSD: s_server.c,v 1.55 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1081,11 +1081,9 @@ s_server_main(int argc, char *argv[]) X509 *s_cert2 = NULL; tlsextalpnctx alpn_ctx = { NULL, 0 }; - if (single_execution) { - if (pledge("stdio rpath inet dns tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio rpath inet dns tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&s_server_config, 0, sizeof(s_server_config)); diff --git a/usr.bin/openssl/s_time.c b/usr.bin/openssl/s_time.c index 92fdb59aa00..7e3cee84250 100644 --- a/usr.bin/openssl/s_time.c +++ b/usr.bin/openssl/s_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_time.c,v 1.35 2022/08/31 12:29:08 tb Exp $ */ +/* $OpenBSD: s_time.c,v 1.36 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -236,11 +236,9 @@ s_time_main(int argc, char **argv) { int ret = 1; - if (single_execution) { - if (pledge("stdio rpath inet dns", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio rpath inet dns", NULL) == -1) { + perror("pledge"); + exit(1); } s_time_meth = TLS_client_method(); diff --git a/usr.bin/openssl/sess_id.c b/usr.bin/openssl/sess_id.c index d8a2bf272f7..4533cf15caa 100644 --- a/usr.bin/openssl/sess_id.c +++ b/usr.bin/openssl/sess_id.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sess_id.c,v 1.10 2019/07/14 03:30:46 guenther Exp $ */ +/* $OpenBSD: sess_id.c,v 1.11 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -158,11 +158,9 @@ sess_id_main(int argc, char **argv) int ret = 1, i; BIO *out = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&sess_id_config, 0, sizeof(sess_id_config)); diff --git a/usr.bin/openssl/smime.c b/usr.bin/openssl/smime.c index 2503177f0fe..37375c16007 100644 --- a/usr.bin/openssl/smime.c +++ b/usr.bin/openssl/smime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smime.c,v 1.17 2022/01/16 07:12:28 inoguchi Exp $ */ +/* $OpenBSD: smime.c,v 1.18 2022/11/11 17:07:39 joshua Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -722,11 +722,9 @@ smime_main(int argc, char **argv) int badarg = 0; char *passin = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&smime_config, 0, sizeof(smime_config)); diff --git a/usr.bin/openssl/speed.c b/usr.bin/openssl/speed.c index f3e9fdc0768..1db42ca4f59 100644 --- a/usr.bin/openssl/speed.c +++ b/usr.bin/openssl/speed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: speed.c,v 1.28 2022/01/14 09:27:30 tb Exp $ */ +/* $OpenBSD: speed.c,v 1.29 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -469,11 +469,9 @@ speed_main(int argc, char **argv) int multi = 0; const char *errstr = NULL; - if (single_execution) { - if (pledge("stdio proc", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio proc", NULL) == -1) { + perror("pledge"); + exit(1); } usertime = -1; diff --git a/usr.bin/openssl/spkac.c b/usr.bin/openssl/spkac.c index 7fd8523c015..3a45d5d4bca 100644 --- a/usr.bin/openssl/spkac.c +++ b/usr.bin/openssl/spkac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spkac.c,v 1.11 2019/07/14 03:30:46 guenther Exp $ */ +/* $OpenBSD: spkac.c,v 1.12 2022/11/11 17:07:39 joshua Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. Based on an original idea by Massimiliano Pala * (madwolf@openca.org). @@ -181,11 +181,9 @@ spkac_main(int argc, char **argv) NETSCAPE_SPKI *spki = NULL; EVP_PKEY *pkey = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&spkac_config, 0, sizeof(spkac_config)); diff --git a/usr.bin/openssl/ts.c b/usr.bin/openssl/ts.c index 24301b69a54..05387de1305 100644 --- a/usr.bin/openssl/ts.c +++ b/usr.bin/openssl/ts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts.c,v 1.24 2022/09/11 18:08:17 tb Exp $ */ +/* $OpenBSD: ts.c,v 1.25 2022/11/11 17:07:39 joshua Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2002. */ @@ -377,11 +377,9 @@ ts_main(int argc, char **argv) CONF *conf = NULL; char *password = NULL; /* Password itself. */ - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&ts_config, 0, sizeof(ts_config)); diff --git a/usr.bin/openssl/verify.c b/usr.bin/openssl/verify.c index dd321761d34..b42dd2f2433 100644 --- a/usr.bin/openssl/verify.c +++ b/usr.bin/openssl/verify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: verify.c,v 1.14 2021/02/15 17:57:58 jsing Exp $ */ +/* $OpenBSD: verify.c,v 1.15 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -268,11 +268,9 @@ verify_main(int argc, char **argv) int argsused; int ret = 1; - if (single_execution) { - if (pledge("stdio rpath", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio rpath", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&verify_config, 0, sizeof(verify_config)); diff --git a/usr.bin/openssl/version.c b/usr.bin/openssl/version.c index 374e0d0c4ad..038774ad0c8 100644 --- a/usr.bin/openssl/version.c +++ b/usr.bin/openssl/version.c @@ -1,4 +1,4 @@ -/* $OpenBSD: version.c,v 1.9 2019/07/14 03:30:46 guenther Exp $ */ +/* $OpenBSD: version.c,v 1.10 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -213,11 +213,9 @@ version_usage(void) int version_main(int argc, char **argv) { - if (single_execution) { - if (pledge("stdio", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&version_config, 0, sizeof(version_config)); diff --git a/usr.bin/openssl/x509.c b/usr.bin/openssl/x509.c index c777ee9b74e..e1c69c6798d 100644 --- a/usr.bin/openssl/x509.c +++ b/usr.bin/openssl/x509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509.c,v 1.29 2021/12/12 20:34:04 tb Exp $ */ +/* $OpenBSD: x509.c,v 1.30 2022/11/11 17:07:39 joshua Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -735,11 +735,9 @@ x509_main(int argc, char **argv) CONF *extconf = NULL; char *passin = NULL; - if (single_execution) { - if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { - perror("pledge"); - exit(1); - } + if (pledge("stdio cpath wpath rpath tty", NULL) == -1) { + perror("pledge"); + exit(1); } memset(&x509_config, 0, sizeof(x509_config)); -- 2.20.1