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
a7d897d7
Commit
a7d897d7
authored
May 07, 2007
by
Mounir IDRASSI
Committed by
Alexandre Julliard
May 07, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsaenh: Fix read_key_container bug that prevents CryptAcquireContext from…
rsaenh: Fix read_key_container bug that prevents CryptAcquireContext from correctly loading the keys.
parent
12f4acce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
rsaenh.c
dlls/rsaenh/rsaenh.c
+8
-5
rsaenh.c
dlls/rsaenh/tests/rsaenh.c
+20
-0
No files found.
dlls/rsaenh/rsaenh.c
View file @
a7d897d7
...
...
@@ -1050,7 +1050,8 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, PVTa
KEYCONTAINER
*
pKeyContainer
;
HCRYPTPROV
hKeyContainer
;
DATA_BLOB
blobIn
,
blobOut
;
HCRYPTKEY
hCryptKey
;
sprintf
(
szRSABase
,
RSAENH_REGKEY
,
pszContainerName
);
if
(
dwFlags
&
CRYPT_MACHINE_KEYSET
)
{
...
...
@@ -1089,8 +1090,9 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, PVTa
if
(
CryptUnprotectData
(
&
blobIn
,
NULL
,
NULL
,
NULL
,
NULL
,
(
dwFlags
&
CRYPT_MACHINE_KEYSET
)
?
CRYPTPROTECT_LOCAL_MACHINE
:
0
,
&
blobOut
))
{
RSAENH_CPImportKey
(
hKeyContainer
,
blobOut
.
pbData
,
blobOut
.
cbData
,
0
,
0
,
&
pKeyContainer
->
hKeyExchangeKeyPair
);
if
(
RSAENH_CPImportKey
(
hKeyContainer
,
blobOut
.
pbData
,
blobOut
.
cbData
,
0
,
0
,
&
hCryptKey
))
pKeyContainer
->
hKeyExchangeKeyPair
=
hCryptKey
;
HeapFree
(
GetProcessHeap
(),
0
,
blobOut
.
pbData
);
}
}
...
...
@@ -1113,8 +1115,9 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, PVTa
if
(
CryptUnprotectData
(
&
blobIn
,
NULL
,
NULL
,
NULL
,
NULL
,
(
dwFlags
&
CRYPT_MACHINE_KEYSET
)
?
CRYPTPROTECT_LOCAL_MACHINE
:
0
,
&
blobOut
))
{
RSAENH_CPImportKey
(
hKeyContainer
,
blobOut
.
pbData
,
blobOut
.
cbData
,
0
,
0
,
&
pKeyContainer
->
hSignatureKeyPair
);
if
(
RSAENH_CPImportKey
(
hKeyContainer
,
blobOut
.
pbData
,
blobOut
.
cbData
,
0
,
0
,
&
hCryptKey
))
pKeyContainer
->
hSignatureKeyPair
=
hCryptKey
;
HeapFree
(
GetProcessHeap
(),
0
,
blobOut
.
pbData
);
}
}
...
...
dlls/rsaenh/tests/rsaenh.c
View file @
a7d897d7
...
...
@@ -1603,6 +1603,26 @@ static void test_null_provider(void)
CryptAcquireContext
(
&
prov
,
szContainer
,
NULL
,
PROV_RSA_FULL
,
CRYPT_DELETEKEYSET
);
/* test for the bug in accessing the user key in a container
*/
result
=
CryptAcquireContext
(
&
prov
,
szContainer
,
NULL
,
PROV_RSA_FULL
,
CRYPT_NEWKEYSET
);
ok
(
result
,
"CryptAcquireContext failed: %08x
\n
"
,
GetLastError
());
result
=
CryptGenKey
(
prov
,
AT_KEYEXCHANGE
,
0
,
&
key
);
ok
(
result
,
"CryptGenKey with AT_KEYEXCHANGE failed with error %08x
\n
"
,
GetLastError
());
CryptDestroyKey
(
key
);
CryptReleaseContext
(
prov
,
0
);
result
=
CryptAcquireContext
(
&
prov
,
szContainer
,
NULL
,
PROV_RSA_FULL
,
0
);
ok
(
result
,
"CryptAcquireContext failed: 0x%08x
\n
"
,
GetLastError
());
result
=
CryptGetUserKey
(
prov
,
AT_KEYEXCHANGE
,
&
key
);
ok
(
result
,
"CryptGetUserKey failed with error %08x
\n
"
,
GetLastError
());
CryptDestroyKey
(
key
);
CryptAcquireContext
(
&
prov
,
szContainer
,
NULL
,
PROV_RSA_FULL
,
CRYPT_DELETEKEYSET
);
}
START_TEST
(
rsaenh
)
...
...
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