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
248d27ea
Commit
248d27ea
authored
Oct 19, 2020
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dssenh: Implement CPGetUserKey.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
320b9eb4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
1 deletion
+75
-1
dssenh.spec
dlls/dssenh/dssenh.spec
+1
-1
main.c
dlls/dssenh/main.c
+29
-0
dssenh.c
dlls/dssenh/tests/dssenh.c
+45
-0
No files found.
dlls/dssenh/dssenh.spec
View file @
248d27ea
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
@ stdcall CPGetHashParam(ptr ptr long ptr ptr long)
@ stdcall CPGetHashParam(ptr ptr long ptr ptr long)
@ stub CPGetKeyParam
@ stub CPGetKeyParam
@ stdcall CPGetProvParam(ptr long ptr ptr long)
@ stdcall CPGetProvParam(ptr long ptr ptr long)
@ st
ub CPGetUserKey
@ st
dcall CPGetUserKey(ptr long ptr)
@ stdcall CPHashData(ptr ptr ptr long long)
@ stdcall CPHashData(ptr ptr ptr long long)
@ stub CPHashSessionKey
@ stub CPHashSessionKey
@ stdcall CPImportKey(ptr ptr long ptr long ptr)
@ stdcall CPImportKey(ptr ptr long ptr long ptr)
...
...
dlls/dssenh/main.c
View file @
248d27ea
...
@@ -615,6 +615,35 @@ BOOL WINAPI CPDuplicateKey( HCRYPTPROV hprov, HCRYPTKEY hkey, DWORD *reserved, D
...
@@ -615,6 +615,35 @@ BOOL WINAPI CPDuplicateKey( HCRYPTPROV hprov, HCRYPTKEY hkey, DWORD *reserved, D
return
TRUE
;
return
TRUE
;
}
}
BOOL
WINAPI
CPGetUserKey
(
HCRYPTPROV
hprov
,
DWORD
keyspec
,
HCRYPTKEY
*
ret_key
)
{
struct
container
*
container
=
(
struct
container
*
)
hprov
;
BOOL
ret
=
FALSE
;
TRACE
(
"%p, %08x, %p
\n
"
,
(
void
*
)
hprov
,
keyspec
,
ret_key
);
if
(
container
->
magic
!=
MAGIC_CONTAINER
)
return
FALSE
;
switch
(
keyspec
)
{
case
AT_KEYEXCHANGE
:
if
(
!
container
->
exch_key
)
SetLastError
(
NTE_NO_KEY
);
else
if
((
*
ret_key
=
(
HCRYPTKEY
)
duplicate_key
(
container
->
exch_key
)))
ret
=
TRUE
;
break
;
case
AT_SIGNATURE
:
if
(
!
container
->
sign_key
)
SetLastError
(
NTE_NO_KEY
);
else
if
((
*
ret_key
=
(
HCRYPTKEY
)
duplicate_key
(
container
->
sign_key
)))
ret
=
TRUE
;
break
;
default:
SetLastError
(
NTE_NO_KEY
);
return
FALSE
;
}
return
ret
;
}
BOOL
WINAPI
CPGenRandom
(
HCRYPTPROV
hprov
,
DWORD
len
,
BYTE
*
buffer
)
BOOL
WINAPI
CPGenRandom
(
HCRYPTPROV
hprov
,
DWORD
len
,
BYTE
*
buffer
)
{
{
struct
container
*
container
=
(
struct
container
*
)
hprov
;
struct
container
*
container
=
(
struct
container
*
)
hprov
;
...
...
dlls/dssenh/tests/dssenh.c
View file @
248d27ea
...
@@ -1470,6 +1470,50 @@ static void test_duplicate_hash(void)
...
@@ -1470,6 +1470,50 @@ static void test_duplicate_hash(void)
ok
(
result
,
"got %08x
\n
"
,
GetLastError
());
ok
(
result
,
"got %08x
\n
"
,
GetLastError
());
}
}
static
void
test_userkey
(
void
)
{
HCRYPTPROV
hprov
;
HCRYPTKEY
hkey
;
BOOL
result
;
CryptAcquireContextA
(
&
hprov
,
"winetest"
,
MS_ENH_DSS_DH_PROV_A
,
PROV_DSS_DH
,
CRYPT_DELETEKEYSET
);
result
=
CryptAcquireContextA
(
&
hprov
,
"winetest"
,
MS_ENH_DSS_DH_PROV_A
,
PROV_DSS_DH
,
CRYPT_NEWKEYSET
);
ok
(
result
,
"got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
result
=
CryptGetUserKey
(
hprov
,
AT_KEYEXCHANGE
,
&
hkey
);
ok
(
!
result
,
"success
\n
"
);
ok
(
GetLastError
()
==
NTE_NO_KEY
,
"got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
result
=
CryptGetUserKey
(
hprov
,
AT_SIGNATURE
,
&
hkey
);
ok
(
!
result
,
"success
\n
"
);
ok
(
GetLastError
()
==
NTE_NO_KEY
,
"got %08x
\n
"
,
GetLastError
());
result
=
CryptGenKey
(
hprov
,
AT_SIGNATURE
,
1024
<<
16
,
&
hkey
);
ok
(
result
,
"got %08x
\n
"
,
GetLastError
());
result
=
CryptDestroyKey
(
hkey
);
ok
(
result
,
"got %08x
\n
"
,
GetLastError
());
result
=
CryptGetUserKey
(
hprov
,
AT_SIGNATURE
,
&
hkey
);
ok
(
result
,
"got %08x
\n
"
,
GetLastError
());
result
=
CryptDestroyKey
(
hkey
);
ok
(
result
,
"got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
result
=
CryptGetUserKey
(
hprov
,
AT_KEYEXCHANGE
,
&
hkey
);
ok
(
!
result
,
"success
\n
"
);
ok
(
GetLastError
()
==
NTE_NO_KEY
,
"got %08x
\n
"
,
GetLastError
());
result
=
CryptReleaseContext
(
hprov
,
0
);
ok
(
result
,
"got %08x
\n
"
,
GetLastError
());
hprov
=
0xdeadbeef
;
result
=
CryptAcquireContextA
(
&
hprov
,
"winetest"
,
MS_ENH_DSS_DH_PROV_A
,
PROV_DSS_DH
,
CRYPT_DELETEKEYSET
);
ok
(
result
,
"got %08x
\n
"
,
GetLastError
());
ok
(
!
hprov
,
"got %08x
\n
"
,
(
DWORD
)
hprov
);
}
START_TEST
(
dssenh
)
START_TEST
(
dssenh
)
{
{
test_acquire_context
();
test_acquire_context
();
...
@@ -1480,4 +1524,5 @@ START_TEST(dssenh)
...
@@ -1480,4 +1524,5 @@ START_TEST(dssenh)
test_verify_signature
();
test_verify_signature
();
test_key_exchange
();
test_key_exchange
();
test_duplicate_hash
();
test_duplicate_hash
();
test_userkey
();
}
}
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