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
6bad1636
Commit
6bad1636
authored
Jan 10, 2015
by
Bruno Jesus
Committed by
Alexandre Julliard
Jan 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsaenh: Don't reset the salt length after setting a salt for Base and Strong providers.
parent
c0e4759d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
14 deletions
+21
-14
rsaenh.c
dlls/rsaenh/rsaenh.c
+7
-3
rsaenh.c
dlls/rsaenh/tests/rsaenh.c
+14
-11
No files found.
dlls/rsaenh/rsaenh.c
View file @
6bad1636
...
@@ -3462,6 +3462,8 @@ BOOL WINAPI RSAENH_CPSetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam
...
@@ -3462,6 +3462,8 @@ BOOL WINAPI RSAENH_CPSetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam
switch
(
pCryptKey
->
aiAlgid
)
{
switch
(
pCryptKey
->
aiAlgid
)
{
case
CALG_RC2
:
case
CALG_RC2
:
case
CALG_RC4
:
case
CALG_RC4
:
{
KEYCONTAINER
*
pKeyContainer
=
get_key_container
(
pCryptKey
->
hProv
);
if
(
!
pbData
)
if
(
!
pbData
)
{
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
...
@@ -3474,11 +3476,13 @@ BOOL WINAPI RSAENH_CPSetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam
...
@@ -3474,11 +3476,13 @@ BOOL WINAPI RSAENH_CPSetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam
pbData
,
11
);
pbData
,
11
);
pCryptKey
->
dwSaltLen
=
11
;
pCryptKey
->
dwSaltLen
=
11
;
setup_key
(
pCryptKey
);
setup_key
(
pCryptKey
);
/* Strange but true: salt length reset to 0 after setting
/* After setting the salt value if the provider is not base or
* it via KP_SALT.
* strong the salt length will be reset. */
*/
if
(
pKeyContainer
->
dwPersonality
!=
RSAENH_PERSONALITY_BASE
&&
pKeyContainer
->
dwPersonality
!=
RSAENH_PERSONALITY_STRONG
)
pCryptKey
->
dwSaltLen
=
0
;
pCryptKey
->
dwSaltLen
=
0
;
break
;
break
;
}
default:
default:
SetLastError
(
NTE_BAD_KEY
);
SetLastError
(
NTE_BAD_KEY
);
return
FALSE
;
return
FALSE
;
...
...
dlls/rsaenh/tests/rsaenh.c
View file @
6bad1636
...
@@ -62,7 +62,7 @@ static const cryptdata cTestData[4] = {
...
@@ -62,7 +62,7 @@ static const cryptdata cTestData[4] = {
12
,
12
,
16
}
12
,
12
,
16
}
};
};
static
int
win2k
;
static
int
win2k
,
nt4
;
/*
/*
* 1. Take the MD5 Hash of the container name (with an extra null byte)
* 1. Take the MD5 Hash of the container name (with an extra null byte)
...
@@ -249,7 +249,10 @@ static void test_prov(void)
...
@@ -249,7 +249,10 @@ static void test_prov(void)
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
result
=
CryptGetProvParam
(
hProv
,
PP_SIG_KEYSIZE_INC
,
(
BYTE
*
)
&
dwInc
,
&
dwLen
,
0
);
result
=
CryptGetProvParam
(
hProv
,
PP_SIG_KEYSIZE_INC
,
(
BYTE
*
)
&
dwInc
,
&
dwLen
,
0
);
if
(
!
result
&&
GetLastError
()
==
NTE_BAD_TYPE
)
if
(
!
result
&&
GetLastError
()
==
NTE_BAD_TYPE
)
{
skip
(
"PP_SIG_KEYSIZE_INC is not supported (win9x or NT)
\n
"
);
skip
(
"PP_SIG_KEYSIZE_INC is not supported (win9x or NT)
\n
"
);
nt4
++
;
}
else
else
ok
(
result
&&
dwInc
==
8
,
"%08x, %d
\n
"
,
GetLastError
(),
dwInc
);
ok
(
result
&&
dwInc
==
8
,
"%08x, %d
\n
"
,
GetLastError
(),
dwInc
);
...
@@ -1472,16 +1475,16 @@ static void test_rc2(void)
...
@@ -1472,16 +1475,16 @@ static void test_rc2(void)
result
=
CryptDecrypt
(
hKey
,
0
,
TRUE
,
0
,
pbData
,
&
dwDataLen
);
result
=
CryptDecrypt
(
hKey
,
0
,
TRUE
,
0
,
pbData
,
&
dwDataLen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
/* Setting the salt
also succeeds...
*/
/* Setting the salt
value will not reset the salt length in base or strong providers
*/
result
=
CryptSetKeyParam
(
hKey
,
KP_SALT
,
pbData
,
0
);
result
=
CryptSetKeyParam
(
hKey
,
KP_SALT
,
pbData
,
0
);
ok
(
result
,
"setting salt failed: %08x
\n
"
,
GetLastError
());
ok
(
result
,
"setting salt failed: %08x
\n
"
,
GetLastError
());
/* but the resulting salt length is now zero? */
dwLen
=
0
;
dwLen
=
0
;
result
=
CryptGetKeyParam
(
hKey
,
KP_SALT
,
NULL
,
&
dwLen
,
0
);
result
=
CryptGetKeyParam
(
hKey
,
KP_SALT
,
NULL
,
&
dwLen
,
0
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
dwLen
==
0
||
if
(
BASE_PROV
||
STRONG_PROV
)
broken
(
dwLen
==
11
),
/* Win9x/WinMe/NT4 */
ok
(
dwLen
==
11
,
"expected salt length 11, got %d
\n
"
,
dwLen
);
"unexpected salt length %d
\n
"
,
dwLen
);
else
ok
(
dwLen
==
0
||
broken
(
nt4
&&
dwLen
==
11
),
"expected salt length 0, got %d
\n
"
,
dwLen
);
/* What sizes salt can I set? */
/* What sizes salt can I set? */
salt
.
pbData
=
pbData
;
salt
.
pbData
=
pbData
;
for
(
i
=
0
;
i
<
24
;
i
++
)
for
(
i
=
0
;
i
<
24
;
i
++
)
...
@@ -1719,16 +1722,16 @@ static void test_rc4(void)
...
@@ -1719,16 +1722,16 @@ static void test_rc4(void)
result
=
CryptDecrypt
(
hKey
,
0
,
TRUE
,
0
,
pbData
,
&
dwDataLen
);
result
=
CryptDecrypt
(
hKey
,
0
,
TRUE
,
0
,
pbData
,
&
dwDataLen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
/* Setting the salt
also succeeds...
*/
/* Setting the salt
value will not reset the salt length in base or strong providers
*/
result
=
CryptSetKeyParam
(
hKey
,
KP_SALT
,
pbData
,
0
);
result
=
CryptSetKeyParam
(
hKey
,
KP_SALT
,
pbData
,
0
);
ok
(
result
,
"setting salt failed: %08x
\n
"
,
GetLastError
());
ok
(
result
,
"setting salt failed: %08x
\n
"
,
GetLastError
());
/* but the resulting salt length is now zero? */
dwLen
=
0
;
dwLen
=
0
;
result
=
CryptGetKeyParam
(
hKey
,
KP_SALT
,
NULL
,
&
dwLen
,
0
);
result
=
CryptGetKeyParam
(
hKey
,
KP_SALT
,
NULL
,
&
dwLen
,
0
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
ok
(
dwLen
==
0
||
if
(
BASE_PROV
||
STRONG_PROV
||
nt4
)
broken
(
dwLen
==
11
),
/* Win9x/WinMe/NT4 */
ok
(
dwLen
==
11
,
"expected salt length 11, got %d
\n
"
,
dwLen
);
"unexpected salt length %d
\n
"
,
dwLen
);
else
ok
(
dwLen
==
0
||
broken
(
nt4
&&
dwLen
==
11
),
"expected salt length 0, got %d
\n
"
,
dwLen
);
/* What sizes salt can I set? */
/* What sizes salt can I set? */
salt
.
pbData
=
pbData
;
salt
.
pbData
=
pbData
;
for
(
i
=
0
;
i
<
24
;
i
++
)
for
(
i
=
0
;
i
<
24
;
i
++
)
...
...
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