summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/rand.c
diff options
context:
space:
mode:
authordoug <>2015-10-10 22:28:51 +0000
committerdoug <>2015-10-10 22:28:51 +0000
commit503cf2bd70538bb9cc734a5fd58230b90be4d1d8 (patch)
treea1bec6cdad41903b9c145025632c4b983a111465 /src/usr.bin/openssl/rand.c
parent2d9e1e812a55eea3d673b7734ac91bd087a9c7d8 (diff)
downloadopenbsd-503cf2bd70538bb9cc734a5fd58230b90be4d1d8.tar.gz
openbsd-503cf2bd70538bb9cc734a5fd58230b90be4d1d8.tar.bz2
openbsd-503cf2bd70538bb9cc734a5fd58230b90be4d1d8.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.
Diffstat (limited to 'src/usr.bin/openssl/rand.c')
-rw-r--r--src/usr.bin/openssl/rand.c7
1 files changed, 6 insertions, 1 deletions
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) {