Commit f32a9d1e authored by Piotr Kleski's avatar Piotr Kleski Committed by Alexandre Julliard

bcrypt: Return BCryptSignHash len when only output is NULL.

parent 6a9eaa61
...@@ -1707,7 +1707,7 @@ static NTSTATUS key_asymmetric_sign( void *args ) ...@@ -1707,7 +1707,7 @@ static NTSTATUS key_asymmetric_sign( void *args )
return STATUS_NOT_IMPLEMENTED; return STATUS_NOT_IMPLEMENTED;
} }
if (!params->input) if (!params->output)
{ {
*params->ret_len = key->u.a.bitlen / 8; *params->ret_len = key->u.a.bitlen / 8;
return STATUS_SUCCESS; return STATUS_SUCCESS;
......
...@@ -2496,6 +2496,11 @@ static void test_BCryptSignHash(void) ...@@ -2496,6 +2496,11 @@ static void test_BCryptSignHash(void)
ok(!ret, "got %08x\n", ret); ok(!ret, "got %08x\n", ret);
ok(len == 256, "got %u\n", len); 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; len = 0;
ret = BCryptSignHash(key, &pad, hash, sizeof(hash), sig, sizeof(sig), &len, BCRYPT_PAD_PKCS1); 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); ok(ret == STATUS_INVALID_PARAMETER || broken(ret == STATUS_INTERNAL_ERROR) /* < win7 */, "got %08x\n", ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment