From 7897c5a60f06f73672a6a24e8c0da99883c90b28 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Wed, 13 Jan 2016 10:43:36 +0100 Subject: [PATCH] bcrypt/tests: Don't load bcrypt dynamically. Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- configure | 2 +- configure.ac | 2 +- dlls/bcrypt/Makefile.in | 1 + dlls/bcrypt/tests/Makefile.in | 2 +- dlls/bcrypt/tests/bcrypt.c | 54 ++++++++----------------------------------- 5 files changed, 14 insertions(+), 47 deletions(-) diff --git a/configure b/configure index 339a734ba82..66dca2b0c93 100755 --- a/configure +++ b/configure @@ -17379,7 +17379,7 @@ wine_fn_config_dll avifil32 enable_avifil32 clean,implib,po wine_fn_config_test dlls/avifil32/tests avifil32_test wine_fn_config_dll avifile.dll16 enable_win16 wine_fn_config_dll avrt enable_avrt implib -wine_fn_config_dll bcrypt enable_bcrypt +wine_fn_config_dll bcrypt enable_bcrypt implib wine_fn_config_test dlls/bcrypt/tests bcrypt_test wine_fn_config_dll bluetoothapis enable_bluetoothapis wine_fn_config_dll browseui enable_browseui clean,po diff --git a/configure.ac b/configure.ac index 37129067e41..811e2aa9b90 100644 --- a/configure.ac +++ b/configure.ac @@ -2723,7 +2723,7 @@ WINE_CONFIG_DLL(avifil32,,[clean,implib,po]) WINE_CONFIG_TEST(dlls/avifil32/tests) WINE_CONFIG_DLL(avifile.dll16,enable_win16) WINE_CONFIG_DLL(avrt,,[implib]) -WINE_CONFIG_DLL(bcrypt) +WINE_CONFIG_DLL(bcrypt,,[implib]) WINE_CONFIG_TEST(dlls/bcrypt/tests) WINE_CONFIG_DLL(bluetoothapis) WINE_CONFIG_DLL(browseui,,[clean,po]) diff --git a/dlls/bcrypt/Makefile.in b/dlls/bcrypt/Makefile.in index 54814a0735f..ef9d7ead6bc 100644 --- a/dlls/bcrypt/Makefile.in +++ b/dlls/bcrypt/Makefile.in @@ -1,5 +1,6 @@ MODULE = bcrypt.dll IMPORTS = advapi32 +IMPORTLIB = bcrypt EXTRAINCL = $(GNUTLS_CFLAGS) C_SRCS = \ diff --git a/dlls/bcrypt/tests/Makefile.in b/dlls/bcrypt/tests/Makefile.in index b1935198606..0f130b1460c 100644 --- a/dlls/bcrypt/tests/Makefile.in +++ b/dlls/bcrypt/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = bcrypt.dll -IMPORTS = user32 +IMPORTS = bcrypt user32 C_SRCS = \ bcrypt.c diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index 9e659d69b79..ad54ab28d36 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -25,57 +25,32 @@ #include "wine/test.h" -static NTSTATUS (WINAPI *pBCryptGenRandom)(BCRYPT_ALG_HANDLE hAlgorithm, PUCHAR pbBuffer, - ULONG cbBuffer, ULONG dwFlags); -static NTSTATUS (WINAPI *pBCryptGetFipsAlgorithmMode)(BOOLEAN *enabled); - -static BOOL Init(void) -{ - HMODULE hbcrypt = LoadLibraryA("bcrypt.dll"); - if (!hbcrypt) - { - win_skip("bcrypt library not available\n"); - return FALSE; - } - - pBCryptGenRandom = (void *)GetProcAddress(hbcrypt, "BCryptGenRandom"); - pBCryptGetFipsAlgorithmMode = (void *)GetProcAddress(hbcrypt, "BCryptGetFipsAlgorithmMode"); - - return TRUE; -} - static void test_BCryptGenRandom(void) { NTSTATUS ret; UCHAR buffer[256]; - if (!pBCryptGenRandom) - { - win_skip("BCryptGenRandom is not available\n"); - return; - } - - ret = pBCryptGenRandom(NULL, NULL, 0, 0); + ret = BCryptGenRandom(NULL, NULL, 0, 0); ok(ret == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got 0x%x\n", ret); - ret = pBCryptGenRandom(NULL, buffer, 0, 0); + ret = BCryptGenRandom(NULL, buffer, 0, 0); ok(ret == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got 0x%x\n", ret); - ret = pBCryptGenRandom(NULL, buffer, sizeof(buffer), 0); + ret = BCryptGenRandom(NULL, buffer, sizeof(buffer), 0); ok(ret == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got 0x%x\n", ret); - ret = pBCryptGenRandom(NULL, buffer, sizeof(buffer), BCRYPT_USE_SYSTEM_PREFERRED_RNG); + ret = BCryptGenRandom(NULL, buffer, sizeof(buffer), BCRYPT_USE_SYSTEM_PREFERRED_RNG); ok(ret == STATUS_SUCCESS, "Expected success, got 0x%x\n", ret); - ret = pBCryptGenRandom(NULL, buffer, sizeof(buffer), + ret = BCryptGenRandom(NULL, buffer, sizeof(buffer), BCRYPT_USE_SYSTEM_PREFERRED_RNG|BCRYPT_RNG_USE_ENTROPY_IN_BUFFER); ok(ret == STATUS_SUCCESS, "Expected success, got 0x%x\n", ret); - ret = pBCryptGenRandom(NULL, NULL, sizeof(buffer), BCRYPT_USE_SYSTEM_PREFERRED_RNG); + ret = BCryptGenRandom(NULL, NULL, sizeof(buffer), BCRYPT_USE_SYSTEM_PREFERRED_RNG); ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got 0x%x\n", ret); /* Zero sized buffer should work too */ - ret = pBCryptGenRandom(NULL, buffer, 0, BCRYPT_USE_SYSTEM_PREFERRED_RNG); + ret = BCryptGenRandom(NULL, buffer, 0, BCRYPT_USE_SYSTEM_PREFERRED_RNG); ok(ret == STATUS_SUCCESS, "Expected success, got 0x%x\n", ret); /* Test random number generation - It's impossible for a sane RNG to return 8 zeros */ memset(buffer, 0, 16); - ret = pBCryptGenRandom(NULL, buffer, 8, BCRYPT_USE_SYSTEM_PREFERRED_RNG); + ret = BCryptGenRandom(NULL, buffer, 8, BCRYPT_USE_SYSTEM_PREFERRED_RNG); ok(ret == STATUS_SUCCESS, "Expected success, got 0x%x\n", ret); ok(memcmp(buffer, buffer + 8, 8), "Expected a random number, got 0\n"); } @@ -85,24 +60,15 @@ static void test_BCryptGetFipsAlgorithmMode(void) NTSTATUS ret; BOOLEAN enabled; - if (!pBCryptGetFipsAlgorithmMode) - { - win_skip("BCryptGetFipsAlgorithmMode is not available\n"); - return; - } - - ret = pBCryptGetFipsAlgorithmMode(&enabled); + ret = BCryptGetFipsAlgorithmMode(&enabled); ok(ret == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%x\n", ret); - ret = pBCryptGetFipsAlgorithmMode(NULL); + ret = BCryptGetFipsAlgorithmMode(NULL); ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got 0x%x\n", ret); } START_TEST(bcrypt) { - if (!Init()) - return; - test_BCryptGenRandom(); test_BCryptGetFipsAlgorithmMode(); } -- 2.11.4.GIT