[PATCH 2/2] bcrypt/tests: Added conformance test for BCryptGetFipsAlgorithmMode

Kai Blaschke kai.blaschke at kb-dev.net
Thu Jan 23 17:41:02 CST 2014


---
  configure                     |  1 +
  configure.ac                  |  1 +
  dlls/bcrypt/tests/Makefile.in |  4 +++
  dlls/bcrypt/tests/bcrypt.c    | 59 
+++++++++++++++++++++++++++++++++++++++++++
  4 files changed, 65 insertions(+)

-------------- next part --------------
>From bfac2adcf110b69496a16fd4811ceb7175b8e1df Mon Sep 17 00:00:00 2001
From: Kai Blaschke <kai.blaschke at kb-dev.net>
Date: Fri, 24 Jan 2014 00:37:46 +0100
Subject: bcrypt/tests: Added conformance test for BCryptGetFipsAlgorithmMode

---
 configure                     |  1 +
 configure.ac                  |  1 +
 dlls/bcrypt/tests/Makefile.in |  4 +++
 dlls/bcrypt/tests/bcrypt.c    | 59 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 65 insertions(+)
 create mode 100644 dlls/bcrypt/tests/Makefile.in
 create mode 100644 dlls/bcrypt/tests/bcrypt.c

diff --git a/configure b/configure
index c2d0dd0..6363f85 100755
--- a/configure
+++ b/configure
@@ -16548,6 +16548,7 @@ 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_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..b370b19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2672,6 +2672,7 @@ WINE_CONFIG_TEST(dlls/avifil32/tests)
 WINE_CONFIG_DLL(avifile.dll16,enable_win16)
 WINE_CONFIG_DLL(avrt,,[implib])
 WINE_CONFIG_DLL(bcrypt)
+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/tests/Makefile.in b/dlls/bcrypt/tests/Makefile.in
new file mode 100644
index 0000000..ee845a1
--- /dev/null
+++ b/dlls/bcrypt/tests/Makefile.in
@@ -0,0 +1,4 @@
+TESTDLL   = bcrypt.dll
+
+C_SRCS = \
+	bcrypt.c
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
new file mode 100644
index 0000000..834377b
--- /dev/null
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2014 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 <stdio.h>
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "wine/test.h"
+#include "windef.h"
+#include "winbase.h"
+#include "winternl.h"
+
+static NTSTATUS (WINAPI * pBCryptGetFipsAlgorithmMode) (BOOLEAN *);
+
+static void InitFunctionPtrs(void)
+{
+    HMODULE hBCrypt = LoadLibraryA("bcrypt.dll");
+    pBCryptGetFipsAlgorithmMode = (void*)GetProcAddress(hBCrypt, "BCryptGetFipsAlgorithmMode");
+}
+
+static void test_getFipsAlgorithmMode(void)
+{
+    BOOLEAN result;
+    NTSTATUS status;
+
+    if (!pBCryptGetFipsAlgorithmMode)
+    {
+        win_skip("Can't perform BCryptGetFipsAlgorithmMode tests\n");
+        return;
+    }
+
+    status = pBCryptGetFipsAlgorithmMode(&result);
+    ok(!status, "expected status STATUS_SUCCESS(0), got 0x%08X\n", status);
+    ok(!result, "expected result FALSE, got %d\n", result);
+
+    status = pBCryptGetFipsAlgorithmMode(NULL);
+    ok(status == STATUS_INVALID_PARAMETER,
+       "expected status STATUS_INVALID_PARAMETER(0xC000000D), got 0x%08X\n", status);
+}
+
+START_TEST(bcrypt)
+{
+    InitFunctionPtrs();
+    test_getFipsAlgorithmMode();
+}
-- 
1.8.3.2



More information about the wine-patches mailing list