Browse Source

protect sysctl path with SYS__sysctl instead; from enh@google, ok bcook

OPENBSD_5_6
deraadt 10 years ago
parent
commit
ef5581e5fc
2 changed files with 12 additions and 12 deletions
  1. +6
    -6
      src/lib/libcrypto/arc4random/getentropy_linux.c
  2. +6
    -6
      src/lib/libcrypto/crypto/getentropy_linux.c

+ 6
- 6
src/lib/libcrypto/arc4random/getentropy_linux.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_linux.c,v 1.30 2014/07/21 20:19:47 guenther Exp $ */
/* $OpenBSD: getentropy_linux.c,v 1.31 2014/07/21 23:34:54 deraadt Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -76,7 +76,7 @@ int getentropy(void *buf, size_t len);
static int gotdata(char *buf, size_t len); static int gotdata(char *buf, size_t len);
static int getentropy_getrandom(void *buf, size_t len); static int getentropy_getrandom(void *buf, size_t len);
static int getentropy_urandom(void *buf, size_t len); static int getentropy_urandom(void *buf, size_t len);
#ifdef CTL_MAXNAME
#ifdef SYS__sysctl
static int getentropy_sysctl(void *buf, size_t len); static int getentropy_sysctl(void *buf, size_t len);
#endif #endif
static int getentropy_fallback(void *buf, size_t len); static int getentropy_fallback(void *buf, size_t len);
@ -109,7 +109,7 @@ getentropy(void *buf, size_t len)
if (ret != -1) if (ret != -1)
return (ret); return (ret);
#ifdef CTL_MAXNAME
#ifdef SYS__sysctl
/* /*
* Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID. * Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID.
* sysctl is a failsafe API, so it guarantees a result. This * sysctl is a failsafe API, so it guarantees a result. This
@ -131,7 +131,7 @@ getentropy(void *buf, size_t len)
ret = getentropy_sysctl(buf, len); ret = getentropy_sysctl(buf, len);
if (ret != -1) if (ret != -1)
return (ret); return (ret);
#endif /* CTL_MAXNAME */
#endif /* SYS__sysctl */
/* /*
* Entropy collection via /dev/urandom and sysctl have failed. * Entropy collection via /dev/urandom and sysctl have failed.
@ -270,7 +270,7 @@ nodevrandom:
return -1; return -1;
} }
#ifdef CTL_MAXNAME
#ifdef SYS__sysctl
static int static int
getentropy_sysctl(void *buf, size_t len) getentropy_sysctl(void *buf, size_t len)
{ {
@ -300,7 +300,7 @@ sysctlfailed:
errno = EIO; errno = EIO;
return -1; return -1;
} }
#endif /* CTL_MAXNAME */
#endif /* SYS__sysctl */
static int cl[] = { static int cl[] = {
CLOCK_REALTIME, CLOCK_REALTIME,


+ 6
- 6
src/lib/libcrypto/crypto/getentropy_linux.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_linux.c,v 1.30 2014/07/21 20:19:47 guenther Exp $ */
/* $OpenBSD: getentropy_linux.c,v 1.31 2014/07/21 23:34:54 deraadt Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -76,7 +76,7 @@ int getentropy(void *buf, size_t len);
static int gotdata(char *buf, size_t len); static int gotdata(char *buf, size_t len);
static int getentropy_getrandom(void *buf, size_t len); static int getentropy_getrandom(void *buf, size_t len);
static int getentropy_urandom(void *buf, size_t len); static int getentropy_urandom(void *buf, size_t len);
#ifdef CTL_MAXNAME
#ifdef SYS__sysctl
static int getentropy_sysctl(void *buf, size_t len); static int getentropy_sysctl(void *buf, size_t len);
#endif #endif
static int getentropy_fallback(void *buf, size_t len); static int getentropy_fallback(void *buf, size_t len);
@ -109,7 +109,7 @@ getentropy(void *buf, size_t len)
if (ret != -1) if (ret != -1)
return (ret); return (ret);
#ifdef CTL_MAXNAME
#ifdef SYS__sysctl
/* /*
* Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID. * Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID.
* sysctl is a failsafe API, so it guarantees a result. This * sysctl is a failsafe API, so it guarantees a result. This
@ -131,7 +131,7 @@ getentropy(void *buf, size_t len)
ret = getentropy_sysctl(buf, len); ret = getentropy_sysctl(buf, len);
if (ret != -1) if (ret != -1)
return (ret); return (ret);
#endif /* CTL_MAXNAME */
#endif /* SYS__sysctl */
/* /*
* Entropy collection via /dev/urandom and sysctl have failed. * Entropy collection via /dev/urandom and sysctl have failed.
@ -270,7 +270,7 @@ nodevrandom:
return -1; return -1;
} }
#ifdef CTL_MAXNAME
#ifdef SYS__sysctl
static int static int
getentropy_sysctl(void *buf, size_t len) getentropy_sysctl(void *buf, size_t len)
{ {
@ -300,7 +300,7 @@ sysctlfailed:
errno = EIO; errno = EIO;
return -1; return -1;
} }
#endif /* CTL_MAXNAME */
#endif /* SYS__sysctl */
static int cl[] = { static int cl[] = {
CLOCK_REALTIME, CLOCK_REALTIME,


Loading…
Cancel
Save