Mailing List Archive

PATCH random/rndgetentropy.c: fix build failure on macOS
Before the weekend I did a speedo.mk build of gnupg off the master
branches on an Intel MacBook running Big Sur with Xcode 13.2.1 using the
MacOS SDK 12.1.

libgcrypt fails in rndgetentropy.c because the prototype for getentropy()
is missing. The prototype is provided by sys/random.h per the man pages.

The following patch fixes this for me.
--chris

1 file changed, 3 insertions(+)
random/rndgetentropy.c | 3 +++

modified random/rndgetentropy.c
@@ -23,6 +23,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
+#ifdef __APPLE__
+#include <sys/random.h> /* getentropy(2) lives here */
+#endif
#include <sys/types.h>
#include <string.h>
#include <unistd.h>


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@lists.gnupg.org
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: PATCH random/rndgetentropy.c: fix build failure on macOS [ In reply to ]
Hello,

Christoph Badura <bad@bsd.de> wrote:
> libgcrypt fails in rndgetentropy.c because the prototype for getentropy()
> is missing. The prototype is provided by sys/random.h per the man pages.

Thank you for your report.

Using HAVE_SYS_RANDOM_H, fixed in the commit of:

3d353782d84b9720262d7b05adfae3aef7ff843b
--

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@lists.gnupg.org
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel