Commit eecb068a authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

bcrypt: Return error when requesting BCRYPT_HASH_LENGTH for unsupported object.

parent ced491c6
...@@ -404,6 +404,8 @@ static NTSTATUS generic_alg_property( enum alg_id id, const WCHAR *prop, UCHAR * ...@@ -404,6 +404,8 @@ static NTSTATUS generic_alg_property( enum alg_id id, const WCHAR *prop, UCHAR *
if (!strcmpW( prop, BCRYPT_HASH_LENGTH )) if (!strcmpW( prop, BCRYPT_HASH_LENGTH ))
{ {
if (!alg_props[id].hash_length)
return STATUS_NOT_SUPPORTED;
*ret_size = sizeof(ULONG); *ret_size = sizeof(ULONG);
if (size < sizeof(ULONG)) if (size < sizeof(ULONG))
return STATUS_BUFFER_TOO_SMALL; return STATUS_BUFFER_TOO_SMALL;
......
...@@ -763,6 +763,10 @@ static void test_rng(void) ...@@ -763,6 +763,10 @@ static void test_rng(void)
ret = pBCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0); ret = pBCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret); 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"); test_alg_name(alg, "RNG");
memset(buf, 0, 16); memset(buf, 0, 16);
......
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