From: Chris Denton chris@chrisdenton.dev
ProcessRng is the only publicly documented function exported by bcryptprimitives. This stub simply forwards it to RtlGenRandom in advapi32.
Note that there is no documented header file or import lib.
Documentation: https://learn.microsoft.com/en-us/windows/win32/seccng/processprng --- configure | 2 + configure.ac | 1 + dlls/bcryptprimitives/Makefile.in | 8 ++++ dlls/bcryptprimitives/bcryptprimitives.spec | 1 + dlls/bcryptprimitives/bcryptprimitives_main.c | 44 +++++++++++++++++++ 5 files changed, 56 insertions(+) create mode 100644 dlls/bcryptprimitives/Makefile.in create mode 100644 dlls/bcryptprimitives/bcryptprimitives.spec create mode 100644 dlls/bcryptprimitives/bcryptprimitives_main.c
diff --git a/configure b/configure index 5164b21486f..91a04862341 100755 --- a/configure +++ b/configure @@ -979,6 +979,7 @@ enable_avicap32 enable_avifil32 enable_avrt enable_bcrypt +enable_bcryptprimitives enable_bluetoothapis enable_browseui enable_bthprops_cpl @@ -21004,6 +21005,7 @@ wine_fn_config_makefile dlls/avifile.dll16 enable_win16 wine_fn_config_makefile dlls/avrt enable_avrt wine_fn_config_makefile dlls/bcrypt enable_bcrypt wine_fn_config_makefile dlls/bcrypt/tests enable_tests +wine_fn_config_makefile dlls/bcryptprimitives enable_bcryptprimitives wine_fn_config_makefile dlls/bluetoothapis enable_bluetoothapis wine_fn_config_makefile dlls/browseui enable_browseui wine_fn_config_makefile dlls/browseui/tests enable_tests diff --git a/configure.ac b/configure.ac index 84fadd08853..6fa72b8baf4 100644 --- a/configure.ac +++ b/configure.ac @@ -2372,6 +2372,7 @@ WINE_CONFIG_MAKEFILE(dlls/avifile.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/avrt) WINE_CONFIG_MAKEFILE(dlls/bcrypt) WINE_CONFIG_MAKEFILE(dlls/bcrypt/tests) +WINE_CONFIG_MAKEFILE(dlls/bcryptprimitives) WINE_CONFIG_MAKEFILE(dlls/bluetoothapis) WINE_CONFIG_MAKEFILE(dlls/browseui) WINE_CONFIG_MAKEFILE(dlls/browseui/tests) diff --git a/dlls/bcryptprimitives/Makefile.in b/dlls/bcryptprimitives/Makefile.in new file mode 100644 index 00000000000..bb59597899a --- /dev/null +++ b/dlls/bcryptprimitives/Makefile.in @@ -0,0 +1,8 @@ +MODULE = bcryptprimitives.dll +IMPORTS = advapi32 +IMPORTLIB = bcryptprimitives +UNIXLIB = bcryptprimitives.so +UNIX_CFLAGS = $(GNUTLS_CFLAGS) + +C_SRCS = \ + bcryptprimitives_main.c diff --git a/dlls/bcryptprimitives/bcryptprimitives.spec b/dlls/bcryptprimitives/bcryptprimitives.spec new file mode 100644 index 00000000000..928cb06afcd --- /dev/null +++ b/dlls/bcryptprimitives/bcryptprimitives.spec @@ -0,0 +1 @@ +@ stdcall ProcessPrng(ptr long) diff --git a/dlls/bcryptprimitives/bcryptprimitives_main.c b/dlls/bcryptprimitives/bcryptprimitives_main.c new file mode 100644 index 00000000000..32f4edaa1fb --- /dev/null +++ b/dlls/bcryptprimitives/bcryptprimitives_main.c @@ -0,0 +1,44 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windows.h" +#include "ntsecapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(bcrypt); + +BOOL WINAPI ProcessPrng(PBYTE pbData, SIZE_T cbData) +{ + if (RtlGenRandom(pbData, cbData)) return TRUE; + + /* ProcessRng is documented as never failing. */ + FIXME("RtlGenRandom failed in ProcessPrng.\n"); + return FALSE; +} + +BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) +{ + switch (reason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(instance); + break; + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +}