summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorderaadt <>2014-07-12 14:46:31 +0000
committerderaadt <>2014-07-12 14:46:31 +0000
commit0678a82d0afa040fc29a7b54fce55185c72a1bad (patch)
treedf2ae70d8da6845d262d438b160d269de3539e8e /src/lib
parent0b572b36cd1a45a713c9eef52318dcae68872a88 (diff)
downloadopenbsd-0678a82d0afa040fc29a7b54fce55185c72a1bad.tar.gz
openbsd-0678a82d0afa040fc29a7b54fce55185c72a1bad.tar.bz2
openbsd-0678a82d0afa040fc29a7b54fce55185c72a1bad.zip
remove gratuitous differences, ok beck bcook
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/arc4random/getentropy_linux.c12
-rw-r--r--src/lib/libcrypto/arc4random/getentropy_solaris.c12
-rw-r--r--src/lib/libcrypto/crypto/getentropy_linux.c12
-rw-r--r--src/lib/libcrypto/crypto/getentropy_solaris.c12
4 files changed, 24 insertions, 24 deletions
diff --git a/src/lib/libcrypto/arc4random/getentropy_linux.c b/src/lib/libcrypto/arc4random/getentropy_linux.c
index 3fd30316d2..f1320d24d5 100644
--- a/src/lib/libcrypto/arc4random/getentropy_linux.c
+++ b/src/lib/libcrypto/arc4random/getentropy_linux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getentropy_linux.c,v 1.18 2014/07/08 09:38:55 beck Exp $ */ 1/* $OpenBSD: getentropy_linux.c,v 1.19 2014/07/12 14:46:31 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> 4 * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@@ -141,8 +141,8 @@ getentropy(void *buf, size_t len)
141 * sysctl ABI, or consider providing a new failsafe API which 141 * sysctl ABI, or consider providing a new failsafe API which
142 * works in a chroot or when file descriptors are exhausted. 142 * works in a chroot or when file descriptors are exhausted.
143 */ 143 */
144#undef FAIL_HARD_WHEN_LINUX_DEPRECATES_SYSCTL 144#undef FAIL_INSTEAD_OF_TRYING_FALLBACK
145#ifdef FAIL_HARD_WHEN_LINUX_DEPRECATES_SYSCTL 145#ifdef FAIL_INSTEAD_OF_TRYING_FALLBACK
146 raise(SIGKILL); 146 raise(SIGKILL);
147#endif 147#endif
148 ret = getentropy_fallback(buf, len); 148 ret = getentropy_fallback(buf, len);
@@ -179,12 +179,12 @@ getentropy_urandom(void *buf, size_t len)
179 179
180start: 180start:
181 181
182 flags = O_RDONLY; 182 flags = O_RDONLY;
183#ifdef O_NOFOLLOW 183#ifdef O_NOFOLLOW
184 flags |= O_NOFOLLOW; 184 flags |= O_NOFOLLOW;
185#endif 185#endif
186#ifdef O_CLOEXEC 186#ifdef O_CLOEXEC
187 flags |= O_CLOEXEC; 187 flags |= O_CLOEXEC;
188#endif 188#endif
189 fd = open("/dev/urandom", flags, 0); 189 fd = open("/dev/urandom", flags, 0);
190 if (fd == -1) { 190 if (fd == -1) {
diff --git a/src/lib/libcrypto/arc4random/getentropy_solaris.c b/src/lib/libcrypto/arc4random/getentropy_solaris.c
index 13afe7e3c9..83cc30aac2 100644
--- a/src/lib/libcrypto/arc4random/getentropy_solaris.c
+++ b/src/lib/libcrypto/arc4random/getentropy_solaris.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getentropy_solaris.c,v 1.2 2014/07/12 13:19:44 beck Exp $ */ 1/* $OpenBSD: getentropy_solaris.c,v 1.3 2014/07/12 14:46:31 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> 4 * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@@ -43,7 +43,6 @@
43#define SHA512_Update SHA512Update 43#define SHA512_Update SHA512Update
44#define SHA512_Final SHA512Final 44#define SHA512_Final SHA512Final
45 45
46
47#include <sys/vfs.h> 46#include <sys/vfs.h>
48#include <sys/statfs.h> 47#include <sys/statfs.h>
49#include <sys/loadavg.h> 48#include <sys/loadavg.h>
@@ -81,7 +80,7 @@ getentropy(void *buf, size_t len)
81 } 80 }
82 81
83 /* 82 /*
84 * Try to get entropy with /dev/urandom... 83 * Try to get entropy with /dev/urandom
85 * 84 *
86 * Solaris provides /dev/urandom as a symbolic link to 85 * Solaris provides /dev/urandom as a symbolic link to
87 * /devices/pseudo/random@0:urandom which is provided by 86 * /devices/pseudo/random@0:urandom which is provided by
@@ -132,8 +131,8 @@ getentropy(void *buf, size_t len)
132 * providing a new failsafe API which works in a chroot or 131 * providing a new failsafe API which works in a chroot or
133 * when file descriptors are exhausted. 132 * when file descriptors are exhausted.
134 */ 133 */
135#undef FAIL_WHEN_SYSTEM_ENTROPY_FAILS 134#undef FAIL_INSTEAD_OF_TRYING_FALLBACK
136#ifdef FAIL_WHEN_SYSTEM_ENTROPY_FAILS 135#ifdef FAIL_INSTEAD_OF_TRYING_FALLBACK
137 raise(SIGKILL); 136 raise(SIGKILL);
138#endif 137#endif
139 ret = getentropy_fallback(buf, len); 138 ret = getentropy_fallback(buf, len);
@@ -215,7 +214,7 @@ nodevrandom:
215 return -1; 214 return -1;
216} 215}
217 216
218static int cl[] = { 217static const int cl[] = {
219 CLOCK_REALTIME, 218 CLOCK_REALTIME,
220#ifdef CLOCK_MONOTONIC 219#ifdef CLOCK_MONOTONIC
221 CLOCK_MONOTONIC, 220 CLOCK_MONOTONIC,
@@ -279,6 +278,7 @@ getentropy_fallback(void *buf, size_t len)
279 278
280 for (ii = 0; ii < sizeof(cl)/sizeof(cl[0]); ii++) 279 for (ii = 0; ii < sizeof(cl)/sizeof(cl[0]); ii++)
281 HX(clock_gettime(cl[ii], &ts) == -1, ts); 280 HX(clock_gettime(cl[ii], &ts) == -1, ts);
281
282 HX((pid = getpid()) == -1, pid); 282 HX((pid = getpid()) == -1, pid);
283 HX((pid = getsid(pid)) == -1, pid); 283 HX((pid = getsid(pid)) == -1, pid);
284 HX((pid = getppid()) == -1, pid); 284 HX((pid = getppid()) == -1, pid);
diff --git a/src/lib/libcrypto/crypto/getentropy_linux.c b/src/lib/libcrypto/crypto/getentropy_linux.c
index 3fd30316d2..f1320d24d5 100644
--- a/src/lib/libcrypto/crypto/getentropy_linux.c
+++ b/src/lib/libcrypto/crypto/getentropy_linux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getentropy_linux.c,v 1.18 2014/07/08 09:38:55 beck Exp $ */ 1/* $OpenBSD: getentropy_linux.c,v 1.19 2014/07/12 14:46:31 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> 4 * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@@ -141,8 +141,8 @@ getentropy(void *buf, size_t len)
141 * sysctl ABI, or consider providing a new failsafe API which 141 * sysctl ABI, or consider providing a new failsafe API which
142 * works in a chroot or when file descriptors are exhausted. 142 * works in a chroot or when file descriptors are exhausted.
143 */ 143 */
144#undef FAIL_HARD_WHEN_LINUX_DEPRECATES_SYSCTL 144#undef FAIL_INSTEAD_OF_TRYING_FALLBACK
145#ifdef FAIL_HARD_WHEN_LINUX_DEPRECATES_SYSCTL 145#ifdef FAIL_INSTEAD_OF_TRYING_FALLBACK
146 raise(SIGKILL); 146 raise(SIGKILL);
147#endif 147#endif
148 ret = getentropy_fallback(buf, len); 148 ret = getentropy_fallback(buf, len);
@@ -179,12 +179,12 @@ getentropy_urandom(void *buf, size_t len)
179 179
180start: 180start:
181 181
182 flags = O_RDONLY; 182 flags = O_RDONLY;
183#ifdef O_NOFOLLOW 183#ifdef O_NOFOLLOW
184 flags |= O_NOFOLLOW; 184 flags |= O_NOFOLLOW;
185#endif 185#endif
186#ifdef O_CLOEXEC 186#ifdef O_CLOEXEC
187 flags |= O_CLOEXEC; 187 flags |= O_CLOEXEC;
188#endif 188#endif
189 fd = open("/dev/urandom", flags, 0); 189 fd = open("/dev/urandom", flags, 0);
190 if (fd == -1) { 190 if (fd == -1) {
diff --git a/src/lib/libcrypto/crypto/getentropy_solaris.c b/src/lib/libcrypto/crypto/getentropy_solaris.c
index 13afe7e3c9..83cc30aac2 100644
--- a/src/lib/libcrypto/crypto/getentropy_solaris.c
+++ b/src/lib/libcrypto/crypto/getentropy_solaris.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getentropy_solaris.c,v 1.2 2014/07/12 13:19:44 beck Exp $ */ 1/* $OpenBSD: getentropy_solaris.c,v 1.3 2014/07/12 14:46:31 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> 4 * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@@ -43,7 +43,6 @@
43#define SHA512_Update SHA512Update 43#define SHA512_Update SHA512Update
44#define SHA512_Final SHA512Final 44#define SHA512_Final SHA512Final
45 45
46
47#include <sys/vfs.h> 46#include <sys/vfs.h>
48#include <sys/statfs.h> 47#include <sys/statfs.h>
49#include <sys/loadavg.h> 48#include <sys/loadavg.h>
@@ -81,7 +80,7 @@ getentropy(void *buf, size_t len)
81 } 80 }
82 81
83 /* 82 /*
84 * Try to get entropy with /dev/urandom... 83 * Try to get entropy with /dev/urandom
85 * 84 *
86 * Solaris provides /dev/urandom as a symbolic link to 85 * Solaris provides /dev/urandom as a symbolic link to
87 * /devices/pseudo/random@0:urandom which is provided by 86 * /devices/pseudo/random@0:urandom which is provided by
@@ -132,8 +131,8 @@ getentropy(void *buf, size_t len)
132 * providing a new failsafe API which works in a chroot or 131 * providing a new failsafe API which works in a chroot or
133 * when file descriptors are exhausted. 132 * when file descriptors are exhausted.
134 */ 133 */
135#undef FAIL_WHEN_SYSTEM_ENTROPY_FAILS 134#undef FAIL_INSTEAD_OF_TRYING_FALLBACK
136#ifdef FAIL_WHEN_SYSTEM_ENTROPY_FAILS 135#ifdef FAIL_INSTEAD_OF_TRYING_FALLBACK
137 raise(SIGKILL); 136 raise(SIGKILL);
138#endif 137#endif
139 ret = getentropy_fallback(buf, len); 138 ret = getentropy_fallback(buf, len);
@@ -215,7 +214,7 @@ nodevrandom:
215 return -1; 214 return -1;
216} 215}
217 216
218static int cl[] = { 217static const int cl[] = {
219 CLOCK_REALTIME, 218 CLOCK_REALTIME,
220#ifdef CLOCK_MONOTONIC 219#ifdef CLOCK_MONOTONIC
221 CLOCK_MONOTONIC, 220 CLOCK_MONOTONIC,
@@ -279,6 +278,7 @@ getentropy_fallback(void *buf, size_t len)
279 278
280 for (ii = 0; ii < sizeof(cl)/sizeof(cl[0]); ii++) 279 for (ii = 0; ii < sizeof(cl)/sizeof(cl[0]); ii++)
281 HX(clock_gettime(cl[ii], &ts) == -1, ts); 280 HX(clock_gettime(cl[ii], &ts) == -1, ts);
281
282 HX((pid = getpid()) == -1, pid); 282 HX((pid = getpid()) == -1, pid);
283 HX((pid = getsid(pid)) == -1, pid); 283 HX((pid = getsid(pid)) == -1, pid);
284 HX((pid = getppid()) == -1, pid); 284 HX((pid = getppid()) == -1, pid);