summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorderaadt <>2014-07-21 23:34:54 +0000
committerderaadt <>2014-07-21 23:34:54 +0000
commit5f7c8e3b3667882edafd98090f7ead4e130824c8 (patch)
tree36304dc4146f842ff7d00b9f98197d738bb03e26 /src
parent020061f74efb2de9e81b625947d12fd92d08952b (diff)
downloadopenbsd-5f7c8e3b3667882edafd98090f7ead4e130824c8.tar.gz
openbsd-5f7c8e3b3667882edafd98090f7ead4e130824c8.tar.bz2
openbsd-5f7c8e3b3667882edafd98090f7ead4e130824c8.zip
protect sysctl path with SYS__sysctl instead; from enh@google, ok bcook
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/arc4random/getentropy_linux.c12
-rw-r--r--src/lib/libcrypto/crypto/getentropy_linux.c12
2 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/libcrypto/arc4random/getentropy_linux.c b/src/lib/libcrypto/arc4random/getentropy_linux.c
index eeaf9a4ef9..539a71af17 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.30 2014/07/21 20:19:47 guenther Exp $ */ 1/* $OpenBSD: getentropy_linux.c,v 1.31 2014/07/21 23:34:54 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>
@@ -76,7 +76,7 @@ int getentropy(void *buf, size_t len);
76static int gotdata(char *buf, size_t len); 76static int gotdata(char *buf, size_t len);
77static int getentropy_getrandom(void *buf, size_t len); 77static int getentropy_getrandom(void *buf, size_t len);
78static int getentropy_urandom(void *buf, size_t len); 78static int getentropy_urandom(void *buf, size_t len);
79#ifdef CTL_MAXNAME 79#ifdef SYS__sysctl
80static int getentropy_sysctl(void *buf, size_t len); 80static int getentropy_sysctl(void *buf, size_t len);
81#endif 81#endif
82static int getentropy_fallback(void *buf, size_t len); 82static int getentropy_fallback(void *buf, size_t len);
@@ -109,7 +109,7 @@ getentropy(void *buf, size_t len)
109 if (ret != -1) 109 if (ret != -1)
110 return (ret); 110 return (ret);
111 111
112#ifdef CTL_MAXNAME 112#ifdef SYS__sysctl
113 /* 113 /*
114 * Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID. 114 * Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID.
115 * sysctl is a failsafe API, so it guarantees a result. This 115 * sysctl is a failsafe API, so it guarantees a result. This
@@ -131,7 +131,7 @@ getentropy(void *buf, size_t len)
131 ret = getentropy_sysctl(buf, len); 131 ret = getentropy_sysctl(buf, len);
132 if (ret != -1) 132 if (ret != -1)
133 return (ret); 133 return (ret);
134#endif /* CTL_MAXNAME */ 134#endif /* SYS__sysctl */
135 135
136 /* 136 /*
137 * Entropy collection via /dev/urandom and sysctl have failed. 137 * Entropy collection via /dev/urandom and sysctl have failed.
@@ -270,7 +270,7 @@ nodevrandom:
270 return -1; 270 return -1;
271} 271}
272 272
273#ifdef CTL_MAXNAME 273#ifdef SYS__sysctl
274static int 274static int
275getentropy_sysctl(void *buf, size_t len) 275getentropy_sysctl(void *buf, size_t len)
276{ 276{
@@ -300,7 +300,7 @@ sysctlfailed:
300 errno = EIO; 300 errno = EIO;
301 return -1; 301 return -1;
302} 302}
303#endif /* CTL_MAXNAME */ 303#endif /* SYS__sysctl */
304 304
305static int cl[] = { 305static int cl[] = {
306 CLOCK_REALTIME, 306 CLOCK_REALTIME,
diff --git a/src/lib/libcrypto/crypto/getentropy_linux.c b/src/lib/libcrypto/crypto/getentropy_linux.c
index eeaf9a4ef9..539a71af17 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.30 2014/07/21 20:19:47 guenther Exp $ */ 1/* $OpenBSD: getentropy_linux.c,v 1.31 2014/07/21 23:34:54 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>
@@ -76,7 +76,7 @@ int getentropy(void *buf, size_t len);
76static int gotdata(char *buf, size_t len); 76static int gotdata(char *buf, size_t len);
77static int getentropy_getrandom(void *buf, size_t len); 77static int getentropy_getrandom(void *buf, size_t len);
78static int getentropy_urandom(void *buf, size_t len); 78static int getentropy_urandom(void *buf, size_t len);
79#ifdef CTL_MAXNAME 79#ifdef SYS__sysctl
80static int getentropy_sysctl(void *buf, size_t len); 80static int getentropy_sysctl(void *buf, size_t len);
81#endif 81#endif
82static int getentropy_fallback(void *buf, size_t len); 82static int getentropy_fallback(void *buf, size_t len);
@@ -109,7 +109,7 @@ getentropy(void *buf, size_t len)
109 if (ret != -1) 109 if (ret != -1)
110 return (ret); 110 return (ret);
111 111
112#ifdef CTL_MAXNAME 112#ifdef SYS__sysctl
113 /* 113 /*
114 * Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID. 114 * Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID.
115 * sysctl is a failsafe API, so it guarantees a result. This 115 * sysctl is a failsafe API, so it guarantees a result. This
@@ -131,7 +131,7 @@ getentropy(void *buf, size_t len)
131 ret = getentropy_sysctl(buf, len); 131 ret = getentropy_sysctl(buf, len);
132 if (ret != -1) 132 if (ret != -1)
133 return (ret); 133 return (ret);
134#endif /* CTL_MAXNAME */ 134#endif /* SYS__sysctl */
135 135
136 /* 136 /*
137 * Entropy collection via /dev/urandom and sysctl have failed. 137 * Entropy collection via /dev/urandom and sysctl have failed.
@@ -270,7 +270,7 @@ nodevrandom:
270 return -1; 270 return -1;
271} 271}
272 272
273#ifdef CTL_MAXNAME 273#ifdef SYS__sysctl
274static int 274static int
275getentropy_sysctl(void *buf, size_t len) 275getentropy_sysctl(void *buf, size_t len)
276{ 276{
@@ -300,7 +300,7 @@ sysctlfailed:
300 errno = EIO; 300 errno = EIO;
301 return -1; 301 return -1;
302} 302}
303#endif /* CTL_MAXNAME */ 303#endif /* SYS__sysctl */
304 304
305static int cl[] = { 305static int cl[] = {
306 CLOCK_REALTIME, 306 CLOCK_REALTIME,