Kai Blaschke : bcrypt/tests: Show that BCryptGetFipsAlgorithmMode checks a registry key.

Alexandre Julliard julliard at winehq.org
Mon Sep 12 10:14:09 CDT 2016


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

Author: Kai Blaschke <kai.blaschke at kb-dev.net>
Date:   Thu Sep  8 19:24:19 2016 -0300

bcrypt/tests: Show that BCryptGetFipsAlgorithmMode checks a registry key.

Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/bcrypt/tests/Makefile.in |  2 +-
 dlls/bcrypt/tests/bcrypt.c    | 36 +++++++++++++++++++++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/dlls/bcrypt/tests/Makefile.in b/dlls/bcrypt/tests/Makefile.in
index 0f130b1..1bf7d2c 100644
--- a/dlls/bcrypt/tests/Makefile.in
+++ b/dlls/bcrypt/tests/Makefile.in
@@ -1,5 +1,5 @@
 TESTDLL  = bcrypt.dll
-IMPORTS  = bcrypt user32
+IMPORTS  = bcrypt user32 advapi32
 
 C_SRCS = \
 	bcrypt.c
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index 9bd2cea..5cdb065 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -61,11 +61,45 @@ static void test_BCryptGenRandom(void)
 
 static void test_BCryptGetFipsAlgorithmMode(void)
 {
-    NTSTATUS ret;
+    static const WCHAR policyKeyVistaW[] = {
+        'S','y','s','t','e','m','\\',
+        'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
+        'C','o','n','t','r','o','l','\\',
+        'L','s','a','\\',
+        'F','I','P','S','A','l','g','o','r','i','t','h','m','P','o','l','i','c','y',0};
+    static const WCHAR policyValueVistaW[] = {'E','n','a','b','l','e','d',0};
+    static const WCHAR policyKeyXPW[] = {
+        'S','y','s','t','e','m','\\',
+        'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
+        'C','o','n','t','r','o','l','\\',
+        'L','s','a',0};
+    static const WCHAR policyValueXPW[] = {
+        'F','I','P','S','A','l','g','o','r','i','t','h','m','P','o','l','i','c','y',0};
+    BOOLEAN expected;
     BOOLEAN enabled;
+    DWORD value, count[2] = {sizeof(value), sizeof(value)};
+    NTSTATUS ret;
+
+    if (!RegGetValueW(HKEY_LOCAL_MACHINE, policyKeyVistaW, policyValueVistaW,
+        RRF_RT_REG_DWORD, NULL, &value, &count[0]))
+    {
+        expected = !!value;
+    }
+    else if (!RegGetValueW(HKEY_LOCAL_MACHINE, policyKeyXPW, policyValueXPW,
+             RRF_RT_REG_DWORD, NULL, &value, &count[1]))
+    {
+        expected = !!value;
+    }
+    else
+    {
+        expected = FALSE;
+todo_wine
+        ok(0, "Neither XP or Vista key is present\n");
+    }
 
     ret = BCryptGetFipsAlgorithmMode(&enabled);
     ok(ret == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%x\n", ret);
+    ok(enabled == expected, "expected result %d, got %d\n", expected, enabled);
 
     ret = BCryptGetFipsAlgorithmMode(NULL);
     ok(ret == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got 0x%x\n", ret);




More information about the wine-cvs mailing list