]> Savannah Git Hosting - gnulib.git/commit
getrandom: Add support for native Windows.
authorBruno Haible <bruno@clisp.org>
Sun, 31 May 2020 16:23:04 +0000 (18:23 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 31 May 2020 16:23:04 +0000 (18:23 +0200)
commit8175e3ddda29a03d5e0aec4a1774339414996565
tree6dda6c4f9711a1f925e9929277a42b41c62ce8fd
parent053dd57da26bcda9f03180758fce81fffe7747c8
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.
ChangeLog
doc/glibc-functions/getrandom.texi
lib/getrandom.c
m4/getrandom.m4
modules/getentropy
modules/getentropy-tests
modules/getrandom
modules/getrandom-tests
modules/sys_random-c++-tests