23#define WIN32_NO_STATUS
72 static const WCHAR policyKeyVistaW[] = {
73 'S',
'y',
's',
't',
'e',
'm',
'\\',
74 'C',
'u',
'r',
'r',
'e',
'n',
't',
'C',
'o',
'n',
't',
'r',
'o',
'l',
'S',
'e',
't',
'\\',
75 'C',
'o',
'n',
't',
'r',
'o',
'l',
'\\',
77 'F',
'I',
'P',
'S',
'A',
'l',
'g',
'o',
'r',
'i',
't',
'h',
'm',
'P',
'o',
'l',
'i',
'c',
'y',0};
78 static const WCHAR policyValueVistaW[] = {
'E',
'n',
'a',
'b',
'l',
'e',
'd',0};
79 static const WCHAR policyKeyXPW[] = {
80 'S',
'y',
's',
't',
'e',
'm',
'\\',
81 'C',
'u',
'r',
'r',
'e',
'n',
't',
'C',
'o',
'n',
't',
'r',
'o',
'l',
'S',
'e',
't',
'\\',
82 'C',
'o',
'n',
't',
'r',
'o',
'l',
'\\',
84 static const WCHAR policyValueXPW[] = {
85 'F',
'I',
'P',
'S',
'A',
'l',
'g',
'o',
'r',
'i',
't',
'h',
'm',
'P',
'o',
'l',
'i',
'c',
'y',0};
106 ok(0,
"Neither XP or Vista key is present\n");
114 ret = pBCryptGetFipsAlgorithmMode(
NULL);
136#define test_hash_length(a,b) _test_hash_length(__LINE__,a,b)
145 ok_(__FILE__,
line)(
len == exlen,
"len = %u, expected %u\n",
len, exlen);
148#define test_alg_name(a,b) _test_alg_name(__LINE__,a,b)
164 static const char expected[] =
"961fa64958818f767707072755d7018dcd278e94";
165 static const char expected_hmac[] =
"2472cf65d0e090618d769d3e46f0d9446cf212da";
168 UCHAR buf[512], buf_hmac[1024],
sha1[20], sha1_hmac[20];
176 ok(alg !=
NULL,
"alg not set\n");
198 ok(
len == 0xdeadbeef,
"got %u\n",
len);
204 ok(
len != 0xdeadbeef,
"len not set\n");
219 ret = pBCryptHashData(
hash, (
UCHAR *)
"test",
sizeof(
"test"), 0);
231 ret = pBCryptDestroyHash(
hash);
234 ret = pBCryptCloseAlgorithmProvider(alg, 0);
240 ok(alg !=
NULL,
"alg not set\n");
243 len =
sizeof(buf_hmac);
244 ret = pBCryptCreateHash(alg, &
hash, buf_hmac,
len, (
UCHAR *)
"key",
sizeof(
"key"), 0);
248 ret = pBCryptHashData(
hash, (
UCHAR *)
"test",
sizeof(
"test"), 0);
254 memset(sha1_hmac, 0,
sizeof(sha1_hmac));
255 ret = pBCryptFinishHash(
hash, sha1_hmac,
sizeof(sha1_hmac), 0);
260 ret = pBCryptDestroyHash(
hash);
263 ret = pBCryptCloseAlgorithmProvider(alg, 0);
270 "ceb73749c899693706ede1e30c9929b3fd5dd926163831c2fb8bd41e6efb1126";
271 static const char expected_hmac[] =
272 "34c1aa473a4468a91d06e7cdbc75bc4f93b830ccfc2a47ffd74e8e6ed29e4c72";
283 ok(alg !=
NULL,
"alg not set\n");
305 ok(
len == 0xdeadbeef,
"got %u\n",
len);
311 ok(
len != 0xdeadbeef,
"len not set\n");
326 ret = pBCryptHashData(
hash, (
UCHAR *)
"test",
sizeof(
"test"), 0);
338 ret = pBCryptDestroyHash(
hash);
341 ret = pBCryptCloseAlgorithmProvider(alg, 0);
347 ok(alg !=
NULL,
"alg not set\n");
350 len =
sizeof(buf_hmac);
351 ret = pBCryptCreateHash(alg, &
hash, buf_hmac,
len, (
UCHAR *)
"key",
sizeof(
"key"), 0);
355 ret = pBCryptHashData(
hash, (
UCHAR *)
"test",
sizeof(
"test"), 0);
361 memset(sha256_hmac, 0,
sizeof(sha256_hmac));
362 ret = pBCryptFinishHash(
hash, sha256_hmac,
sizeof(sha256_hmac), 0);
367 ret = pBCryptDestroyHash(
hash);
370 ret = pBCryptCloseAlgorithmProvider(alg, 0);
377 "62b21e90c9022b101671ba1f808f8631a8149f0f12904055839a35c1ca78ae5363eed1e743a692d70e0504b0cfd12ef9";
378 static const char expected_hmac[] =
379 "4b3e6d6ff2da121790ab7e7b9247583e3a7eed2db5bd4dabc680303b1608f37dfdc836d96a704c03283bc05b4f6c5eb8";
390 ok(alg !=
NULL,
"alg not set\n");
412 ok(
len == 0xdeadbeef,
"got %u\n",
len);
418 ok(
len != 0xdeadbeef,
"len not set\n");
433 ret = pBCryptHashData(
hash, (
UCHAR *)
"test",
sizeof(
"test"), 0);
445 ret = pBCryptDestroyHash(
hash);
448 ret = pBCryptCloseAlgorithmProvider(alg, 0);
454 ok(alg !=
NULL,
"alg not set\n");
457 len =
sizeof(buf_hmac);
458 ret = pBCryptCreateHash(alg, &
hash, buf_hmac,
len, (
UCHAR *)
"key",
sizeof(
"key"), 0);
462 ret = pBCryptHashData(
hash, (
UCHAR *)
"test",
sizeof(
"test"), 0);
468 memset(sha384_hmac, 0,
sizeof(sha384_hmac));
469 ret = pBCryptFinishHash(
hash, sha384_hmac,
sizeof(sha384_hmac), 0);
474 ret = pBCryptDestroyHash(
hash);
477 ret = pBCryptCloseAlgorithmProvider(alg, 0);
484 "d55ced17163bf5386f2cd9ff21d6fd7fe576a915065c24744d09cfae4ec84ee1e"
485 "f6ef11bfbc5acce3639bab725b50a1fe2c204f8c820d6d7db0df0ecbc49c5ca";
486 static const char expected_hmac[] =
487 "415fb6b10018ca03b38a1b1399c42ac0be5e8aceddb9a73103f5e543bf2d888f2"
488 "eecf91373941f9315dd730a77937fa92444450fbece86f409d9cb5ec48c6513";
499 ok(alg !=
NULL,
"alg not set\n");
521 ok(
len == 0xdeadbeef,
"got %u\n",
len);
527 ok(
len != 0xdeadbeef,
"len not set\n");
542 ret = pBCryptHashData(
hash, (
UCHAR *)
"test",
sizeof(
"test"), 0);
554 ret = pBCryptDestroyHash(
hash);
557 ret = pBCryptCloseAlgorithmProvider(alg, 0);
563 ok(alg !=
NULL,
"alg not set\n");
566 len =
sizeof(buf_hmac);
567 ret = pBCryptCreateHash(alg, &
hash, buf_hmac,
len, (
UCHAR *)
"key",
sizeof(
"key"), 0);
571 ret = pBCryptHashData(
hash, (
UCHAR *)
"test",
sizeof(
"test"), 0);
577 memset(sha512_hmac, 0,
sizeof(sha512_hmac));
578 ret = pBCryptFinishHash(
hash, sha512_hmac,
sizeof(sha512_hmac), 0);
583 ret = pBCryptDestroyHash(
hash);
586 ret = pBCryptCloseAlgorithmProvider(alg, 0);
594 "e2a3e68d23ce348b8f68b3079de3d4c9";
595 static const char expected_hmac[] =
596 "7bda029b93fa8d817fcc9e13d6bdf092";
599 UCHAR buf[512], buf_hmac[1024],
md5[16], md5_hmac[16];
607 ok(alg !=
NULL,
"alg not set\n");
629 ok(
len == 0xdeadbeef,
"got %u\n",
len);
635 ok(
len != 0xdeadbeef,
"len not set\n");
650 ret = pBCryptHashData(
hash, (
UCHAR *)
"test",
sizeof(
"test"), 0);
662 ret = pBCryptDestroyHash(
hash);
665 ret = pBCryptCloseAlgorithmProvider(alg, 0);
671 ok(alg !=
NULL,
"alg not set\n");
674 len =
sizeof(buf_hmac);
675 ret = pBCryptCreateHash(alg, &
hash, buf_hmac,
len, (
UCHAR *)
"key",
sizeof(
"key"), 0);
679 ret = pBCryptHashData(
hash, (
UCHAR *)
"test",
sizeof(
"test"), 0);
685 memset(md5_hmac, 0,
sizeof(md5_hmac));
686 ret = pBCryptFinishHash(
hash, md5_hmac,
sizeof(md5_hmac), 0);
691 ret = pBCryptDestroyHash(
hash);
694 ret = pBCryptCloseAlgorithmProvider(alg, 0);
701 "e2a3e68d23ce348b8f68b3079de3d4c9";
702 static const char expected_hmac[] =
703 "7bda029b93fa8d817fcc9e13d6bdf092";
712 ok(alg !=
NULL,
"alg not set\n");
723 ret = pBCryptCloseAlgorithmProvider(alg, 0);
727 memset(md5_hmac, 0,
sizeof(md5_hmac));
730 ok(alg !=
NULL,
"alg not set\n");
732 ret = pBCryptHash(alg, (
UCHAR *)
"key",
sizeof(
"key"), (
UCHAR *)
"test",
sizeof(
"test"), md5_hmac,
sizeof(md5_hmac));
737 ret = pBCryptCloseAlgorithmProvider(alg, 0);
751 ok(alg !=
NULL,
"alg not set\n");
760 ret = pBCryptGenRandom(alg,
buf, 8, 0);
764 ret = pBCryptCloseAlgorithmProvider(alg, 0);
802 win_skip(
"BCryptHash is not available\n");
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
static unsigned char bytes[4]
static void test_sha512(void)
static void _test_alg_name(unsigned line, void *handle, const char *exname)
static BCRYPT_HASH_HANDLE PUCHAR
static void test_sha256(void)
static void test_BCryptGenRandom(void)
static void test_BcryptHash(void)
static void test_BCryptGetFipsAlgorithmMode(void)
#define test_alg_name(a, b)
static int strcmp_wa(const WCHAR *strw, const char *stra)
static void test_md5(void)
static void test_sha1(void)
#define test_hash_length(a, b)
static void format_hash(const UCHAR *bytes, ULONG size, char *buf)
static void test_rng(void)
static void _test_hash_length(unsigned line, void *handle, ULONG exlen)
static void test_sha384(void)
#define BCRYPT_OBJECT_LENGTH
#define BCRYPT_SHA512_ALGORITHM
#define BCRYPT_ALGORITHM_NAME
#define BCRYPT_RNG_USE_ENTROPY_IN_BUFFER
#define BCRYPT_SHA256_ALGORITHM
#define BCRYPT_ALG_HANDLE_HMAC_FLAG
#define BCRYPT_RNG_ALGORITHM
#define BCRYPT_HASH_LENGTH
#define MS_PRIMITIVE_PROVIDER
#define BCRYPT_SHA384_ALGORITHM
#define BCRYPT_SHA1_ALGORITHM
#define BCRYPT_MD5_ALGORITHM
#define BCRYPT_USE_SYSTEM_PREFERRED_RNG
#define RegCloseKey(hKey)
#define STATUS_INVALID_HANDLE
#define STATUS_NOT_SUPPORTED
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
static const WCHAR sha384[]
#define GetProcAddress(x, y)
#define MultiByteToWideChar
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
GLuint GLuint GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLenum GLuint GLenum GLsizei const GLchar * buf
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define sprintf(buf, format,...)
static const char * strw(LPCWSTR x)
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_INVALID_PARAMETER
#define HKEY_LOCAL_MACHINE