diff options
author | doug <> | 2015-10-10 22:28:51 +0000 |
---|---|---|
committer | doug <> | 2015-10-10 22:28:51 +0000 |
commit | edaaa7bf2f0b5ce874b24101100d02d3f3d0747f (patch) | |
tree | a1bec6cdad41903b9c145025632c4b983a111465 | |
parent | a7ed9884b640e4bc924d95a4f6587d129a0228c6 (diff) | |
download | openbsd-edaaa7bf2f0b5ce874b24101100d02d3f3d0747f.tar.gz openbsd-edaaa7bf2f0b5ce874b24101100d02d3f3d0747f.tar.bz2 openbsd-edaaa7bf2f0b5ce874b24101100d02d3f3d0747f.zip |
Initial support for pledges in openssl(1) commands.
openssl(1) has two mechanisms for operating: either a single execution
of one command (looking at argv[0] or argv[1]) or as an interactive
session than may execute any number of commands.
We already have a top level pledge that should cover all commands
and that's what interactive mode must continue using. However, we can
tighten up the pledges when only executing one command.
This is an initial stab at support and may contain regressions. Most
commands only need "stdio rpath wpath cpath". The pledges could be
further restricted by evaluating the situation after parsing options.
deraadt@ and beck@ are roughly fine with this approach.
47 files changed, 281 insertions, 46 deletions
diff --git a/src/usr.bin/openssl/apps.h b/src/usr.bin/openssl/apps.h index bb9fd0dd7a..4813fa35df 100644 --- a/src/usr.bin/openssl/apps.h +++ b/src/usr.bin/openssl/apps.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: apps.h,v 1.16 2015/09/13 12:41:01 bcook Exp $ */ | 1 | /* $OpenBSD: apps.h,v 1.17 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -126,6 +126,9 @@ | |||
126 | #include <openssl/ocsp.h> | 126 | #include <openssl/ocsp.h> |
127 | #endif | 127 | #endif |
128 | 128 | ||
129 | #include <unistd.h> | ||
130 | extern int single_execution; | ||
131 | |||
129 | extern CONF *config; | 132 | extern CONF *config; |
130 | extern char *default_config_file; | 133 | extern char *default_config_file; |
131 | extern BIO *bio_err; | 134 | extern BIO *bio_err; |
diff --git a/src/usr.bin/openssl/asn1pars.c b/src/usr.bin/openssl/asn1pars.c index da3bf761ce..2ce9d1a3ba 100644 --- a/src/usr.bin/openssl/asn1pars.c +++ b/src/usr.bin/openssl/asn1pars.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1pars.c,v 1.4 2015/08/19 18:25:31 deraadt Exp $ */ | 1 | /* $OpenBSD: asn1pars.c,v 1.5 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -247,6 +247,11 @@ asn1parse_main(int argc, char **argv) | |||
247 | BUF_MEM *buf = NULL; | 247 | BUF_MEM *buf = NULL; |
248 | ASN1_TYPE *at = NULL; | 248 | ASN1_TYPE *at = NULL; |
249 | 249 | ||
250 | if (single_execution) { | ||
251 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
252 | perror("pledge"); | ||
253 | } | ||
254 | |||
250 | memset(&asn1pars_config, 0, sizeof(asn1pars_config)); | 255 | memset(&asn1pars_config, 0, sizeof(asn1pars_config)); |
251 | 256 | ||
252 | asn1pars_config.informat = FORMAT_PEM; | 257 | asn1pars_config.informat = FORMAT_PEM; |
diff --git a/src/usr.bin/openssl/ca.c b/src/usr.bin/openssl/ca.c index e32abcdf21..0b246aeb15 100644 --- a/src/usr.bin/openssl/ca.c +++ b/src/usr.bin/openssl/ca.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ca.c,v 1.16 2015/09/21 13:31:26 bcook Exp $ */ | 1 | /* $OpenBSD: ca.c,v 1.17 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -286,6 +286,11 @@ ca_main(int argc, char **argv) | |||
286 | const char *errstr = NULL; | 286 | const char *errstr = NULL; |
287 | DB_ATTR db_attr; | 287 | DB_ATTR db_attr; |
288 | 288 | ||
289 | if (single_execution) { | ||
290 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
291 | perror("pledge"); | ||
292 | } | ||
293 | |||
289 | conf = NULL; | 294 | conf = NULL; |
290 | key = NULL; | 295 | key = NULL; |
291 | section = NULL; | 296 | section = NULL; |
diff --git a/src/usr.bin/openssl/certhash.c b/src/usr.bin/openssl/certhash.c index 77e641cef5..bd0ac54ecf 100644 --- a/src/usr.bin/openssl/certhash.c +++ b/src/usr.bin/openssl/certhash.c | |||
@@ -649,6 +649,11 @@ certhash_main(int argc, char **argv) | |||
649 | int argsused; | 649 | int argsused; |
650 | int i, cwdfd, ret = 0; | 650 | int i, cwdfd, ret = 0; |
651 | 651 | ||
652 | if (single_execution) { | ||
653 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
654 | perror("pledge"); | ||
655 | } | ||
656 | |||
652 | memset(&certhash_config, 0, sizeof(certhash_config)); | 657 | memset(&certhash_config, 0, sizeof(certhash_config)); |
653 | 658 | ||
654 | if (options_parse(argc, argv, certhash_options, NULL, &argsused) != 0) { | 659 | if (options_parse(argc, argv, certhash_options, NULL, &argsused) != 0) { |
diff --git a/src/usr.bin/openssl/ciphers.c b/src/usr.bin/openssl/ciphers.c index 18b8d3e4d9..caa40854ea 100644 --- a/src/usr.bin/openssl/ciphers.c +++ b/src/usr.bin/openssl/ciphers.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ciphers.c,v 1.6 2015/08/19 18:25:31 deraadt Exp $ */ | 1 | /* $OpenBSD: ciphers.c,v 1.7 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -81,6 +81,11 @@ ciphers_main(int argc, char **argv) | |||
81 | int i, rv = 0; | 81 | int i, rv = 0; |
82 | char *desc; | 82 | char *desc; |
83 | 83 | ||
84 | if (single_execution) { | ||
85 | if (pledge("stdio rpath", NULL) == -1) | ||
86 | perror("pledge"); | ||
87 | } | ||
88 | |||
84 | memset(&ciphers_config, 0, sizeof(ciphers_config)); | 89 | memset(&ciphers_config, 0, sizeof(ciphers_config)); |
85 | 90 | ||
86 | if (options_parse(argc, argv, ciphers_options, &cipherlist, | 91 | if (options_parse(argc, argv, ciphers_options, &cipherlist, |
diff --git a/src/usr.bin/openssl/cms.c b/src/usr.bin/openssl/cms.c index fccac23db7..29429f53e0 100644 --- a/src/usr.bin/openssl/cms.c +++ b/src/usr.bin/openssl/cms.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cms.c,v 1.3 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: cms.c,v 1.4 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -135,6 +135,11 @@ cms_main(int argc, char **argv) | |||
135 | 135 | ||
136 | X509_VERIFY_PARAM *vpm = NULL; | 136 | X509_VERIFY_PARAM *vpm = NULL; |
137 | 137 | ||
138 | if (single_execution) { | ||
139 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
140 | perror("pledge"); | ||
141 | } | ||
142 | |||
138 | args = argv + 1; | 143 | args = argv + 1; |
139 | ret = 1; | 144 | ret = 1; |
140 | 145 | ||
diff --git a/src/usr.bin/openssl/crl.c b/src/usr.bin/openssl/crl.c index 4ab9e6c615..47173ec5ed 100644 --- a/src/usr.bin/openssl/crl.c +++ b/src/usr.bin/openssl/crl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: crl.c,v 1.7 2015/08/22 16:36:05 jsing Exp $ */ | 1 | /* $OpenBSD: crl.c,v 1.8 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -230,6 +230,11 @@ crl_main(int argc, char **argv) | |||
230 | const EVP_MD *digest; | 230 | const EVP_MD *digest; |
231 | char *digest_name = NULL; | 231 | char *digest_name = NULL; |
232 | 232 | ||
233 | if (single_execution) { | ||
234 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
235 | perror("pledge"); | ||
236 | } | ||
237 | |||
233 | if (bio_out == NULL) { | 238 | if (bio_out == NULL) { |
234 | if ((bio_out = BIO_new(BIO_s_file())) != NULL) { | 239 | if ((bio_out = BIO_new(BIO_s_file())) != NULL) { |
235 | BIO_set_fp(bio_out, stdout, BIO_NOCLOSE); | 240 | BIO_set_fp(bio_out, stdout, BIO_NOCLOSE); |
diff --git a/src/usr.bin/openssl/crl2p7.c b/src/usr.bin/openssl/crl2p7.c index 4df986d325..3935bd18e0 100644 --- a/src/usr.bin/openssl/crl2p7.c +++ b/src/usr.bin/openssl/crl2p7.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: crl2p7.c,v 1.4 2015/08/22 16:36:05 jsing Exp $ */ | 1 | /* $OpenBSD: crl2p7.c,v 1.5 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -169,6 +169,11 @@ crl2pkcs7_main(int argc, char **argv) | |||
169 | STACK_OF(X509) *cert_stack = NULL; | 169 | STACK_OF(X509) *cert_stack = NULL; |
170 | int ret = 1; | 170 | int ret = 1; |
171 | 171 | ||
172 | if (single_execution) { | ||
173 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
174 | perror("pledge"); | ||
175 | } | ||
176 | |||
172 | memset(&crl2p7_config, 0, sizeof(crl2p7_config)); | 177 | memset(&crl2p7_config, 0, sizeof(crl2p7_config)); |
173 | 178 | ||
174 | crl2p7_config.informat = FORMAT_PEM; | 179 | crl2p7_config.informat = FORMAT_PEM; |
diff --git a/src/usr.bin/openssl/dgst.c b/src/usr.bin/openssl/dgst.c index 94d98ac6a4..b4632eefa3 100644 --- a/src/usr.bin/openssl/dgst.c +++ b/src/usr.bin/openssl/dgst.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dgst.c,v 1.6 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: dgst.c,v 1.7 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -123,6 +123,11 @@ dgst_main(int argc, char **argv) | |||
123 | char *mac_name = NULL; | 123 | char *mac_name = NULL; |
124 | STACK_OF(OPENSSL_STRING) * sigopts = NULL, *macopts = NULL; | 124 | STACK_OF(OPENSSL_STRING) * sigopts = NULL, *macopts = NULL; |
125 | 125 | ||
126 | if (single_execution) { | ||
127 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
128 | perror("pledge"); | ||
129 | } | ||
130 | |||
126 | if ((buf = malloc(BUFSIZE)) == NULL) { | 131 | if ((buf = malloc(BUFSIZE)) == NULL) { |
127 | BIO_printf(bio_err, "out of memory\n"); | 132 | BIO_printf(bio_err, "out of memory\n"); |
128 | goto end; | 133 | goto end; |
diff --git a/src/usr.bin/openssl/dh.c b/src/usr.bin/openssl/dh.c index f4112e87c2..7e8d65d1f6 100644 --- a/src/usr.bin/openssl/dh.c +++ b/src/usr.bin/openssl/dh.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dh.c,v 1.6 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: dh.c,v 1.7 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -158,6 +158,11 @@ dh_main(int argc, char **argv) | |||
158 | BIO *in = NULL, *out = NULL; | 158 | BIO *in = NULL, *out = NULL; |
159 | int ret = 1; | 159 | int ret = 1; |
160 | 160 | ||
161 | if (single_execution) { | ||
162 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
163 | perror("pledge"); | ||
164 | } | ||
165 | |||
161 | memset(&dh_config, 0, sizeof(dh_config)); | 166 | memset(&dh_config, 0, sizeof(dh_config)); |
162 | 167 | ||
163 | dh_config.informat = FORMAT_PEM; | 168 | dh_config.informat = FORMAT_PEM; |
diff --git a/src/usr.bin/openssl/dhparam.c b/src/usr.bin/openssl/dhparam.c index 158a07a572..55b75663b3 100644 --- a/src/usr.bin/openssl/dhparam.c +++ b/src/usr.bin/openssl/dhparam.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dhparam.c,v 1.6 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: dhparam.c,v 1.7 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -243,6 +243,11 @@ dhparam_main(int argc, char **argv) | |||
243 | int ret = 1; | 243 | int ret = 1; |
244 | int i; | 244 | int i; |
245 | 245 | ||
246 | if (single_execution) { | ||
247 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
248 | perror("pledge"); | ||
249 | } | ||
250 | |||
246 | memset(&dhparam_config, 0, sizeof(dhparam_config)); | 251 | memset(&dhparam_config, 0, sizeof(dhparam_config)); |
247 | 252 | ||
248 | dhparam_config.informat = FORMAT_PEM; | 253 | dhparam_config.informat = FORMAT_PEM; |
diff --git a/src/usr.bin/openssl/dsa.c b/src/usr.bin/openssl/dsa.c index 813e163662..2c4feea0d5 100644 --- a/src/usr.bin/openssl/dsa.c +++ b/src/usr.bin/openssl/dsa.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa.c,v 1.5 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: dsa.c,v 1.6 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -240,6 +240,11 @@ dsa_main(int argc, char **argv) | |||
240 | BIO *in = NULL, *out = NULL; | 240 | BIO *in = NULL, *out = NULL; |
241 | char *passin = NULL, *passout = NULL; | 241 | char *passin = NULL, *passout = NULL; |
242 | 242 | ||
243 | if (single_execution) { | ||
244 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
245 | perror("pledge"); | ||
246 | } | ||
247 | |||
243 | memset(&dsa_config, 0, sizeof(dsa_config)); | 248 | memset(&dsa_config, 0, sizeof(dsa_config)); |
244 | 249 | ||
245 | dsa_config.pvk_encr = 2; | 250 | dsa_config.pvk_encr = 2; |
diff --git a/src/usr.bin/openssl/dsaparam.c b/src/usr.bin/openssl/dsaparam.c index 0cdd5c1d51..73249498fc 100644 --- a/src/usr.bin/openssl/dsaparam.c +++ b/src/usr.bin/openssl/dsaparam.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsaparam.c,v 1.5 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: dsaparam.c,v 1.6 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -168,6 +168,11 @@ dsaparam_main(int argc, char **argv) | |||
168 | int numbits = -1; | 168 | int numbits = -1; |
169 | char *strbits = NULL; | 169 | char *strbits = NULL; |
170 | 170 | ||
171 | if (single_execution) { | ||
172 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
173 | perror("pledge"); | ||
174 | } | ||
175 | |||
171 | memset(&dsaparam_config, 0, sizeof(dsaparam_config)); | 176 | memset(&dsaparam_config, 0, sizeof(dsaparam_config)); |
172 | 177 | ||
173 | dsaparam_config.informat = FORMAT_PEM; | 178 | dsaparam_config.informat = FORMAT_PEM; |
diff --git a/src/usr.bin/openssl/ec.c b/src/usr.bin/openssl/ec.c index d5fe68f0d8..b4e2fe1daa 100644 --- a/src/usr.bin/openssl/ec.c +++ b/src/usr.bin/openssl/ec.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec.c,v 1.5 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: ec.c,v 1.6 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -277,6 +277,11 @@ ec_main(int argc, char **argv) | |||
277 | BIO *in = NULL, *out = NULL; | 277 | BIO *in = NULL, *out = NULL; |
278 | char *passin = NULL, *passout = NULL; | 278 | char *passin = NULL, *passout = NULL; |
279 | 279 | ||
280 | if (single_execution) { | ||
281 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
282 | perror("pledge"); | ||
283 | } | ||
284 | |||
280 | memset(&ec_config, 0, sizeof(ec_config)); | 285 | memset(&ec_config, 0, sizeof(ec_config)); |
281 | 286 | ||
282 | ec_config.asn1_flag = OPENSSL_EC_NAMED_CURVE; | 287 | ec_config.asn1_flag = OPENSSL_EC_NAMED_CURVE; |
diff --git a/src/usr.bin/openssl/ecparam.c b/src/usr.bin/openssl/ecparam.c index 6adac863d5..bd0c5b8cc0 100644 --- a/src/usr.bin/openssl/ecparam.c +++ b/src/usr.bin/openssl/ecparam.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecparam.c,v 1.13 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: ecparam.c,v 1.14 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -259,6 +259,11 @@ ecparam_main(int argc, char **argv) | |||
259 | BIO *in = NULL, *out = NULL; | 259 | BIO *in = NULL, *out = NULL; |
260 | int i, ret = 1; | 260 | int i, ret = 1; |
261 | 261 | ||
262 | if (single_execution) { | ||
263 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
264 | perror("pledge"); | ||
265 | } | ||
266 | |||
262 | memset(&ecparam_config, 0, sizeof(ecparam_config)); | 267 | memset(&ecparam_config, 0, sizeof(ecparam_config)); |
263 | ecparam_config.asn1_flag = OPENSSL_EC_NAMED_CURVE; | 268 | ecparam_config.asn1_flag = OPENSSL_EC_NAMED_CURVE; |
264 | ecparam_config.form = POINT_CONVERSION_UNCOMPRESSED; | 269 | ecparam_config.form = POINT_CONVERSION_UNCOMPRESSED; |
diff --git a/src/usr.bin/openssl/enc.c b/src/usr.bin/openssl/enc.c index 6eb804fd49..d7103823d3 100644 --- a/src/usr.bin/openssl/enc.c +++ b/src/usr.bin/openssl/enc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: enc.c,v 1.7 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: enc.c,v 1.8 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -338,6 +338,11 @@ enc_main(int argc, char **argv) | |||
338 | char pname[PROG_NAME_SIZE + 1]; | 338 | char pname[PROG_NAME_SIZE + 1]; |
339 | int i; | 339 | int i; |
340 | 340 | ||
341 | if (single_execution) { | ||
342 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
343 | perror("pledge"); | ||
344 | } | ||
345 | |||
341 | memset(&enc_config, 0, sizeof(enc_config)); | 346 | memset(&enc_config, 0, sizeof(enc_config)); |
342 | enc_config.enc = 1; | 347 | enc_config.enc = 1; |
343 | 348 | ||
diff --git a/src/usr.bin/openssl/errstr.c b/src/usr.bin/openssl/errstr.c index 9cf7bfba4b..7bd97d99b0 100644 --- a/src/usr.bin/openssl/errstr.c +++ b/src/usr.bin/openssl/errstr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: errstr.c,v 1.4 2015/08/22 16:36:05 jsing Exp $ */ | 1 | /* $OpenBSD: errstr.c,v 1.5 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -98,6 +98,11 @@ errstr_main(int argc, char **argv) | |||
98 | char buf[256]; | 98 | char buf[256]; |
99 | int ret = 0; | 99 | int ret = 0; |
100 | 100 | ||
101 | if (single_execution) { | ||
102 | if (pledge("stdio rpath", NULL) == -1) | ||
103 | perror("pledge"); | ||
104 | } | ||
105 | |||
101 | memset(&errstr_config, 0, sizeof(errstr_config)); | 106 | memset(&errstr_config, 0, sizeof(errstr_config)); |
102 | 107 | ||
103 | if (options_parse(argc, argv, errstr_options, NULL, &argsused) != 0) { | 108 | if (options_parse(argc, argv, errstr_options, NULL, &argsused) != 0) { |
diff --git a/src/usr.bin/openssl/gendh.c b/src/usr.bin/openssl/gendh.c index 208906e24c..ceea237be1 100644 --- a/src/usr.bin/openssl/gendh.c +++ b/src/usr.bin/openssl/gendh.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gendh.c,v 1.5 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: gendh.c,v 1.6 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -134,6 +134,11 @@ gendh_main(int argc, char **argv) | |||
134 | BIO *out = NULL; | 134 | BIO *out = NULL; |
135 | char *strbits = NULL; | 135 | char *strbits = NULL; |
136 | 136 | ||
137 | if (single_execution) { | ||
138 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
139 | perror("pledge"); | ||
140 | } | ||
141 | |||
137 | BN_GENCB_set(&cb, dh_cb, bio_err); | 142 | BN_GENCB_set(&cb, dh_cb, bio_err); |
138 | 143 | ||
139 | memset(&gendh_config, 0, sizeof(gendh_config)); | 144 | memset(&gendh_config, 0, sizeof(gendh_config)); |
diff --git a/src/usr.bin/openssl/gendsa.c b/src/usr.bin/openssl/gendsa.c index ee2d6ba1b6..002380a1b9 100644 --- a/src/usr.bin/openssl/gendsa.c +++ b/src/usr.bin/openssl/gendsa.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: gendsa.c,v 1.4 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: gendsa.c,v 1.5 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -85,6 +85,11 @@ gendsa_main(int argc, char **argv) | |||
85 | BIO *out = NULL, *in = NULL; | 85 | BIO *out = NULL, *in = NULL; |
86 | const EVP_CIPHER *enc = NULL; | 86 | const EVP_CIPHER *enc = NULL; |
87 | 87 | ||
88 | if (single_execution) { | ||
89 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
90 | perror("pledge"); | ||
91 | } | ||
92 | |||
88 | argv++; | 93 | argv++; |
89 | argc--; | 94 | argc--; |
90 | for (;;) { | 95 | for (;;) { |
diff --git a/src/usr.bin/openssl/genpkey.c b/src/usr.bin/openssl/genpkey.c index d76e2febd8..4d11bc3c33 100644 --- a/src/usr.bin/openssl/genpkey.c +++ b/src/usr.bin/openssl/genpkey.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: genpkey.c,v 1.5 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: genpkey.c,v 1.6 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006 | 3 | * project 2006 |
4 | */ | 4 | */ |
@@ -86,6 +86,11 @@ genpkey_main(int argc, char **argv) | |||
86 | 86 | ||
87 | int do_param = 0; | 87 | int do_param = 0; |
88 | 88 | ||
89 | if (single_execution) { | ||
90 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
91 | perror("pledge"); | ||
92 | } | ||
93 | |||
89 | outformat = FORMAT_PEM; | 94 | outformat = FORMAT_PEM; |
90 | 95 | ||
91 | args = argv + 1; | 96 | args = argv + 1; |
diff --git a/src/usr.bin/openssl/genrsa.c b/src/usr.bin/openssl/genrsa.c index 9f78f0d65d..1ca8713ed2 100644 --- a/src/usr.bin/openssl/genrsa.c +++ b/src/usr.bin/openssl/genrsa.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: genrsa.c,v 1.5 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: genrsa.c,v 1.6 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -100,6 +100,11 @@ genrsa_main(int argc, char **argv) | |||
100 | BIGNUM *bn = BN_new(); | 100 | BIGNUM *bn = BN_new(); |
101 | RSA *rsa = NULL; | 101 | RSA *rsa = NULL; |
102 | 102 | ||
103 | if (single_execution) { | ||
104 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
105 | perror("pledge"); | ||
106 | } | ||
107 | |||
103 | if (!bn) | 108 | if (!bn) |
104 | goto err; | 109 | goto err; |
105 | 110 | ||
diff --git a/src/usr.bin/openssl/nseq.c b/src/usr.bin/openssl/nseq.c index b73f512aee..15df3ffd40 100644 --- a/src/usr.bin/openssl/nseq.c +++ b/src/usr.bin/openssl/nseq.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: nseq.c,v 1.4 2015/08/22 16:36:05 jsing Exp $ */ | 1 | /* $OpenBSD: nseq.c,v 1.5 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -109,6 +109,11 @@ nseq_main(int argc, char **argv) | |||
109 | NETSCAPE_CERT_SEQUENCE *seq = NULL; | 109 | NETSCAPE_CERT_SEQUENCE *seq = NULL; |
110 | int i, ret = 1; | 110 | int i, ret = 1; |
111 | 111 | ||
112 | if (single_execution) { | ||
113 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
114 | perror("pledge"); | ||
115 | } | ||
116 | |||
112 | memset(&nseq_config, 0, sizeof(nseq_config)); | 117 | memset(&nseq_config, 0, sizeof(nseq_config)); |
113 | 118 | ||
114 | if (options_parse(argc, argv, nseq_options, NULL, NULL) != 0) { | 119 | if (options_parse(argc, argv, nseq_options, NULL, NULL) != 0) { |
diff --git a/src/usr.bin/openssl/ocsp.c b/src/usr.bin/openssl/ocsp.c index 3a6ac36b1e..c3b1b168ba 100644 --- a/src/usr.bin/openssl/ocsp.c +++ b/src/usr.bin/openssl/ocsp.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ocsp.c,v 1.5 2015/10/03 03:39:19 deraadt Exp $ */ | 1 | /* $OpenBSD: ocsp.c,v 1.6 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -146,6 +146,11 @@ ocsp_main(int argc, char **argv) | |||
146 | const EVP_MD *cert_id_md = NULL; | 146 | const EVP_MD *cert_id_md = NULL; |
147 | const char *errstr = NULL; | 147 | const char *errstr = NULL; |
148 | 148 | ||
149 | if (single_execution) { | ||
150 | if (pledge("stdio inet rpath wpath cpath", NULL) == -1) | ||
151 | perror("pledge"); | ||
152 | } | ||
153 | |||
149 | args = argv + 1; | 154 | args = argv + 1; |
150 | reqnames = sk_OPENSSL_STRING_new_null(); | 155 | reqnames = sk_OPENSSL_STRING_new_null(); |
151 | ids = sk_OCSP_CERTID_new_null(); | 156 | ids = sk_OCSP_CERTID_new_null(); |
diff --git a/src/usr.bin/openssl/openssl.c b/src/usr.bin/openssl/openssl.c index 9db7e5b4eb..e842d6cc65 100644 --- a/src/usr.bin/openssl/openssl.c +++ b/src/usr.bin/openssl/openssl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: openssl.c,v 1.16 2015/10/10 20:18:30 deraadt Exp $ */ | 1 | /* $OpenBSD: openssl.c,v 1.17 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -137,6 +137,8 @@ | |||
137 | #define FUNC_TYPE_MD_ALG 5 | 137 | #define FUNC_TYPE_MD_ALG 5 |
138 | #define FUNC_TYPE_CIPHER_ALG 6 | 138 | #define FUNC_TYPE_CIPHER_ALG 6 |
139 | 139 | ||
140 | int single_execution = 0; | ||
141 | |||
140 | typedef struct { | 142 | typedef struct { |
141 | int type; | 143 | int type; |
142 | const char *name; | 144 | const char *name; |
@@ -499,6 +501,8 @@ main(int argc, char **argv) | |||
499 | fp = lh_FUNCTION_retrieve(prog, &f); | 501 | fp = lh_FUNCTION_retrieve(prog, &f); |
500 | if (fp != NULL) { | 502 | if (fp != NULL) { |
501 | argv[0] = pname; | 503 | argv[0] = pname; |
504 | |||
505 | single_execution = 1; | ||
502 | ret = fp->func(argc, argv); | 506 | ret = fp->func(argc, argv); |
503 | goto end; | 507 | goto end; |
504 | } | 508 | } |
@@ -509,6 +513,8 @@ main(int argc, char **argv) | |||
509 | if (argc != 1) { | 513 | if (argc != 1) { |
510 | argc--; | 514 | argc--; |
511 | argv++; | 515 | argv++; |
516 | |||
517 | single_execution = 1; | ||
512 | ret = do_cmd(prog, argc, argv); | 518 | ret = do_cmd(prog, argc, argv); |
513 | if (ret < 0) | 519 | if (ret < 0) |
514 | ret = 0; | 520 | ret = 0; |
diff --git a/src/usr.bin/openssl/passwd.c b/src/usr.bin/openssl/passwd.c index b6285649e7..58fc5ecb4b 100644 --- a/src/usr.bin/openssl/passwd.c +++ b/src/usr.bin/openssl/passwd.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: passwd.c,v 1.4 2015/08/22 16:36:05 jsing Exp $ */ | 1 | /* $OpenBSD: passwd.c,v 1.5 2015/10/10 22:28:51 doug Exp $ */ |
2 | 2 | ||
3 | #if defined OPENSSL_NO_MD5 | 3 | #if defined OPENSSL_NO_MD5 |
4 | #define NO_MD5CRYPT_1 | 4 | #define NO_MD5CRYPT_1 |
@@ -145,6 +145,11 @@ passwd_main(int argc, char **argv) | |||
145 | int argsused; | 145 | int argsused; |
146 | int ret = 1; | 146 | int ret = 1; |
147 | 147 | ||
148 | if (single_execution) { | ||
149 | if (pledge("stdio rpath", NULL) == -1) | ||
150 | perror("pledge"); | ||
151 | } | ||
152 | |||
148 | memset(&passwd_config, 0, sizeof(passwd_config)); | 153 | memset(&passwd_config, 0, sizeof(passwd_config)); |
149 | 154 | ||
150 | if (options_parse(argc, argv, passwd_options, NULL, &argsused) != 0) { | 155 | if (options_parse(argc, argv, passwd_options, NULL, &argsused) != 0) { |
diff --git a/src/usr.bin/openssl/pkcs12.c b/src/usr.bin/openssl/pkcs12.c index eaa7bcceac..f8d8cc6115 100644 --- a/src/usr.bin/openssl/pkcs12.c +++ b/src/usr.bin/openssl/pkcs12.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkcs12.c,v 1.4 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: pkcs12.c,v 1.5 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -124,6 +124,11 @@ pkcs12_main(int argc, char **argv) | |||
124 | char *macalg = NULL; | 124 | char *macalg = NULL; |
125 | char *CApath = NULL, *CAfile = NULL; | 125 | char *CApath = NULL, *CAfile = NULL; |
126 | 126 | ||
127 | if (single_execution) { | ||
128 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
129 | perror("pledge"); | ||
130 | } | ||
131 | |||
127 | cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC; | 132 | cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC; |
128 | 133 | ||
129 | enc = EVP_des_ede3_cbc(); | 134 | enc = EVP_des_ede3_cbc(); |
diff --git a/src/usr.bin/openssl/pkcs7.c b/src/usr.bin/openssl/pkcs7.c index 717928d27b..c29a9c8df2 100644 --- a/src/usr.bin/openssl/pkcs7.c +++ b/src/usr.bin/openssl/pkcs7.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkcs7.c,v 1.6 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: pkcs7.c,v 1.7 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -154,6 +154,11 @@ pkcs7_main(int argc, char **argv) | |||
154 | int ret = 1; | 154 | int ret = 1; |
155 | int i; | 155 | int i; |
156 | 156 | ||
157 | if (single_execution) { | ||
158 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
159 | perror("pledge"); | ||
160 | } | ||
161 | |||
157 | memset(&pkcs7_config, 0, sizeof(pkcs7_config)); | 162 | memset(&pkcs7_config, 0, sizeof(pkcs7_config)); |
158 | 163 | ||
159 | pkcs7_config.informat = FORMAT_PEM; | 164 | pkcs7_config.informat = FORMAT_PEM; |
diff --git a/src/usr.bin/openssl/pkcs8.c b/src/usr.bin/openssl/pkcs8.c index b3ccd1966e..4ac2af012a 100644 --- a/src/usr.bin/openssl/pkcs8.c +++ b/src/usr.bin/openssl/pkcs8.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkcs8.c,v 1.6 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: pkcs8.c,v 1.7 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999-2004. | 3 | * project 1999-2004. |
4 | */ | 4 | */ |
@@ -226,6 +226,11 @@ pkcs8_main(int argc, char **argv) | |||
226 | char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL; | 226 | char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL; |
227 | int ret = 1; | 227 | int ret = 1; |
228 | 228 | ||
229 | if (single_execution) { | ||
230 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
231 | perror("pledge"); | ||
232 | } | ||
233 | |||
229 | memset(&pkcs8_config, 0, sizeof(pkcs8_config)); | 234 | memset(&pkcs8_config, 0, sizeof(pkcs8_config)); |
230 | 235 | ||
231 | pkcs8_config.iter = PKCS12_DEFAULT_ITER; | 236 | pkcs8_config.iter = PKCS12_DEFAULT_ITER; |
diff --git a/src/usr.bin/openssl/pkey.c b/src/usr.bin/openssl/pkey.c index 72c03181f6..d1ddf5a929 100644 --- a/src/usr.bin/openssl/pkey.c +++ b/src/usr.bin/openssl/pkey.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkey.c,v 1.5 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: pkey.c,v 1.6 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006 | 3 | * project 2006 |
4 | */ | 4 | */ |
@@ -79,6 +79,11 @@ pkey_main(int argc, char **argv) | |||
79 | int badarg = 0; | 79 | int badarg = 0; |
80 | int ret = 1; | 80 | int ret = 1; |
81 | 81 | ||
82 | if (single_execution) { | ||
83 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
84 | perror("pledge"); | ||
85 | } | ||
86 | |||
82 | informat = FORMAT_PEM; | 87 | informat = FORMAT_PEM; |
83 | outformat = FORMAT_PEM; | 88 | outformat = FORMAT_PEM; |
84 | 89 | ||
diff --git a/src/usr.bin/openssl/pkeyparam.c b/src/usr.bin/openssl/pkeyparam.c index 8f4d3a53f4..cb40fbb3ed 100644 --- a/src/usr.bin/openssl/pkeyparam.c +++ b/src/usr.bin/openssl/pkeyparam.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkeyparam.c,v 1.7 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: pkeyparam.c,v 1.8 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006 | 3 | * project 2006 |
4 | */ | 4 | */ |
@@ -118,6 +118,11 @@ pkeyparam_main(int argc, char **argv) | |||
118 | EVP_PKEY *pkey = NULL; | 118 | EVP_PKEY *pkey = NULL; |
119 | int ret = 1; | 119 | int ret = 1; |
120 | 120 | ||
121 | if (single_execution) { | ||
122 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
123 | perror("pledge"); | ||
124 | } | ||
125 | |||
121 | memset(&pkeyparam_config, 0, sizeof(pkeyparam_config)); | 126 | memset(&pkeyparam_config, 0, sizeof(pkeyparam_config)); |
122 | 127 | ||
123 | if (options_parse(argc, argv, pkeyparam_options, NULL, NULL) != 0) { | 128 | if (options_parse(argc, argv, pkeyparam_options, NULL, NULL) != 0) { |
diff --git a/src/usr.bin/openssl/pkeyutl.c b/src/usr.bin/openssl/pkeyutl.c index 2caa61e282..64d1f90f50 100644 --- a/src/usr.bin/openssl/pkeyutl.c +++ b/src/usr.bin/openssl/pkeyutl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkeyutl.c,v 1.7 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: pkeyutl.c,v 1.8 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -100,6 +100,11 @@ pkeyutl_main(int argc, char **argv) | |||
100 | 100 | ||
101 | int ret = 1, rv = -1; | 101 | int ret = 1, rv = -1; |
102 | 102 | ||
103 | if (single_execution) { | ||
104 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
105 | perror("pledge"); | ||
106 | } | ||
107 | |||
103 | argc--; | 108 | argc--; |
104 | argv++; | 109 | argv++; |
105 | 110 | ||
diff --git a/src/usr.bin/openssl/prime.c b/src/usr.bin/openssl/prime.c index 55fac455e9..13398b01b0 100644 --- a/src/usr.bin/openssl/prime.c +++ b/src/usr.bin/openssl/prime.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: prime.c,v 1.8 2015/09/12 15:04:06 lteo Exp $ */ | 1 | /* $OpenBSD: prime.c,v 1.9 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2004 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2004 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -118,6 +118,11 @@ prime_main(int argc, char **argv) | |||
118 | char *s; | 118 | char *s; |
119 | int ret = 1; | 119 | int ret = 1; |
120 | 120 | ||
121 | if (single_execution) { | ||
122 | if (pledge("stdio rpath", NULL) == -1) | ||
123 | perror("pledge"); | ||
124 | } | ||
125 | |||
121 | memset(&prime_config, 0, sizeof(prime_config)); | 126 | memset(&prime_config, 0, sizeof(prime_config)); |
122 | 127 | ||
123 | /* Default iterations for Miller-Rabin probabilistic primality test. */ | 128 | /* Default iterations for Miller-Rabin probabilistic primality test. */ |
diff --git a/src/usr.bin/openssl/rand.c b/src/usr.bin/openssl/rand.c index b0df4eb1b5..2377c6e72b 100644 --- a/src/usr.bin/openssl/rand.c +++ b/src/usr.bin/openssl/rand.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rand.c,v 1.8 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: rand.c,v 1.9 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -109,6 +109,11 @@ rand_main(int argc, char **argv) | |||
109 | int i, r; | 109 | int i, r; |
110 | BIO *out = NULL; | 110 | BIO *out = NULL; |
111 | 111 | ||
112 | if (single_execution) { | ||
113 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
114 | perror("pledge"); | ||
115 | } | ||
116 | |||
112 | memset(&rand_config, 0, sizeof(rand_config)); | 117 | memset(&rand_config, 0, sizeof(rand_config)); |
113 | 118 | ||
114 | if (options_parse(argc, argv, rand_options, &num_bytes, NULL) != 0) { | 119 | if (options_parse(argc, argv, rand_options, &num_bytes, NULL) != 0) { |
diff --git a/src/usr.bin/openssl/req.c b/src/usr.bin/openssl/req.c index c7256ae59a..032944b233 100644 --- a/src/usr.bin/openssl/req.c +++ b/src/usr.bin/openssl/req.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: req.c,v 1.9 2015/09/14 01:45:03 doug Exp $ */ | 1 | /* $OpenBSD: req.c,v 1.10 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -176,6 +176,11 @@ req_main(int argc, char **argv) | |||
176 | const EVP_MD *md_alg = NULL, *digest = NULL; | 176 | const EVP_MD *md_alg = NULL, *digest = NULL; |
177 | unsigned long chtype = MBSTRING_ASC; | 177 | unsigned long chtype = MBSTRING_ASC; |
178 | 178 | ||
179 | if (single_execution) { | ||
180 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
181 | perror("pledge"); | ||
182 | } | ||
183 | |||
179 | req_conf = NULL; | 184 | req_conf = NULL; |
180 | cipher = EVP_aes_256_cbc(); | 185 | cipher = EVP_aes_256_cbc(); |
181 | digest = EVP_sha256(); | 186 | digest = EVP_sha256(); |
diff --git a/src/usr.bin/openssl/rsa.c b/src/usr.bin/openssl/rsa.c index 708332a8d1..a5737605fe 100644 --- a/src/usr.bin/openssl/rsa.c +++ b/src/usr.bin/openssl/rsa.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa.c,v 1.5 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: rsa.c,v 1.6 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -268,6 +268,11 @@ rsa_main(int argc, char **argv) | |||
268 | BIO *out = NULL; | 268 | BIO *out = NULL; |
269 | char *passin = NULL, *passout = NULL; | 269 | char *passin = NULL, *passout = NULL; |
270 | 270 | ||
271 | if (single_execution) { | ||
272 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
273 | perror("pledge"); | ||
274 | } | ||
275 | |||
271 | memset(&rsa_config, 0, sizeof(rsa_config)); | 276 | memset(&rsa_config, 0, sizeof(rsa_config)); |
272 | rsa_config.pvk_encr = 2; | 277 | rsa_config.pvk_encr = 2; |
273 | rsa_config.informat = FORMAT_PEM; | 278 | rsa_config.informat = FORMAT_PEM; |
diff --git a/src/usr.bin/openssl/rsautl.c b/src/usr.bin/openssl/rsautl.c index 2e9793297b..92dceff8a1 100644 --- a/src/usr.bin/openssl/rsautl.c +++ b/src/usr.bin/openssl/rsautl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsautl.c,v 1.7 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: rsautl.c,v 1.8 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -98,6 +98,11 @@ rsautl_main(int argc, char **argv) | |||
98 | 98 | ||
99 | int ret = 1; | 99 | int ret = 1; |
100 | 100 | ||
101 | if (single_execution) { | ||
102 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
103 | perror("pledge"); | ||
104 | } | ||
105 | |||
101 | argc--; | 106 | argc--; |
102 | argv++; | 107 | argv++; |
103 | 108 | ||
diff --git a/src/usr.bin/openssl/s_client.c b/src/usr.bin/openssl/s_client.c index 6d250f177f..63f30389c4 100644 --- a/src/usr.bin/openssl/s_client.c +++ b/src/usr.bin/openssl/s_client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s_client.c,v 1.20 2015/10/06 03:29:49 deraadt Exp $ */ | 1 | /* $OpenBSD: s_client.c,v 1.21 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -364,6 +364,11 @@ s_client_main(int argc, char **argv) | |||
364 | int enable_timeouts = 0; | 364 | int enable_timeouts = 0; |
365 | long socket_mtu = 0; | 365 | long socket_mtu = 0; |
366 | 366 | ||
367 | if (single_execution) { | ||
368 | if (pledge("stdio inet rpath wpath cpath", NULL) == -1) | ||
369 | perror("pledge"); | ||
370 | } | ||
371 | |||
367 | meth = SSLv23_client_method(); | 372 | meth = SSLv23_client_method(); |
368 | 373 | ||
369 | c_Pause = 0; | 374 | c_Pause = 0; |
diff --git a/src/usr.bin/openssl/s_server.c b/src/usr.bin/openssl/s_server.c index 11e9814135..198508398b 100644 --- a/src/usr.bin/openssl/s_server.c +++ b/src/usr.bin/openssl/s_server.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s_server.c,v 1.19 2015/10/06 03:29:49 deraadt Exp $ */ | 1 | /* $OpenBSD: s_server.c,v 1.20 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -603,6 +603,12 @@ s_server_main(int argc, char *argv[]) | |||
603 | tlsextnextprotoctx next_proto = { NULL, 0 }; | 603 | tlsextnextprotoctx next_proto = { NULL, 0 }; |
604 | const char *alpn_in = NULL; | 604 | const char *alpn_in = NULL; |
605 | tlsextalpnctx alpn_ctx = { NULL, 0 }; | 605 | tlsextalpnctx alpn_ctx = { NULL, 0 }; |
606 | |||
607 | if (single_execution) { | ||
608 | if (pledge("stdio inet rpath", NULL) == -1) | ||
609 | perror("pledge"); | ||
610 | } | ||
611 | |||
606 | meth = SSLv23_server_method(); | 612 | meth = SSLv23_server_method(); |
607 | 613 | ||
608 | local_argc = argc; | 614 | local_argc = argc; |
diff --git a/src/usr.bin/openssl/s_time.c b/src/usr.bin/openssl/s_time.c index c102726b7e..417ff81f3f 100644 --- a/src/usr.bin/openssl/s_time.c +++ b/src/usr.bin/openssl/s_time.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s_time.c,v 1.12 2015/09/11 14:43:57 lteo Exp $ */ | 1 | /* $OpenBSD: s_time.c,v 1.13 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -258,6 +258,11 @@ s_time_main(int argc, char **argv) | |||
258 | char buf[1024 * 8]; | 258 | char buf[1024 * 8]; |
259 | int ver; | 259 | int ver; |
260 | 260 | ||
261 | if (single_execution) { | ||
262 | if (pledge("stdio inet rpath", NULL) == -1) | ||
263 | perror("pledge"); | ||
264 | } | ||
265 | |||
261 | s_time_meth = SSLv23_client_method(); | 266 | s_time_meth = SSLv23_client_method(); |
262 | 267 | ||
263 | verify_depth = 0; | 268 | verify_depth = 0; |
diff --git a/src/usr.bin/openssl/sess_id.c b/src/usr.bin/openssl/sess_id.c index d7f3339509..7bf14adbea 100644 --- a/src/usr.bin/openssl/sess_id.c +++ b/src/usr.bin/openssl/sess_id.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sess_id.c,v 1.5 2015/08/19 18:25:31 deraadt Exp $ */ | 1 | /* $OpenBSD: sess_id.c,v 1.6 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -158,6 +158,11 @@ sess_id_main(int argc, char **argv) | |||
158 | int ret = 1, i; | 158 | int ret = 1, i; |
159 | BIO *out = NULL; | 159 | BIO *out = NULL; |
160 | 160 | ||
161 | if (single_execution) { | ||
162 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
163 | perror("pledge"); | ||
164 | } | ||
165 | |||
161 | memset(&sess_id_config, 0, sizeof(sess_id_config)); | 166 | memset(&sess_id_config, 0, sizeof(sess_id_config)); |
162 | 167 | ||
163 | sess_id_config.informat = FORMAT_PEM; | 168 | sess_id_config.informat = FORMAT_PEM; |
diff --git a/src/usr.bin/openssl/smime.c b/src/usr.bin/openssl/smime.c index d981335179..fee7c71e76 100644 --- a/src/usr.bin/openssl/smime.c +++ b/src/usr.bin/openssl/smime.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: smime.c,v 1.4 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: smime.c,v 1.5 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -112,6 +112,11 @@ smime_main(int argc, char **argv) | |||
112 | 112 | ||
113 | X509_VERIFY_PARAM *vpm = NULL; | 113 | X509_VERIFY_PARAM *vpm = NULL; |
114 | 114 | ||
115 | if (single_execution) { | ||
116 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
117 | perror("pledge"); | ||
118 | } | ||
119 | |||
115 | args = argv + 1; | 120 | args = argv + 1; |
116 | ret = 1; | 121 | ret = 1; |
117 | 122 | ||
diff --git a/src/usr.bin/openssl/speed.c b/src/usr.bin/openssl/speed.c index 1657a43c02..cc555afe8c 100644 --- a/src/usr.bin/openssl/speed.c +++ b/src/usr.bin/openssl/speed.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: speed.c,v 1.16 2015/09/20 13:39:13 miod Exp $ */ | 1 | /* $OpenBSD: speed.c,v 1.17 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -469,6 +469,11 @@ speed_main(int argc, char **argv) | |||
469 | int multi = 0; | 469 | int multi = 0; |
470 | const char *errstr = NULL; | 470 | const char *errstr = NULL; |
471 | 471 | ||
472 | if (single_execution) { | ||
473 | if (pledge("stdio proc", NULL) == -1) | ||
474 | perror("pledge"); | ||
475 | } | ||
476 | |||
472 | usertime = -1; | 477 | usertime = -1; |
473 | 478 | ||
474 | memset(results, 0, sizeof(results)); | 479 | memset(results, 0, sizeof(results)); |
diff --git a/src/usr.bin/openssl/spkac.c b/src/usr.bin/openssl/spkac.c index b635b5e3b2..1c8b7073d8 100644 --- a/src/usr.bin/openssl/spkac.c +++ b/src/usr.bin/openssl/spkac.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: spkac.c,v 1.5 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: spkac.c,v 1.6 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 1999. Based on an original idea by Massimiliano Pala | 3 | * project 1999. Based on an original idea by Massimiliano Pala |
4 | * (madwolf@openca.org). | 4 | * (madwolf@openca.org). |
@@ -181,6 +181,11 @@ spkac_main(int argc, char **argv) | |||
181 | NETSCAPE_SPKI *spki = NULL; | 181 | NETSCAPE_SPKI *spki = NULL; |
182 | EVP_PKEY *pkey = NULL; | 182 | EVP_PKEY *pkey = NULL; |
183 | 183 | ||
184 | if (single_execution) { | ||
185 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
186 | perror("pledge"); | ||
187 | } | ||
188 | |||
184 | memset(&spkac_config, 0, sizeof(spkac_config)); | 189 | memset(&spkac_config, 0, sizeof(spkac_config)); |
185 | spkac_config.spkac = "SPKAC"; | 190 | spkac_config.spkac = "SPKAC"; |
186 | spkac_config.spksect = "default"; | 191 | spkac_config.spksect = "default"; |
diff --git a/src/usr.bin/openssl/ts.c b/src/usr.bin/openssl/ts.c index 93d258d583..04ff60ae48 100644 --- a/src/usr.bin/openssl/ts.c +++ b/src/usr.bin/openssl/ts.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ts.c,v 1.10 2015/09/21 13:13:06 bcook Exp $ */ | 1 | /* $OpenBSD: ts.c,v 1.11 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL | 2 | /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL |
3 | * project 2002. | 3 | * project 2002. |
4 | */ | 4 | */ |
@@ -149,6 +149,11 @@ ts_main(int argc, char **argv) | |||
149 | /* Output is ContentInfo instead of TimeStampResp. */ | 149 | /* Output is ContentInfo instead of TimeStampResp. */ |
150 | int token_out = 0; | 150 | int token_out = 0; |
151 | 151 | ||
152 | if (single_execution) { | ||
153 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
154 | perror("pledge"); | ||
155 | } | ||
156 | |||
152 | for (argc--, argv++; argc > 0; argc--, argv++) { | 157 | for (argc--, argv++; argc > 0; argc--, argv++) { |
153 | if (strcmp(*argv, "-config") == 0) { | 158 | if (strcmp(*argv, "-config") == 0) { |
154 | if (argc-- < 1) | 159 | if (argc-- < 1) |
diff --git a/src/usr.bin/openssl/verify.c b/src/usr.bin/openssl/verify.c index 62ca63f01b..4975ad5b6e 100644 --- a/src/usr.bin/openssl/verify.c +++ b/src/usr.bin/openssl/verify.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: verify.c,v 1.4 2015/09/11 14:30:23 bcook Exp $ */ | 1 | /* $OpenBSD: verify.c,v 1.5 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -85,6 +85,11 @@ verify_main(int argc, char **argv) | |||
85 | X509_LOOKUP *lookup = NULL; | 85 | X509_LOOKUP *lookup = NULL; |
86 | X509_VERIFY_PARAM *vpm = NULL; | 86 | X509_VERIFY_PARAM *vpm = NULL; |
87 | 87 | ||
88 | if (single_execution) { | ||
89 | if (pledge("stdio rpath", NULL) == -1) | ||
90 | perror("pledge"); | ||
91 | } | ||
92 | |||
88 | cert_ctx = X509_STORE_new(); | 93 | cert_ctx = X509_STORE_new(); |
89 | if (cert_ctx == NULL) | 94 | if (cert_ctx == NULL) |
90 | goto end; | 95 | goto end; |
diff --git a/src/usr.bin/openssl/version.c b/src/usr.bin/openssl/version.c index f47369df9d..e096f89969 100644 --- a/src/usr.bin/openssl/version.c +++ b/src/usr.bin/openssl/version.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: version.c,v 1.6 2015/08/22 16:36:05 jsing Exp $ */ | 1 | /* $OpenBSD: version.c,v 1.7 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -213,6 +213,11 @@ version_usage(void) | |||
213 | int | 213 | int |
214 | version_main(int argc, char **argv) | 214 | version_main(int argc, char **argv) |
215 | { | 215 | { |
216 | if (single_execution) { | ||
217 | if (pledge("stdio", NULL) == -1) | ||
218 | perror("pledge"); | ||
219 | } | ||
220 | |||
216 | memset(&version_config, 0, sizeof(version_config)); | 221 | memset(&version_config, 0, sizeof(version_config)); |
217 | 222 | ||
218 | if (options_parse(argc, argv, version_options, NULL, NULL) != 0) { | 223 | if (options_parse(argc, argv, version_options, NULL, NULL) != 0) { |
diff --git a/src/usr.bin/openssl/x509.c b/src/usr.bin/openssl/x509.c index ec592c29d7..07c28789d3 100644 --- a/src/usr.bin/openssl/x509.c +++ b/src/usr.bin/openssl/x509.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509.c,v 1.9 2015/10/01 06:31:21 jsing Exp $ */ | 1 | /* $OpenBSD: x509.c,v 1.10 2015/10/10 22:28:51 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -198,6 +198,11 @@ x509_main(int argc, char **argv) | |||
198 | unsigned long nmflag = 0, certflag = 0; | 198 | unsigned long nmflag = 0, certflag = 0; |
199 | const char *errstr = NULL; | 199 | const char *errstr = NULL; |
200 | 200 | ||
201 | if (single_execution) { | ||
202 | if (pledge("stdio rpath wpath cpath", NULL) == -1) | ||
203 | perror("pledge"); | ||
204 | } | ||
205 | |||
201 | reqfile = 0; | 206 | reqfile = 0; |
202 | 207 | ||
203 | STDout = BIO_new_fp(stdout, BIO_NOCLOSE); | 208 | STDout = BIO_new_fp(stdout, BIO_NOCLOSE); |