Author: akhaldi
Date: Tue Mar 1 12:28:40 2016
New Revision: 70831
URL:
http://svn.reactos.org/svn/reactos?rev=70831&view=rev
Log:
[BCRYPT_WINETEST] Sync with Wine Staging 1.9.4. CORE-10912
Modified:
trunk/rostests/winetests/bcrypt/CMakeLists.txt
trunk/rostests/winetests/bcrypt/bcrypt.c
Modified: trunk/rostests/winetests/bcrypt/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/bcrypt/CMakeLis…
==============================================================================
--- trunk/rostests/winetests/bcrypt/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/winetests/bcrypt/CMakeLists.txt [iso-8859-1] Tue Mar 1 12:28:40 2016
@@ -1,5 +1,5 @@
add_executable(bcrypt_winetest bcrypt.c testlist.c)
set_module_type(bcrypt_winetest win32cui)
-add_importlibs(bcrypt_winetest user32 msvcrt kernel32)
+add_importlibs(bcrypt_winetest bcrypt user32 msvcrt kernel32)
add_cd_file(TARGET bcrypt_winetest DESTINATION reactos/bin FOR all)
Modified: trunk/rostests/winetests/bcrypt/bcrypt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/bcrypt/bcrypt.c…
==============================================================================
--- trunk/rostests/winetests/bcrypt/bcrypt.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/bcrypt/bcrypt.c [iso-8859-1] Tue Mar 1 12:28:40 2016
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include <stdio.h>
#include <ntstatus.h>
#define WIN32_NO_STATUS
#include <windows.h>
@@ -25,57 +26,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 +61,355 @@
NTSTATUS ret;
BOOLEAN enabled;
- if (!pBCryptGetFipsAlgorithmMode)
+ ret = BCryptGetFipsAlgorithmMode(&enabled);
+ ok(ret == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%x\n", ret);
+
+ ret = BCryptGetFipsAlgorithmMode(NULL);
+ ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got
0x%x\n", ret);
+}
+
+static void format_hash(const UCHAR *bytes, ULONG size, char *buf)
+{
+ ULONG i;
+ buf[0] = '\0';
+ for (i = 0; i < size; i++)
{
- win_skip("BCryptGetFipsAlgorithmMode is not available\n");
- return;
+ sprintf(buf + i * 2, "%02x", bytes[i]);
}
-
- ret = pBCryptGetFipsAlgorithmMode(&enabled);
- ok(ret == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%x\n", ret);
-
- ret = pBCryptGetFipsAlgorithmMode(NULL);
- ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got
0x%x\n", ret);
+ return;
+}
+
+static int strcmp_wa(const WCHAR *strw, const char *stra)
+{
+ WCHAR buf[512];
+ MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, sizeof(buf)/sizeof(buf[0]));
+ return lstrcmpW(strw, buf);
+}
+
+#define test_hash_length(a,b) _test_hash_length(__LINE__,a,b)
+static void _test_hash_length(unsigned line, void *handle, ULONG exlen)
+{
+ ULONG len = 0xdeadbeef, size = 0xdeadbeef;
+ NTSTATUS status;
+
+ status = BCryptGetProperty(handle, BCRYPT_HASH_LENGTH, (UCHAR *)&len,
sizeof(len), &size, 0);
+ ok_(__FILE__,line)(status == STATUS_SUCCESS, "BCryptGetProperty failed:
%08x\n", status);
+ ok_(__FILE__,line)(size == sizeof(len), "got %u\n", size);
+ ok_(__FILE__,line)(len == exlen, "len = %u, expected %u\n", len, exlen);
+}
+
+#define test_alg_name(a,b) _test_alg_name(__LINE__,a,b)
+static void _test_alg_name(unsigned line, void *handle, const char *exname)
+{
+ ULONG size = 0xdeadbeef;
+ UCHAR buf[256];
+ const WCHAR *name = (const WCHAR*)buf;
+ NTSTATUS status;
+
+ status = BCryptGetProperty(handle, BCRYPT_ALGORITHM_NAME, buf, sizeof(buf),
&size, 0);
+ ok_(__FILE__,line)(status == STATUS_SUCCESS, "BCryptGetProperty failed:
%08x\n", status);
+ ok_(__FILE__,line)(size == (strlen(exname)+1)*sizeof(WCHAR), "got %u\n",
size);
+ ok_(__FILE__,line)(!strcmp_wa(name, exname), "alg name = %s, expected
%s\n", wine_dbgstr_w(name), exname);
+}
+
+static void test_sha1(void)
+{
+ static const char expected[] = "961fa64958818f767707072755d7018dcd278e94";
+ BCRYPT_ALG_HANDLE alg;
+ BCRYPT_HASH_HANDLE hash;
+ UCHAR buf[512], sha1[20];
+ ULONG size, len;
+ char str[41];
+ NTSTATUS ret;
+
+ alg = NULL;
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_SHA1_ALGORITHM,
MS_PRIMITIVE_PROVIDER, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(alg != NULL, "alg not set\n");
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(NULL, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len),
&size, 0);
+ ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, NULL, (UCHAR *)&len, sizeof(len), &size, 0);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len),
NULL, 0);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, NULL, sizeof(len), &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(size == sizeof(len), "got %u\n", size);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, 0, &size,
0);
+ ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
+ ok(len == 0xdeadbeef, "got %u\n", len);
+ ok(size == sizeof(len), "got %u\n", size);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len , sizeof(len),
&size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(len != 0xdeadbeef, "len not set\n");
+ ok(size == sizeof(len), "got %u\n", size);
+
+ test_hash_length(alg, 20);
+ test_alg_name(alg, "SHA1");
+
+ hash = NULL;
+ len = sizeof(buf);
+ ret = BCryptCreateHash(alg, &hash, buf, len, NULL, 0, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(hash != NULL, "hash not set\n");
+
+ ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+
+ test_hash_length(hash, 20);
+ test_alg_name(hash, "SHA1");
+
+ memset(sha1, 0, sizeof(sha1));
+ ret = BCryptFinishHash(hash, sha1, sizeof(sha1), 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ format_hash( sha1, sizeof(sha1), str );
+ ok(!strcmp(str, expected), "got %s\n", str);
+
+ ret = BCryptDestroyHash(hash);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+}
+
+static void test_sha256(void)
+{
+ static const char expected[] =
+ "ceb73749c899693706ede1e30c9929b3fd5dd926163831c2fb8bd41e6efb1126";
+ BCRYPT_ALG_HANDLE alg;
+ BCRYPT_HASH_HANDLE hash;
+ UCHAR buf[512], sha256[32];
+ ULONG size, len;
+ char str[65];
+ NTSTATUS ret;
+
+ alg = NULL;
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_SHA256_ALGORITHM,
MS_PRIMITIVE_PROVIDER, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(alg != NULL, "alg not set\n");
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(NULL, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len),
&size, 0);
+ ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, NULL, (UCHAR *)&len, sizeof(len), &size, 0);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len),
NULL, 0);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, NULL, sizeof(len), &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(size == sizeof(len), "got %u\n", size);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, 0, &size,
0);
+ ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
+ ok(len == 0xdeadbeef, "got %u\n", len);
+ ok(size == sizeof(len), "got %u\n", size);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len , sizeof(len),
&size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(len != 0xdeadbeef, "len not set\n");
+ ok(size == sizeof(len), "got %u\n", size);
+
+ test_hash_length(alg, 32);
+ test_alg_name(alg, "SHA256");
+
+ hash = NULL;
+ len = sizeof(buf);
+ ret = BCryptCreateHash(alg, &hash, buf, len, NULL, 0, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(hash != NULL, "hash not set\n");
+
+ ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+
+ test_hash_length(hash, 32);
+ test_alg_name(hash, "SHA256");
+
+ memset(sha256, 0, sizeof(sha256));
+ ret = BCryptFinishHash(hash, sha256, sizeof(sha256), 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ format_hash( sha256, sizeof(sha256), str );
+ ok(!strcmp(str, expected), "got %s\n", str);
+
+ ret = BCryptDestroyHash(hash);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+}
+
+static void test_sha384(void)
+{
+ static const char expected[] =
+
"62b21e90c9022b101671ba1f808f8631a8149f0f12904055839a35c1ca78ae5363eed1e743a692d70e0504b0cfd12ef9";
+ BCRYPT_ALG_HANDLE alg;
+ BCRYPT_HASH_HANDLE hash;
+ UCHAR buf[512], sha384[48];
+ ULONG size, len;
+ char str[97];
+ NTSTATUS ret;
+
+ alg = NULL;
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_SHA384_ALGORITHM,
MS_PRIMITIVE_PROVIDER, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(alg != NULL, "alg not set\n");
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(NULL, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len),
&size, 0);
+ ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, NULL, (UCHAR *)&len, sizeof(len), &size, 0);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len),
NULL, 0);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, NULL, sizeof(len), &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(size == sizeof(len), "got %u\n", size);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, 0, &size,
0);
+ ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
+ ok(len == 0xdeadbeef, "got %u\n", len);
+ ok(size == sizeof(len), "got %u\n", size);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len , sizeof(len),
&size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(len != 0xdeadbeef, "len not set\n");
+ ok(size == sizeof(len), "got %u\n", size);
+
+ test_hash_length(alg, 48);
+ test_alg_name(alg, "SHA384");
+
+ hash = NULL;
+ len = sizeof(buf);
+ ret = BCryptCreateHash(alg, &hash, buf, len, NULL, 0, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(hash != NULL, "hash not set\n");
+
+ ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+
+ test_hash_length(hash, 48);
+ test_alg_name(hash, "SHA384");
+
+ memset(sha384, 0, sizeof(sha384));
+ ret = BCryptFinishHash(hash, sha384, sizeof(sha384), 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ format_hash( sha384, sizeof(sha384), str );
+ ok(!strcmp(str, expected), "got %s\n", str);
+
+ ret = BCryptDestroyHash(hash);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+}
+
+static void test_sha512(void)
+{
+ static const char expected[] =
+ "d55ced17163bf5386f2cd9ff21d6fd7fe576a915065c24744d09cfae4ec84ee1e"
+ "f6ef11bfbc5acce3639bab725b50a1fe2c204f8c820d6d7db0df0ecbc49c5ca";
+ BCRYPT_ALG_HANDLE alg;
+ BCRYPT_HASH_HANDLE hash;
+ UCHAR buf[512], sha512[64];
+ ULONG size, len;
+ char str[129];
+ NTSTATUS ret;
+
+ alg = NULL;
+ ret = BCryptOpenAlgorithmProvider(&alg, BCRYPT_SHA512_ALGORITHM,
MS_PRIMITIVE_PROVIDER, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(alg != NULL, "alg not set\n");
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(NULL, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len),
&size, 0);
+ ok(ret == STATUS_INVALID_HANDLE, "got %08x\n", ret);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, NULL, (UCHAR *)&len, sizeof(len), &size, 0);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len),
NULL, 0);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %08x\n", ret);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, NULL, sizeof(len), &size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(size == sizeof(len), "got %u\n", size);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, 0, &size,
0);
+ ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
+ ok(len == 0xdeadbeef, "got %u\n", len);
+ ok(size == sizeof(len), "got %u\n", size);
+
+ len = size = 0xdeadbeef;
+ ret = BCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len , sizeof(len),
&size, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(len != 0xdeadbeef, "len not set\n");
+ ok(size == sizeof(len), "got %u\n", size);
+
+ test_hash_length(alg, 64);
+ test_alg_name(alg, "SHA512");
+
+ hash = NULL;
+ len = sizeof(buf);
+ ret = BCryptCreateHash(alg, &hash, buf, len, NULL, 0, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ ok(hash != NULL, "hash not set\n");
+
+ ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+
+ test_hash_length(hash, 64);
+ test_alg_name(hash, "SHA512");
+
+ memset(sha512, 0, sizeof(sha512));
+ ret = BCryptFinishHash(hash, sha512, sizeof(sha512), 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+ format_hash( sha512, sizeof(sha512), str );
+ ok(!strcmp(str, expected), "got %s\n", str);
+
+ ret = BCryptDestroyHash(hash);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+
+ ret = BCryptCloseAlgorithmProvider(alg, 0);
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
}
START_TEST(bcrypt)
{
- if (!Init())
- return;
-
test_BCryptGenRandom();
test_BCryptGetFipsAlgorithmMode();
-}
+ test_sha1();
+ test_sha256();
+ test_sha384();
+ test_sha512();
+}