Commit 5c1b0e5d authored by Santino Mazza's avatar Santino Mazza Committed by Alexandre Julliard

bcrypt: Move symmetric flags check to symmetric section.

parent a0eaae85
......@@ -1928,34 +1928,43 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
ULONG iv_len, UCHAR *output, ULONG output_len, ULONG *ret_len, ULONG flags )
{
struct key_asymmetric_decrypt_params params;
NTSTATUS ret;
struct key *key = handle;
TRACE( "%p, %p, %lu, %p, %p, %lu, %p, %lu, %p, %#lx\n", handle, input, input_len, padding, iv, iv_len, output,
output_len, ret_len, flags );
if (!key || key->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
if (flags & ~BCRYPT_BLOCK_PADDING)
{
FIXME( "flags %#lx not supported\n", flags );
return STATUS_NOT_IMPLEMENTED;
}
if (key_is_symmetric( key ))
{
NTSTATUS ret;
if (flags & ~BCRYPT_BLOCK_PADDING)
{
FIXME( "flags %#lx not supported\n", flags );
return STATUS_NOT_IMPLEMENTED;
}
EnterCriticalSection( &key->u.s.cs );
ret = key_symmetric_decrypt( key, input, input_len, padding, iv, iv_len, output, output_len, ret_len, flags );
LeaveCriticalSection( &key->u.s.cs );
return ret;
}
else
{
if (flags & BCRYPT_PAD_NONE || flags & BCRYPT_PAD_OAEP)
{
FIXME( "flags %#lx not implemented\n", flags );
return STATUS_NOT_IMPLEMENTED;
}
params.key = key;
params.input = input;
params.input_len = input_len;
params.output = output;
params.output_len = output_len;
params.ret_len = ret_len;
ret = UNIX_CALL(key_asymmetric_decrypt, &params);
}
params.key = key;
params.input = input;
params.input_len = input_len;
params.output = output;
params.output_len = output_len;
params.ret_len = ret_len;
return UNIX_CALL( key_asymmetric_decrypt, &params );
return ret;
}
NTSTATUS WINAPI BCryptSetProperty( BCRYPT_HANDLE handle, const WCHAR *prop, UCHAR *value, ULONG size, ULONG flags )
......
......@@ -2258,13 +2258,14 @@ static void test_rsa_encrypt(void)
ok(ret == STATUS_SUCCESS, "got %lx\n", ret);
ok(memcmp(encrypted_a, encrypted_b, encrypted_size), "Both outputs are the same\n");
todo_wine {
BCryptDecrypt(key, encrypted_a, encrypted_size, NULL, NULL, 0, NULL, 0, &decrypted_size, BCRYPT_PAD_PKCS1);
ok(decrypted_size == sizeof(input), "got size of %ld\n", decrypted_size);
decrypted = malloc(decrypted_size);
BCryptDecrypt(key, encrypted_a, encrypted_size, NULL, NULL, 0, decrypted, decrypted_size, &decrypted_size, BCRYPT_PAD_PKCS1);
ok(!memcmp(decrypted, input, sizeof(input)), "Decrypted output it's not what expected\n");
free(decrypted);
todo_wine {
encrypted_size = 60;
/* OAEP Padding */
ret = BCryptEncrypt(key, input, sizeof(input), &oaep_pad, NULL, 0, NULL, 0, &encrypted_size, BCRYPT_PAD_OAEP);
......
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