mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 14:40:56 +00:00
crypt32: Simplify hash value tests.
This commit is contained in:
parent
bb1246a51c
commit
c2f8191a64
@ -781,19 +781,13 @@ static void test_hash_msg_get_param(void)
|
|||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
||||||
if (size == sizeof(buf))
|
if (size == sizeof(buf))
|
||||||
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
||||||
|
/* By getting the hash, further updates are not allowed */
|
||||||
CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
|
SetLastError(0xdeadbeef);
|
||||||
size = 0;
|
ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
todo_wine
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(!ret && GetLastError() == NTE_BAD_HASH_STATE,
|
||||||
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
"Expected NTE_BAD_HASH_STATE, got %x\n", GetLastError());
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
/* The version is also available, and should be zero for this message. */
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
|
||||||
/* The hash doesn't seem to change even after an update, which matches
|
|
||||||
* how rsaenh behaves - an update can't happen after the has is retrieved.
|
|
||||||
*/
|
|
||||||
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
|
||||||
/* So is the version. */
|
|
||||||
size = 0;
|
size = 0;
|
||||||
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, NULL, &size);
|
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, NULL, &size);
|
||||||
todo_wine
|
todo_wine
|
||||||
@ -831,26 +825,6 @@ static void test_hash_msg_get_param(void)
|
|||||||
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
if (size == sizeof(buf))
|
|
||||||
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
|
||||||
/* An empty update has no effect on the hash */
|
|
||||||
CryptMsgUpdate(msg, NULL, 0, FALSE);
|
|
||||||
size = 0;
|
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
|
||||||
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
|
||||||
if (size == sizeof(buf))
|
|
||||||
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
|
||||||
/* A non-empty update doesn't either - see above comments. */
|
|
||||||
CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
|
|
||||||
size = 0;
|
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
|
||||||
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
|
||||||
if (size == sizeof(buf))
|
if (size == sizeof(buf))
|
||||||
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
||||||
CryptMsgClose(msg);
|
CryptMsgClose(msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user