diff options
author | Bruno Haible <bruno@clisp.org> | 2020-05-31 18:23:04 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-05-31 18:23:04 +0200 |
commit | 8175e3ddda29a03d5e0aec4a1774339414996565 (patch) | |
tree | 6dda6c4f9711a1f925e9929277a42b41c62ce8fd /modules | |
parent | 053dd57da26bcda9f03180758fce81fffe7747c8 (diff) | |
download | gnulib-8175e3ddda29a03d5e0aec4a1774339414996565.tar.gz |
getrandom: Add support for native Windows.
* lib/getrandom.c: Include <errno.h>, <windows.h>, <bcrypt.h>,
<wincrypt.h>.
(CRYPT_VERIFY_CONTEXT): New macro.
(LoadLibrary, CryptAcquireContext): Redirect to the variant with suffix
'A'.
(GetProcAddress): New macro.
(BCryptGenRandomFuncType): New type.
(BCryptGenRandomFunc, initialized): New variables.
(initialize): New function.
(getrandom): On native Windows, use <bcrypt.h> API when available, and
<wincrypt.h> API as fallback.
* m4/getrandom.m4 (gl_FUNC_GETRANDOM): Set LIB_GETRANDOM.
* modules/getrandom (Link): New section.
* modules/getentropy (Link): Likewise.
* modules/getrandom-tests (Makefile.am): Link test-getrandom against
$(LIB_GETRANDOM).
* modules/getentropy-tests (Makefile.am): Link test-getentropy against
$(LIB_GETRANDOM).
* modules/sys_random-c++-tests (Makefile.am): Link test-sys_random-c++
against $(LIB_GETRANDOM).
* doc/glibc-functions/getrandom.texi: Mention the native Windows
support.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/getentropy | 3 | ||||
-rw-r--r-- | modules/getentropy-tests | 1 | ||||
-rw-r--r-- | modules/getrandom | 3 | ||||
-rw-r--r-- | modules/getrandom-tests | 1 | ||||
-rw-r--r-- | modules/sys_random-c++-tests | 1 |
5 files changed, 9 insertions, 0 deletions
diff --git a/modules/getentropy b/modules/getentropy index 9696c1e1d5..680aa4716b 100644 --- a/modules/getentropy +++ b/modules/getentropy @@ -22,6 +22,9 @@ Makefile.am: Include: <unistd.h> +Link: +$(LIB_GETRANDOM) + License: LGPL diff --git a/modules/getentropy-tests b/modules/getentropy-tests index b5c4b1144e..7ad786109c 100644 --- a/modules/getentropy-tests +++ b/modules/getentropy-tests @@ -10,3 +10,4 @@ configure.ac: Makefile.am: TESTS += test-getentropy check_PROGRAMS += test-getentropy +test_getentropy_LDADD = $(LDADD) $(LIB_GETRANDOM) diff --git a/modules/getrandom b/modules/getrandom index 8aa4be2b78..76437eb5ad 100644 --- a/modules/getrandom +++ b/modules/getrandom @@ -23,6 +23,9 @@ Makefile.am: Include: <sys/random.h> +Link: +$(LIB_GETRANDOM) + License: LGPL diff --git a/modules/getrandom-tests b/modules/getrandom-tests index 8982173613..b7f64dd205 100644 --- a/modules/getrandom-tests +++ b/modules/getrandom-tests @@ -10,3 +10,4 @@ configure.ac: Makefile.am: TESTS += test-getrandom check_PROGRAMS += test-getrandom +test_getrandom_LDADD = $(LDADD) @LIB_GETRANDOM@ diff --git a/modules/sys_random-c++-tests b/modules/sys_random-c++-tests index e07d81f0e7..5b3c505fd4 100644 --- a/modules/sys_random-c++-tests +++ b/modules/sys_random-c++-tests @@ -15,4 +15,5 @@ if ANSICXX TESTS += test-sys_random-c++ check_PROGRAMS += test-sys_random-c++ test_sys_random_c___SOURCES = test-sys_random-c++.cc +test_sys_random_c___LDADD = $(LDADD) $(LIB_GETRANDOM) endif |