bcrypt: Return BCryptSignHash len when only output is NULL.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52426
Signed-off-by: Piotr Kleski <piotr.kleski@mobica.com>
Signed-off-by: Michal Janiszewski <michal.janiszewski@mobica.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Kleski 2022-01-20 15:18:45 +01:00 committed by Alexandre Julliard
parent 6a9eaa619c
commit f32a9d1e20
2 changed files with 6 additions and 1 deletions

View file

@ -1707,7 +1707,7 @@ static NTSTATUS key_asymmetric_sign( void *args )
return STATUS_NOT_IMPLEMENTED;
}
if (!params->input)
if (!params->output)
{
*params->ret_len = key->u.a.bitlen / 8;
return STATUS_SUCCESS;

View file

@ -2496,6 +2496,11 @@ static void test_BCryptSignHash(void)
ok(!ret, "got %08x\n", ret);
ok(len == 256, "got %u\n", len);
/* test len return when only output is NULL, as described in BCryptSignHash doc */
ret = BCryptSignHash(key, &pad, hash, sizeof(hash), NULL, 0, &len, BCRYPT_PAD_PKCS1);
ok(!ret, "got %08x\n", ret);
ok(len == 256, "got %u\n", len);
len = 0;
ret = BCryptSignHash(key, &pad, hash, sizeof(hash), sig, sizeof(sig), &len, BCRYPT_PAD_PKCS1);
ok(ret == STATUS_INVALID_PARAMETER || broken(ret == STATUS_INTERNAL_ERROR) /* < win7 */, "got %08x\n", ret);