bcrypt: Return error when requesting BCRYPT_HASH_LENGTH for unsupported object.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Sebastian Lackner 2017-03-10 15:34:08 +01:00 committed by Alexandre Julliard
parent ced491c65f
commit eecb068ac0
2 changed files with 6 additions and 0 deletions

View File

@ -404,6 +404,8 @@ static NTSTATUS generic_alg_property( enum alg_id id, const WCHAR *prop, UCHAR *
if (!strcmpW( prop, BCRYPT_HASH_LENGTH ))
{
if (!alg_props[id].hash_length)
return STATUS_NOT_SUPPORTED;
*ret_size = sizeof(ULONG);
if (size < sizeof(ULONG))
return STATUS_BUFFER_TOO_SMALL;

View File

@ -763,6 +763,10 @@ static void test_rng(void)
ret = pBCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
len = size = 0xdeadbeef;
ret = pBCryptGetProperty(alg, BCRYPT_HASH_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
test_alg_name(alg, "RNG");
memset(buf, 0, 16);