summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-06-28 13:22:44 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-06-28 13:24:06 -0700
commit665014452dec841302785bcd0fc4dc96d93f3d30 (patch)
tree2fb65ad54fd18d9e9c5e717dc2ef03f0ad024c7a /lib
parent162f375bac22786d95a253f03de0148be4fe3201 (diff)
downloademacs-665014452dec841302785bcd0fc4dc96d93f3d30.tar.gz
Update from Gnulib.
This incorporates: 2020-06-28 getrandom: do not depend on ‘open’ on mingw 2020-06-28 getrandom: fix compilation errors on older versions of mingw * build-aux/config.sub, lib/getrandom.c, m4/getrandom.m4: Copy from Gnulib * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
Diffstat (limited to 'lib')
-rw-r--r--lib/getrandom.c11
-rw-r--r--lib/gnulib.mk.in4
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/getrandom.c b/lib/getrandom.c
index f0b3f535007..030a78bb08d 100644
--- a/lib/getrandom.c
+++ b/lib/getrandom.c
@@ -29,7 +29,16 @@
#if defined _WIN32 && ! defined __CYGWIN__
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
-# include <bcrypt.h>
+# if HAVE_BCRYPT_H
+# include <bcrypt.h>
+# else
+# include <ntdef.h> /* NTSTATUS */
+typedef void * BCRYPT_ALG_HANDLE;
+# define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002
+# if HAVE_LIB_BCRYPT
+extern NTSTATUS WINAPI BCryptGenRandom (BCRYPT_ALG_HANDLE, UCHAR *, ULONG, ULONG);
+# endif
+# endif
# if !HAVE_LIB_BCRYPT
# include <wincrypt.h>
# ifndef CRYPT_VERIFY_CONTEXT
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 8174ea26fa5..35d2db09bd4 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -109,6 +109,7 @@
# futimens \
# getloadavg \
# getopt-gnu \
+# getrandom \
# gettime \
# gettimeofday \
# gitlog-to-changelog \
@@ -1095,6 +1096,7 @@ gl_GNULIB_ENABLED_getdtablesize = @gl_GNULIB_ENABLED_getdtablesize@
gl_GNULIB_ENABLED_getgroups = @gl_GNULIB_ENABLED_getgroups@
gl_GNULIB_ENABLED_lchmod = @gl_GNULIB_ENABLED_lchmod@
gl_GNULIB_ENABLED_malloca = @gl_GNULIB_ENABLED_malloca@
+gl_GNULIB_ENABLED_open = @gl_GNULIB_ENABLED_open@
gl_GNULIB_ENABLED_strtoll = @gl_GNULIB_ENABLED_strtoll@
gl_GNULIB_ENABLED_utimens = @gl_GNULIB_ENABLED_utimens@
gl_LIBOBJS = @gl_LIBOBJS@
@@ -2168,7 +2170,9 @@ endif
## begin gnulib module open
ifeq (,$(OMIT_GNULIB_MODULE_open))
+ifneq (,$(gl_GNULIB_ENABLED_open))
+endif
EXTRA_DIST += open.c
EXTRA_libgnu_a_SOURCES += open.c