[PATCH 1/2] dssenh: test when input signLen to CPSignHash is not 40.
Zhang Shuai
wxsxsdz at gmail.com
Sat Nov 23 18:44:06 CST 2019
Signed-off-by: Zhang Shuai <wxsxsdz at gmail.com>
---
dlls/dssenh/tests/dssenh.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/dlls/dssenh/tests/dssenh.c b/dlls/dssenh/tests/dssenh.c
index d16e936a31..f11c854781 100644
--- a/dlls/dssenh/tests/dssenh.c
+++ b/dlls/dssenh/tests/dssenh.c
@@ -901,6 +901,14 @@ static void test_signhash_array(HCRYPTPROV hProv, const struct signature_test *t
ok(result, "Failed to get signature length, got %x\n", GetLastError());
ok(signLen1 == 40, "Expected a 40-byte signature, got %d\n", signLen1);
+ /* Error 0xEA if input signLen is less than 40 (weird) */
+ signLen1 = 39;
+ result = CryptSignHashA(hHash1, AT_SIGNATURE, NULL, 0, signValue1, &signLen1);
+ ok(!result && GetLastError() == 0xEA,
+ "Singing hash with signLen set to 39, expecting error code 0xEA,"
+ "got %x\n", GetLastError());
+
+ signLen1 = 40;
result = CryptSignHashA(hHash1, AT_SIGNATURE, NULL, 0, signValue1, &signLen1);
ok(result, "Failed to sign hash, got %x\n", GetLastError());
@@ -909,6 +917,8 @@ static void test_signhash_array(HCRYPTPROV hProv, const struct signature_test *t
ok(result, "Failed to get signature length, got %x\n", GetLastError());
ok(signLen2 == 40, "Expected a 40-byte signature, got %d\n", signLen2);
+ /* No error if input signLen is not 40 */
+ signLen2 = 41;
result = CryptSignHashA(hHash2, AT_SIGNATURE, NULL, 0, signValue2, &signLen2);
ok(result, "Failed to sign hash2, got %x\n", GetLastError());
--
2.19.1
More information about the wine-devel
mailing list