[2/3] bcrypt/tests: Don't load bcrypt dynamically.
Hans Leidekker
hans at codeweavers.com
Wed Jan 13 03:43:36 CST 2016
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
configure.ac | 2 +-
dlls/bcrypt/tests/Makefile.in | 2 +-
dlls/bcrypt/tests/bcrypt.c | 54 ++++++++-----------------------------------
3 files changed, 12 insertions(+), 46 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6f6423b..3549048 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2715,7 +2715,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/tests/Makefile.in b/dlls/bcrypt/tests/Makefile.in
index b193519..0f130b1 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 9e659d6..ad54ab2 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.6.4
More information about the wine-patches
mailing list