Browse Source

ensure SYS_getrandom and GRND_NONBLOCK are both defined before using getrandom(2)

Based on discussion here https://github.com/libressl-portable/openbsd/pull/82
Suggested fix from jsing@
OPENBSD_6_3
bcook 6 years ago
parent
commit
becf8cef00
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      src/lib/libcrypto/arc4random/getentropy_linux.c

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

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_linux.c,v 1.44 2017/04/29 18:43:31 beck Exp $ */
/* $OpenBSD: getentropy_linux.c,v 1.45 2018/03/13 22:53:28 bcook Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -74,7 +74,7 @@
int getentropy(void *buf, size_t len); int getentropy(void *buf, size_t len);
static int gotdata(char *buf, size_t len); static int gotdata(char *buf, size_t len);
#ifdef SYS_getrandom
#if defined(SYS_getrandom) && defined(GRND_NONBLOCK)
static int getentropy_getrandom(void *buf, size_t len); static int getentropy_getrandom(void *buf, size_t len);
#endif #endif
static int getentropy_urandom(void *buf, size_t len); static int getentropy_urandom(void *buf, size_t len);
@ -94,7 +94,7 @@ getentropy(void *buf, size_t len)
return (-1); return (-1);
} }
#ifdef SYS_getrandom
#if defined(SYS_getrandom) && defined(GRND_NONBLOCK)
/* /*
* Try descriptor-less getrandom(), in non-blocking mode. * Try descriptor-less getrandom(), in non-blocking mode.
* *
@ -193,7 +193,7 @@ gotdata(char *buf, size_t len)
return (0); return (0);
} }
#ifdef SYS_getrandom
#if defined(SYS_getrandom) && defined(GRND_NONBLOCK)
static int static int
getentropy_getrandom(void *buf, size_t len) getentropy_getrandom(void *buf, size_t len)
{ {


Loading…
Cancel
Save