Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
408f3d96
Commit
408f3d96
authored
Jul 28, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Jul 29, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsaenh: Test and correct the maximum allowable salt length.
parent
469e4a5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
+33
-3
rsaenh.c
dlls/rsaenh/rsaenh.c
+3
-3
rsaenh.c
dlls/rsaenh/tests/rsaenh.c
+30
-0
No files found.
dlls/rsaenh/rsaenh.c
View file @
408f3d96
...
...
@@ -2826,10 +2826,10 @@ BOOL WINAPI RSAENH_CPSetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam
{
CRYPT_INTEGER_BLOB
*
blob
=
(
CRYPT_INTEGER_BLOB
*
)
pbData
;
/* salt length can't be greater than 1
28 bits = 16
bytes */
if
(
blob
->
cbData
>
16
)
/* salt length can't be greater than 1
84 bits = 24
bytes */
if
(
blob
->
cbData
>
24
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
SetLastError
(
NTE_BAD_DATA
);
return
FALSE
;
}
memcpy
(
pCryptKey
->
abKeyValue
+
pCryptKey
->
dwKeyLen
,
blob
->
pbData
,
...
...
dlls/rsaenh/tests/rsaenh.c
View file @
408f3d96
...
...
@@ -749,6 +749,8 @@ static void test_rc2(void)
if
(
!
result
)
{
ok
(
GetLastError
()
==
NTE_BAD_ALGID
,
"%08x
\n
"
,
GetLastError
());
}
else
{
CRYPT_INTEGER_BLOB
salt
;
result
=
CryptHashData
(
hHash
,
(
BYTE
*
)
pbData
,
sizeof
(
pbData
),
0
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
...
...
@@ -812,6 +814,19 @@ static void test_rc2(void)
result
=
CryptDecrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwDataLen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
/* What sizes salt can I set? */
salt
.
pbData
=
pbData
;
for
(
i
=
0
;
i
<
24
;
i
++
)
{
salt
.
cbData
=
i
;
result
=
CryptSetKeyParam
(
hKey
,
KP_SALT_EX
,
(
BYTE
*
)
&
salt
,
0
);
ok
(
result
,
"setting salt failed for size %d: %08x
\n
"
,
i
,
GetLastError
());
}
salt
.
cbData
=
25
;
SetLastError
(
0xdeadbeef
);
result
=
CryptSetKeyParam
(
hKey
,
KP_SALT_EX
,
(
BYTE
*
)
&
salt
,
0
);
ok
(
!
result
&&
GetLastError
()
==
NTE_BAD_DATA
,
"%08x
\n
"
,
GetLastError
());
result
=
CryptDestroyKey
(
hKey
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
}
...
...
@@ -901,6 +916,8 @@ static void test_rc4(void)
/* rsaenh compiled without OpenSSL */
ok
(
GetLastError
()
==
NTE_BAD_ALGID
,
"%08x
\n
"
,
GetLastError
());
}
else
{
CRYPT_INTEGER_BLOB
salt
;
result
=
CryptHashData
(
hHash
,
(
BYTE
*
)
pbData
,
sizeof
(
pbData
),
0
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
...
...
@@ -949,6 +966,19 @@ static void test_rc4(void)
result
=
CryptDecrypt
(
hKey
,
(
HCRYPTHASH
)
NULL
,
TRUE
,
0
,
pbData
,
&
dwDataLen
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
/* What sizes salt can I set? */
salt
.
pbData
=
pbData
;
for
(
i
=
0
;
i
<
24
;
i
++
)
{
salt
.
cbData
=
i
;
result
=
CryptSetKeyParam
(
hKey
,
KP_SALT_EX
,
(
BYTE
*
)
&
salt
,
0
);
ok
(
result
,
"setting salt failed for size %d: %08x
\n
"
,
i
,
GetLastError
());
}
salt
.
cbData
=
25
;
SetLastError
(
0xdeadbeef
);
result
=
CryptSetKeyParam
(
hKey
,
KP_SALT_EX
,
(
BYTE
*
)
&
salt
,
0
);
ok
(
!
result
&&
GetLastError
()
==
NTE_BAD_DATA
,
"%08x
\n
"
,
GetLastError
());
result
=
CryptDestroyKey
(
hKey
);
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
}
...
...
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