Commit 6f455e10 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

bcrypt: Return correct error from key_asymmetric_encrypt() if key is missing.

parent a7efc770
......@@ -2205,6 +2205,8 @@ static NTSTATUS key_asymmetric_encrypt( void *args )
NTSTATUS status = STATUS_SUCCESS;
int ret;
if (!key_data(params->key)->a.pubkey) return STATUS_INVALID_HANDLE;
d.data = params->input;
d.size = params->input_len;
if ((ret = pgnutls_pubkey_encrypt_data(key_data(params->key)->a.pubkey, 0, &d, &e)))
......
......@@ -2284,12 +2284,12 @@ static void test_rsa_encrypt(void)
ret = BCryptGenerateKeyPair(rsa, &key, 512, 0);
ok(ret == STATUS_SUCCESS, "got %lx\n", ret);
todo_wine {
/* Not finalized key */
ret = BCryptEncrypt(key, input, sizeof(input), NULL, NULL, 0, NULL, 0, &encrypted_size, 0);
ok(ret == STATUS_INVALID_HANDLE, "got %lx\n", ret);
BCryptFinalizeKeyPair(key, 0);
todo_wine {
/* No padding */
memset(input_no_padding, 0, sizeof(input_no_padding));
strcpy((char *)input_no_padding, "Hello World");
......
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