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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
rsaenh.c
dlls/rsaenh/rsaenh.c
+7
-4
rsaenh.c
dlls/rsaenh/tests/rsaenh.c
+20
-0
No files found.
dlls/rsaenh/rsaenh.c
View file @
a7d897d7
...
@@ -1050,6 +1050,7 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, PVTa
...
@@ -1050,6 +1050,7 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, PVTa
KEYCONTAINER
*
pKeyContainer
;
KEYCONTAINER
*
pKeyContainer
;
HCRYPTPROV
hKeyContainer
;
HCRYPTPROV
hKeyContainer
;
DATA_BLOB
blobIn
,
blobOut
;
DATA_BLOB
blobIn
,
blobOut
;
HCRYPTKEY
hCryptKey
;
sprintf
(
szRSABase
,
RSAENH_REGKEY
,
pszContainerName
);
sprintf
(
szRSABase
,
RSAENH_REGKEY
,
pszContainerName
);
...
@@ -1089,8 +1090,9 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, PVTa
...
@@ -1089,8 +1090,9 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, PVTa
if
(
CryptUnprotectData
(
&
blobIn
,
NULL
,
NULL
,
NULL
,
NULL
,
if
(
CryptUnprotectData
(
&
blobIn
,
NULL
,
NULL
,
NULL
,
NULL
,
(
dwFlags
&
CRYPT_MACHINE_KEYSET
)
?
CRYPTPROTECT_LOCAL_MACHINE
:
0
,
&
blobOut
))
(
dwFlags
&
CRYPT_MACHINE_KEYSET
)
?
CRYPTPROTECT_LOCAL_MACHINE
:
0
,
&
blobOut
))
{
{
RSAENH_CPImportKey
(
hKeyContainer
,
blobOut
.
pbData
,
blobOut
.
cbData
,
0
,
0
,
if
(
RSAENH_CPImportKey
(
hKeyContainer
,
blobOut
.
pbData
,
blobOut
.
cbData
,
0
,
0
,
&
pKeyContainer
->
hKeyExchangeKeyPair
);
&
hCryptKey
))
pKeyContainer
->
hKeyExchangeKeyPair
=
hCryptKey
;
HeapFree
(
GetProcessHeap
(),
0
,
blobOut
.
pbData
);
HeapFree
(
GetProcessHeap
(),
0
,
blobOut
.
pbData
);
}
}
}
}
...
@@ -1113,8 +1115,9 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, PVTa
...
@@ -1113,8 +1115,9 @@ static HCRYPTPROV read_key_container(PCHAR pszContainerName, DWORD dwFlags, PVTa
if
(
CryptUnprotectData
(
&
blobIn
,
NULL
,
NULL
,
NULL
,
NULL
,
if
(
CryptUnprotectData
(
&
blobIn
,
NULL
,
NULL
,
NULL
,
NULL
,
(
dwFlags
&
CRYPT_MACHINE_KEYSET
)
?
CRYPTPROTECT_LOCAL_MACHINE
:
0
,
&
blobOut
))
(
dwFlags
&
CRYPT_MACHINE_KEYSET
)
?
CRYPTPROTECT_LOCAL_MACHINE
:
0
,
&
blobOut
))
{
{
RSAENH_CPImportKey
(
hKeyContainer
,
blobOut
.
pbData
,
blobOut
.
cbData
,
0
,
0
,
if
(
RSAENH_CPImportKey
(
hKeyContainer
,
blobOut
.
pbData
,
blobOut
.
cbData
,
0
,
0
,
&
pKeyContainer
->
hSignatureKeyPair
);
&
hCryptKey
))
pKeyContainer
->
hSignatureKeyPair
=
hCryptKey
;
HeapFree
(
GetProcessHeap
(),
0
,
blobOut
.
pbData
);
HeapFree
(
GetProcessHeap
(),
0
,
blobOut
.
pbData
);
}
}
}
}
...
...
dlls/rsaenh/tests/rsaenh.c
View file @
a7d897d7
...
@@ -1603,6 +1603,26 @@ static void test_null_provider(void)
...
@@ -1603,6 +1603,26 @@ static void test_null_provider(void)
CryptAcquireContext
(
&
prov
,
szContainer
,
NULL
,
PROV_RSA_FULL
,
CryptAcquireContext
(
&
prov
,
szContainer
,
NULL
,
PROV_RSA_FULL
,
CRYPT_DELETEKEYSET
);
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
)
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