dssenh: Only fill hash buffer when it's provided.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30244
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 9b19a110ea)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Rémi Bernon 2021-05-25 17:37:12 +02:00 committed by Michael Stefaniuc
parent e83cd0e70f
commit f9bca7ed42
2 changed files with 8 additions and 1 deletions

View File

@ -942,7 +942,7 @@ BOOL WINAPI CPGetHashParam( HCRYPTPROV hprov, HCRYPTHASH hhash, DWORD param, BYT
SetLastError( ERROR_MORE_DATA );
return FALSE;
}
memcpy( data, hash->value, hash->len );
if (data) memcpy( data, hash->value, hash->len );
*len = hash->len;
return TRUE;

View File

@ -472,9 +472,16 @@ static void test_hash(const struct hash_test *tests, int testLen)
ok(result && (hashLen == tests[i].hashLen), "Expected %d hash len, got %d.Error: %x\n",
tests[i].hashLen, hashLen, GetLastError());
dataLen = 0xdeadbeef;
result = CryptGetHashParam(hHash, HP_HASHVAL, 0, &dataLen, 0);
ok(result, "Expected hash value return.\n");
ok(dataLen == hashLen, "Expected hash length to match.\n");
hashLen = 0xdeadbeef;
result = CryptGetHashParam(hHash, HP_HASHVAL, hashValue, &hashLen, 0);
ok(result, "Expected hash value return.\n");
ok(dataLen == hashLen, "Expected hash length to match.\n");
ok(!memcmp(hashValue, tests[i].hash, tests[i].hashLen), "Incorrect hash output.\n");
result = CryptHashData(hHash, data, dataLen, 0);