[PATCH] bcrypt: Added stub implementation for BCryptGetFipsAlgorithmMode

Kai Blaschke kai.blaschke at kb-dev.net
Wed Jan 22 14:48:24 CST 2014


Fixes Wine bug 32194, also added a conformance test.

---
  configure                     |  3 ++-
  configure.ac                  |  3 ++-
  dlls/bcrypt/Makefile.in       |  1 +
  dlls/bcrypt/bcrypt.spec       |  2 +-
  dlls/bcrypt/bcrypt_main.c     | 11 +++++++++++
  dlls/bcrypt/tests/Makefile.in |  5 +++++
  dlls/bcrypt/tests/bcrypt.c    | 35 +++++++++++++++++++++++++++++++++++
  include/bcrypt.h              |  4 ++++
  8 files changed, 61 insertions(+), 3 deletions(-)

-------------- next part --------------
>From 22a3ebafa86fa3aefb518d5177531a2a808fe154 Mon Sep 17 00:00:00 2001
From: Kai Blaschke <kai.blaschke at kb-dev.net>
Date: Wed, 22 Jan 2014 21:11:16 +0100
Subject: Added stub for BCryptGetFipsAlgorithmMode plus conformance test

---
 configure                     |  3 ++-
 configure.ac                  |  3 ++-
 dlls/bcrypt/Makefile.in       |  1 +
 dlls/bcrypt/bcrypt.spec       |  2 +-
 dlls/bcrypt/bcrypt_main.c     | 11 +++++++++++
 dlls/bcrypt/tests/Makefile.in |  5 +++++
 dlls/bcrypt/tests/bcrypt.c    | 35 +++++++++++++++++++++++++++++++++++
 include/bcrypt.h              |  4 ++++
 8 files changed, 61 insertions(+), 3 deletions(-)
 create mode 100644 dlls/bcrypt/tests/Makefile.in
 create mode 100644 dlls/bcrypt/tests/bcrypt.c

diff --git a/configure b/configure
index c2d0dd0..b72cb0f 100755
--- a/configure
+++ b/configure
@@ -16547,7 +16547,8 @@ wine_fn_config_dll avifil32 enable_avifil32 clean,implib,po
 wine_fn_config_test dlls/avifil32/tests avifil32_test
 wine_fn_config_dll avifile.dll16 enable_win16
 wine_fn_config_dll avrt enable_avrt implib
-wine_fn_config_dll bcrypt enable_bcrypt
+wine_fn_config_dll bcrypt enable_bcrypt implib
+wine_fn_config_test dlls/bcrypt/tests bcrypt_test
 wine_fn_config_dll browseui enable_browseui clean,po
 wine_fn_config_test dlls/browseui/tests browseui_test
 wine_fn_config_dll cabinet enable_cabinet implib
diff --git a/configure.ac b/configure.ac
index 4f51909..ca67a30 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2671,7 +2671,8 @@ WINE_CONFIG_DLL(avifil32,,[clean,implib,po])
 WINE_CONFIG_TEST(dlls/avifil32/tests)
 WINE_CONFIG_DLL(avifile.dll16,enable_win16)
 WINE_CONFIG_DLL(avrt,,[implib])
-WINE_CONFIG_DLL(bcrypt)
+WINE_CONFIG_DLL(bcrypt,,[implib])
+WINE_CONFIG_TEST(dlls/bcrypt/tests)
 WINE_CONFIG_DLL(browseui,,[clean,po])
 WINE_CONFIG_TEST(dlls/browseui/tests)
 WINE_CONFIG_DLL(cabinet,,[implib])
diff --git a/dlls/bcrypt/Makefile.in b/dlls/bcrypt/Makefile.in
index f9aacec..954d93c 100644
--- a/dlls/bcrypt/Makefile.in
+++ b/dlls/bcrypt/Makefile.in
@@ -1,4 +1,5 @@
 MODULE    = bcrypt.dll
+IMPORTLIB = bcrypt
 
 C_SRCS = \
 	bcrypt_main.c
diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec
index e1ffb8a..f41e840 100644
--- a/dlls/bcrypt/bcrypt.spec
+++ b/dlls/bcrypt/bcrypt.spec
@@ -27,7 +27,7 @@
 @ stub BCryptGenRandom
 @ stub BCryptGenerateKeyPair
 @ stub BCryptGenerateSymmetricKey
-@ stub BCryptGetFipsAlgorithmMode
+@ stdcall BCryptGetFipsAlgorithmMode(ptr)
 @ stub BCryptGetProperty
 @ stub BCryptHashData
 @ stub BCryptImportKey
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index 441b3ef..81e8a47 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -19,6 +19,8 @@
 
 #include "config.h"
 #include "wine/port.h"
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
 #include "wine/debug.h"
 
 #include "winbase.h"
@@ -50,3 +52,12 @@ NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG dwAlgOperations, ULONG *pAlgCount,
 
     return ERROR_CALL_NOT_IMPLEMENTED;
 }
+
+NTSTATUS WINAPI BCryptGetFipsAlgorithmMode(BOOLEAN *pfEnabled)
+{
+    FIXME("%p - stub\n", pfEnabled);
+    
+    *pfEnabled=FALSE;
+    
+    return STATUS_SUCCESS;
+}
diff --git a/dlls/bcrypt/tests/Makefile.in b/dlls/bcrypt/tests/Makefile.in
new file mode 100644
index 0000000..363986e
--- /dev/null
+++ b/dlls/bcrypt/tests/Makefile.in
@@ -0,0 +1,5 @@
+TESTDLL   = bcrypt.dll
+IMPORTS   = user32 gdi32 bcrypt
+
+C_SRCS = \
+	bcrypt.c
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
new file mode 100644
index 0000000..c3e5515
--- /dev/null
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2013 Kai Blaschke
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <windows.h>
+
+#include "bcrypt.h"
+#include "wine/test.h"
+
+static void test_getFipsAlgorithmMode(void)
+{
+    BOOLEAN result = TRUE;
+    NTSTATUS status = BCryptGetFipsAlgorithmMode(&result);
+    ok(!status, "expected status STATUS_SUCCESS(0), got %d\n", status);
+    ok(!result, "expected result FALSE, got %d\n", result);
+}
+
+START_TEST(bcrypt)
+{
+    test_getFipsAlgorithmMode();
+}
diff --git a/include/bcrypt.h b/include/bcrypt.h
index 43d1f94..b7464c8 100644
--- a/include/bcrypt.h
+++ b/include/bcrypt.h
@@ -47,4 +47,8 @@ typedef struct _BCRYPT_ALGORITHM_IDENTIFIER
     ULONG  dwFlags;
 } BCRYPT_ALGORITHM_IDENTIFIER;
 
+NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG dwAlgOperations, ULONG *pAlgCount,
+                                     BCRYPT_ALGORITHM_IDENTIFIER **ppAlgList, ULONG dwFlags);
+NTSTATUS WINAPI BCryptGetFipsAlgorithmMode(BOOLEAN *pfEnabled);
+
 #endif  /* __WINE_BCRYPT_H */
-- 
1.8.3.2



More information about the wine-patches mailing list