Sebastian Lackner : bcrypt: Return error when requesting BCRYPT_HASH_LENGTH for unsupported object.

Alexandre Julliard julliard at winehq.org
Fri Mar 10 16:51:45 CST 2017


Module: wine
Branch: master
Commit: eecb068ac0a9f6e380c521b69a27ea43840a35dd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=eecb068ac0a9f6e380c521b69a27ea43840a35dd

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Fri Mar 10 15:34:08 2017 +0100

bcrypt: Return error when requesting BCRYPT_HASH_LENGTH for unsupported object.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/bcrypt/bcrypt_main.c  | 2 ++
 dlls/bcrypt/tests/bcrypt.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index ae64627..561b459 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -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;
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index 422f2cf..864c2c8 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -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);




More information about the wine-cvs mailing list