Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
4961caa8
Commit
4961caa8
authored
Jun 01, 2012
by
Marek Chmiel
Committed by
Alexandre Julliard
Jul 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dssenh: Added CryptAcquireContext test for the DSSENH cryptographic service provider.
parent
0c6ac865
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
194 additions
and
0 deletions
+194
-0
configure
configure
+1
-0
configure.ac
configure.ac
+1
-0
Makefile.in
dlls/dssenh/tests/Makefile.in
+7
-0
dssenh.c
dlls/dssenh/tests/dssenh.c
+185
-0
No files found.
configure
View file @
4961caa8
...
...
@@ -15190,6 +15190,7 @@ wine_fn_config_dll drmclien enable_drmclien
wine_fn_config_dll dsound enable_dsound implib
wine_fn_config_test dlls/dsound/tests dsound_test
wine_fn_config_dll dssenh enable_dssenh
wine_fn_config_test dlls/dssenh/tests dssenh_test
wine_fn_config_dll dswave enable_dswave
wine_fn_config_dll dwmapi enable_dwmapi implib
wine_fn_config_dll dxdiagn enable_dxdiagn po
...
...
configure.ac
View file @
4961caa8
...
...
@@ -2606,6 +2606,7 @@ WINE_CONFIG_DLL(drmclien)
WINE_CONFIG_DLL(dsound,,[implib])
WINE_CONFIG_TEST(dlls/dsound/tests)
WINE_CONFIG_DLL(dssenh)
WINE_CONFIG_TEST(dlls/dssenh/tests)
WINE_CONFIG_DLL(dswave)
WINE_CONFIG_DLL(dwmapi,,[implib])
WINE_CONFIG_DLL(dxdiagn,,[po])
...
...
dlls/dssenh/tests/Makefile.in
0 → 100644
View file @
4961caa8
TESTDLL
=
dssenh.dll
IMPORTS
=
advapi32
C_SRCS
=
\
dssenh.c
@MAKE_TEST_RULES@
dlls/dssenh/tests/dssenh.c
0 → 100644
View file @
4961caa8
/*
* Unit tests for dss functions
*
* Copyright (c) 2012 Marek Kamil Chmiel
*
* 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 <string.h>
#include <stdio.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wincrypt.h"
static
void
test_acquire_context
(
void
)
{
/* failure tests common between all four CSP providers */
HCRYPTPROV
hProv
=
0
;
BOOL
result
;
/* cannot acquire provider with 0 as Prov Type and NULL as CSP name */
SetLastError
(
0xdeadbeef
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
NULL
,
0
,
0
);
ok
(
!
result
&&
GetLastError
()
==
NTE_BAD_PROV_TYPE
,
"Expected NTE_BAD_PROV_TYPE, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
NULL
,
0
,
CRYPT_VERIFYCONTEXT
);
ok
(
!
result
&&
GetLastError
()
==
NTE_BAD_PROV_TYPE
,
"Expected NTE_BAD_PROV_TYPE, got %08x
\n
"
,
GetLastError
());
/* flag allows us to delete a keyset, but not of an unknown provider */
SetLastError
(
0xdeadbeef
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
NULL
,
0
,
CRYPT_DELETEKEYSET
);
ok
(
!
result
&&
GetLastError
()
==
NTE_BAD_PROV_TYPE
,
"Expected NTE_BAD_PROV_TYPE, got %08x
\n
"
,
GetLastError
());
/* cannot acquire along with PROV_RSA_SIG, not compatible */
SetLastError
(
0xdeadbeef
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_DEF_DSS_PROV_A
,
PROV_RSA_SIG
,
0
);
todo_wine
ok
(
!
result
&&
GetLastError
()
==
NTE_PROV_TYPE_NO_MATCH
,
"Expected NTE_PROV_TYPE_NO_MATCH, got %08x
\n
"
,
GetLastError
());
/* cannot acquire along with MS_DEF_RSA_SIG_PROV, not compatible */
SetLastError
(
0xdeadbeef
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_DEF_RSA_SIG_PROV
,
PROV_DSS
,
0
);
ok
(
!
result
&&
GetLastError
()
==
NTE_KEYSET_NOT_DEF
,
"Expected NTE_KEYSET_NOT_DEF, got %08x
\n
"
,
GetLastError
());
/* cannot acquire provider with 0 as Prov Type */
SetLastError
(
0xdeadbeef
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_DEF_DSS_PROV_A
,
0
,
0
);
ok
(
!
result
&&
GetLastError
()
==
NTE_BAD_PROV_TYPE
,
"Expected NTE_BAD_PROV_TYPE, got %08x
\n
"
,
GetLastError
());
/* test base DSS provider (PROV_DSS) */
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_DEF_DSS_PROV_A
,
PROV_DSS
,
CRYPT_VERIFYCONTEXT
);
if
(
!
result
)
{
skip
(
"DSS csp is currently not available, skipping tests."
);
return
;
}
ok
(
result
,
"Expected no errors.
\n
"
);
result
=
CryptReleaseContext
(
hProv
,
0
);
ok
(
result
,
"Expected release of the provider.
\n
"
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_DEF_DSS_DH_PROV_A
,
PROV_DSS_DH
,
CRYPT_NEWKEYSET
);
ok
(
result
,
"Expected no errors.
\n
"
);
result
=
CryptReleaseContext
(
hProv
,
0
);
ok
(
result
,
"Expected release of the provider.
\n
"
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
NULL
,
PROV_DSS
,
0
);
ok
(
result
,
"Expected no errors.
\n
"
);
result
=
CryptReleaseContext
(
hProv
,
0
);
ok
(
result
,
"Expected release of the provider.
\n
"
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_DEF_DSS_PROV_A
,
PROV_DSS
,
0
);
ok
(
result
,
"Expected no errors.
\n
"
);
/* test DSS Diffie Hellman provider (PROV_DSS_DH) */
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_DEF_DSS_DH_PROV
,
PROV_DSS_DH
,
CRYPT_VERIFYCONTEXT
);
ok
(
result
,
"Expected no errors.
\n
"
);
result
=
CryptReleaseContext
(
hProv
,
0
);
ok
(
result
,
"Expected release of the provider.
\n
"
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
NULL
,
PROV_DSS_DH
,
0
);
ok
(
result
,
"Expected no errors.
\n
"
);
result
=
CryptReleaseContext
(
hProv
,
0
);
ok
(
result
,
"Expected release of the provider.
\n
"
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_DEF_DSS_DH_PROV
,
PROV_DSS_DH
,
0
);
ok
(
result
,
"Expected no errors.
\n
"
);
/* test DSS Enhanced provider (MS_ENH_DSS_DH_PROV) */
SetLastError
(
0xdeadbeef
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_ENH_DSS_DH_PROV
,
PROV_DSS_DH
,
CRYPT_VERIFYCONTEXT
);
if
(
!
result
&&
GetLastError
()
==
NTE_KEYSET_NOT_DEF
)
{
win_skip
(
"DSSENH and Schannel provider is broken on WinNT4
\n
"
);
return
;
}
ok
(
result
,
"Expected no errors.
\n
"
);
result
=
CryptReleaseContext
(
hProv
,
0
);
ok
(
result
,
"Expected release of the provider.
\n
"
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_ENH_DSS_DH_PROV
,
PROV_DSS_DH
,
0
);
ok
(
result
,
"Expected no errors.
\n
"
);
result
=
CryptReleaseContext
(
hProv
,
0
);
ok
(
result
,
"Expected release of the provider.
\n
"
);
/* test DSS Schannel provider (PROV_DH_SCHANNEL) */
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_DEF_DH_SCHANNEL_PROV
,
PROV_DH_SCHANNEL
,
CRYPT_VERIFYCONTEXT
);
ok
(
result
,
"Expected no errors.
\n
"
);
result
=
CryptReleaseContext
(
hProv
,
0
);
ok
(
result
,
"Expected release of the provider.
\n
"
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
NULL
,
PROV_DH_SCHANNEL
,
0
);
ok
(
result
,
"Expected no errors.
\n
"
);
result
=
CryptReleaseContext
(
hProv
,
0
);
ok
(
result
,
"Expected release of the provider.
\n
"
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_DEF_DH_SCHANNEL_PROV
,
PROV_DH_SCHANNEL
,
0
);
ok
(
result
,
"Expected no errors.
\n
"
);
result
=
CryptReleaseContext
(
hProv
,
0
);
ok
(
result
,
"Expected release of the provider.
\n
"
);
/* failure tests, cannot acquire context because the key container already exists */
SetLastError
(
0xdeadbeef
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_DEF_DSS_DH_PROV
,
PROV_DSS_DH
,
CRYPT_NEWKEYSET
);
ok
(
!
result
&&
GetLastError
()
==
NTE_EXISTS
,
"Expected NTE_EXISTS, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_ENH_DSS_DH_PROV
,
PROV_DSS_DH
,
CRYPT_NEWKEYSET
);
ok
(
!
result
&&
GetLastError
()
==
NTE_EXISTS
,
"Expected NTE_EXISTS, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
result
=
CryptAcquireContextA
(
&
hProv
,
NULL
,
MS_DEF_DH_SCHANNEL_PROV
,
PROV_DH_SCHANNEL
,
CRYPT_NEWKEYSET
);
ok
(
!
result
&&
GetLastError
()
==
NTE_EXISTS
,
"Expected NTE_EXISTS, got %08x
\n
"
,
GetLastError
());
}
START_TEST
(
dssenh
)
{
test_acquire_context
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment