[PATCH 5/5] bcrypt: Implement BCryptGetProperty for BCRYPT_AUTH_TAG_LENGTH.

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Sun Mar 18 22:48:01 CDT 2018


From: Michael Müller <michael at fds-team.de>

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/bcrypt/bcrypt_main.c  | 14 ++++++++++++++
 dlls/bcrypt/tests/bcrypt.c | 16 ++++++++--------
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index 55901f9..fa80318 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -566,6 +566,20 @@ static NTSTATUS get_alg_property( const struct algorithm *alg, const WCHAR *prop
             }
             return STATUS_SUCCESS;
         }
+        if (!strcmpW( prop, BCRYPT_AUTH_TAG_LENGTH ))
+        {
+            BCRYPT_AUTH_TAG_LENGTHS_STRUCT *tag_length = (void *)buf;
+            if (alg->mode != MODE_ID_GCM) return STATUS_NOT_SUPPORTED;
+            *ret_size = sizeof(*tag_length);
+            if (tag_length && size < *ret_size) return STATUS_BUFFER_TOO_SMALL;
+            if (tag_length)
+            {
+                tag_length->dwMinLength = 12;
+                tag_length->dwMaxLength = 16;
+                tag_length->dwIncrement =  1;
+            }
+            return STATUS_SUCCESS;
+        }
         break;
 
     default:
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index b8eaf22..fbfb6d3 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -709,24 +709,24 @@ static void test_BCryptEncrypt(void)
 
     size = 0;
     ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, NULL, 0, &size, 0);
-    todo_wine ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
+    ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
 
     ret = BCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM), 0);
     ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
 
     size = 0;
     ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, NULL, 0, &size, 0);
-    todo_wine ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
-    todo_wine ok(size == sizeof(tag_length), "got %u\n", size);
+    ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+    ok(size == sizeof(tag_length), "got %u\n", size);
 
     size = 0;
     memset(&tag_length, 0, sizeof(tag_length));
     ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, (UCHAR*)&tag_length, sizeof(tag_length), &size, 0);
-    todo_wine ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
-    todo_wine ok(size == sizeof(tag_length), "got %u\n", size);
-    todo_wine ok(tag_length.dwMinLength == 12, "Expected 12, got %d\n", tag_length.dwMinLength);
-    todo_wine ok(tag_length.dwMaxLength == 16, "Expected 16, got %d\n", tag_length.dwMaxLength);
-    todo_wine ok(tag_length.dwIncrement == 1, "Expected 1, got %d\n", tag_length.dwIncrement);
+    ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
+    ok(size == sizeof(tag_length), "got %u\n", size);
+    ok(tag_length.dwMinLength == 12, "Expected 12, got %d\n", tag_length.dwMinLength);
+    ok(tag_length.dwMaxLength == 16, "Expected 16, got %d\n", tag_length.dwMaxLength);
+    ok(tag_length.dwIncrement == 1, "Expected 1, got %d\n", tag_length.dwIncrement);
 
     len = 0xdeadbeef;
     size = sizeof(len);
-- 
1.9.1



More information about the wine-devel mailing list