bcrypt: Make BCryptHashData behave more like Windows with empty input.

Signed-off-by: Patrick Armstrong <pat@oldpatricka.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Patrick Armstrong 2016-03-08 20:42:45 -08:00 committed by Alexandre Julliard
parent 154d024f8d
commit ce3921df33
2 changed files with 16 additions and 1 deletions

View File

@ -632,7 +632,7 @@ NTSTATUS WINAPI BCryptHashData( BCRYPT_HASH_HANDLE handle, UCHAR *input, ULONG s
TRACE( "%p, %p, %u, %08x\n", handle, input, size, flags );
if (!hash || hash->hdr.magic != MAGIC_HASH) return STATUS_INVALID_HANDLE;
if (!input) return STATUS_INVALID_PARAMETER;
if (!input) return STATUS_SUCCESS;
return hash_update( hash, input, size );
}

View File

@ -165,6 +165,9 @@ static void test_sha1(void)
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(hash != NULL, "hash not set\n");
ret = BCryptHashData(hash, NULL, 0, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
@ -238,6 +241,9 @@ static void test_sha256(void)
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(hash != NULL, "hash not set\n");
ret = BCryptHashData(hash, NULL, 0, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
@ -311,6 +317,9 @@ static void test_sha384(void)
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(hash != NULL, "hash not set\n");
ret = BCryptHashData(hash, NULL, 0, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
@ -385,6 +394,9 @@ static void test_sha512(void)
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(hash != NULL, "hash not set\n");
ret = BCryptHashData(hash, NULL, 0, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
@ -458,6 +470,9 @@ static void test_md5(void)
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ok(hash != NULL, "hash not set\n");
ret = BCryptHashData(hash, NULL, 0, 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
ret = BCryptHashData(hash, (UCHAR *)"test", sizeof("test"), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);