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
6fad2cba
Commit
6fad2cba
authored
May 21, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
May 22, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Implement and test SystemFunction(012-023).
parent
b4899f07
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
167 additions
and
12 deletions
+167
-12
advapi32.spec
dlls/advapi32/advapi32.spec
+12
-12
crypt_lmhash.c
dlls/advapi32/crypt_lmhash.c
+58
-0
crypt_lmhash.c
dlls/advapi32/tests/crypt_lmhash.c
+97
-0
No files found.
dlls/advapi32/advapi32.spec
View file @
6fad2cba
...
...
@@ -606,18 +606,18 @@
@ stdcall SystemFunction009(ptr ptr ptr)
@ stdcall SystemFunction010(ptr ptr ptr)
@ stub SystemFunction011
@ st
ub SystemFunction012
@ st
ub SystemFunction013
@ st
ub SystemFunction014
@ st
ub SystemFunction015
@ st
ub SystemFunction016
@ st
ub SystemFunction017
@ st
ub SystemFunction018
@ st
ub SystemFunction019
@ st
ub SystemFunction020
@ st
ub SystemFunction021
@ st
ub SystemFunction02
2
@ st
ub SystemFunction02
3
@ st
dcall SystemFunction012(ptr ptr ptr)
@ st
dcall SystemFunction013(ptr ptr ptr)
@ st
dcall SystemFunction014(ptr ptr ptr) SystemFunction012
@ st
dcall SystemFunction015(ptr ptr ptr) SystemFunction013
@ st
dcall SystemFunction016(ptr ptr ptr) SystemFunction012
@ st
dcall SystemFunction017(ptr ptr ptr) SystemFunction013
@ st
dcall SystemFunction018(ptr ptr ptr) SystemFunction012
@ st
dcall SystemFunction019(ptr ptr ptr) SystemFunction013
@ st
dcall SystemFunction020(ptr ptr ptr) SystemFunction012
@ st
dcall SystemFunction021(ptr ptr ptr) SystemFunction013
@ st
dcall SystemFunction022(ptr ptr ptr) SystemFunction01
2
@ st
dcall SystemFunction023(ptr ptr ptr) SystemFunction01
3
@ stub SystemFunction024
@ stub SystemFunction025
@ stub SystemFunction026
...
...
dlls/advapi32/crypt_lmhash.c
View file @
6fad2cba
...
...
@@ -290,3 +290,61 @@ NTSTATUS WINAPI SystemFunction005(const struct ustring *in,
return
STATUS_SUCCESS
;
}
/******************************************************************************
* SystemFunction012 [ADVAPI32.@]
* SystemFunction014 [ADVAPI32.@]
* SystemFunction016 [ADVAPI32.@]
* SystemFunction018 [ADVAPI32.@]
* SystemFunction020 [ADVAPI32.@]
* SystemFunction022 [ADVAPI32.@]
*
* Encrypts two DES blocks with two keys
*
* PARAMS
* data [I] data to encrypt (16 bytes)
* key [I] key data (two lots of 7 bytes)
* output [O] buffer to receive encrypted data (16 bytes)
*
* RETURNS
* Success: STATUS_SUCCESS
* Failure: STATUS_UNSUCCESSFUL if the input or output buffer is NULL
*/
NTSTATUS
WINAPI
SystemFunction012
(
const
LPBYTE
in
,
const
LPBYTE
key
,
LPBYTE
out
)
{
if
(
!
in
||
!
out
)
return
STATUS_UNSUCCESSFUL
;
CRYPT_DEShash
(
out
,
key
,
in
);
CRYPT_DEShash
(
out
+
8
,
key
+
7
,
in
+
8
);
return
STATUS_SUCCESS
;
}
/******************************************************************************
* SystemFunction013 [ADVAPI32.@]
* SystemFunction015 [ADVAPI32.@]
* SystemFunction017 [ADVAPI32.@]
* SystemFunction019 [ADVAPI32.@]
* SystemFunction021 [ADVAPI32.@]
* SystemFunction023 [ADVAPI32.@]
*
* Decrypts two DES blocks with two keys
*
* PARAMS
* data [I] data to decrypt (16 bytes)
* key [I] key data (two lots of 7 bytes)
* output [O] buffer to receive decrypted data (16 bytes)
*
* RETURNS
* Success: STATUS_SUCCESS
* Failure: STATUS_UNSUCCESSFUL if the input or output buffer is NULL
*/
NTSTATUS
WINAPI
SystemFunction013
(
const
LPBYTE
in
,
const
LPBYTE
key
,
LPBYTE
out
)
{
if
(
!
in
||
!
out
)
return
STATUS_UNSUCCESSFUL
;
CRYPT_DESunhash
(
out
,
key
,
in
);
CRYPT_DESunhash
(
out
+
8
,
key
+
7
,
in
+
8
);
return
STATUS_SUCCESS
;
}
dlls/advapi32/tests/crypt_lmhash.c
View file @
6fad2cba
...
...
@@ -42,6 +42,7 @@ typedef NTSTATUS (WINAPI *fnSystemFunction005)(const struct ustring *, const str
typedef
VOID
(
WINAPI
*
fnSystemFunction006
)(
PCSTR
passwd
,
PSTR
lmhash
);
typedef
NTSTATUS
(
WINAPI
*
fnSystemFunction008
)(
const
LPBYTE
,
const
LPBYTE
,
LPBYTE
);
typedef
NTSTATUS
(
WINAPI
*
fnSystemFunction009
)(
const
LPBYTE
,
const
LPBYTE
,
LPBYTE
);
typedef
int
(
WINAPI
*
descrypt
)(
unsigned
char
*
,
unsigned
char
*
,
unsigned
char
*
);
typedef
NTSTATUS
(
WINAPI
*
fnSystemFunction032
)(
struct
ustring
*
,
struct
ustring
*
);
fnSystemFunction001
pSystemFunction001
;
...
...
@@ -52,6 +53,23 @@ fnSystemFunction004 pSystemFunction005;
fnSystemFunction006
pSystemFunction006
;
fnSystemFunction008
pSystemFunction008
;
fnSystemFunction008
pSystemFunction009
;
/* encrypt two blocks */
descrypt
pSystemFunction012
;
descrypt
pSystemFunction014
;
descrypt
pSystemFunction016
;
descrypt
pSystemFunction018
;
descrypt
pSystemFunction020
;
descrypt
pSystemFunction022
;
/* decrypt two blocks */
descrypt
pSystemFunction013
;
descrypt
pSystemFunction015
;
descrypt
pSystemFunction017
;
descrypt
pSystemFunction019
;
descrypt
pSystemFunction021
;
descrypt
pSystemFunction023
;
fnSystemFunction032
pSystemFunction032
;
static
void
test_SystemFunction006
(
void
)
...
...
@@ -355,6 +373,56 @@ static void test_SystemFunction009(void)
ok
(
!
memcmp
(
output
,
expected
,
sizeof
expected
),
"response wrong
\n
"
);
}
static
unsigned
char
des_key
[]
=
{
0xff
,
0x37
,
0x50
,
0xbc
,
0xc2
,
0xb2
,
0x24
,
0xff
,
0x37
,
0x50
,
0xbc
,
0xc2
,
0xb2
,
0x24
,
};
static
unsigned
char
des_plaintext
[]
=
{
0x01
,
0x23
,
0x45
,
0x67
,
0x89
,
0xab
,
0xcd
,
0xef
,
0x01
,
0x23
,
0x45
,
0x67
,
0x89
,
0xab
,
0xcd
,
0xef
,
0
};
static
unsigned
char
des_ciphertext
[]
=
{
0xc3
,
0x37
,
0xcd
,
0x5c
,
0xbd
,
0x44
,
0xfc
,
0x97
,
0xc3
,
0x37
,
0xcd
,
0x5c
,
0xbd
,
0x44
,
0xfc
,
0x97
,
0
};
/* test functions that encrypt two DES blocks */
static
void
test_SystemFunction_encrypt
(
descrypt
func
,
int
num
)
{
unsigned
char
output
[
0x11
];
int
r
;
if
(
!
func
)
return
;
r
=
func
(
NULL
,
NULL
,
NULL
);
ok
(
r
==
STATUS_UNSUCCESSFUL
,
"wrong error code
\n
"
);
memset
(
output
,
0
,
sizeof
output
);
r
=
func
(
des_plaintext
,
des_key
,
output
);
ok
(
r
==
STATUS_SUCCESS
,
"wrong error code
\n
"
);
ok
(
!
memcmp
(
des_ciphertext
,
output
,
sizeof
des_ciphertext
),
"ciphertext wrong (%d)
\n
"
,
num
);
}
/* test functions that decrypt two DES blocks */
static
void
test_SystemFunction_decrypt
(
descrypt
func
,
int
num
)
{
unsigned
char
output
[
0x11
];
int
r
;
if
(
!
func
)
return
;
r
=
func
(
NULL
,
NULL
,
NULL
);
ok
(
r
==
STATUS_UNSUCCESSFUL
,
"wrong error code
\n
"
);
memset
(
output
,
0
,
sizeof
output
);
r
=
func
(
des_ciphertext
,
des_key
,
output
);
ok
(
r
==
STATUS_SUCCESS
,
"wrong error code
\n
"
);
ok
(
!
memcmp
(
des_plaintext
,
output
,
sizeof
des_plaintext
),
"plaintext wrong (%d)
\n
"
,
num
);
}
START_TEST
(
crypt_lmhash
)
{
HMODULE
module
;
...
...
@@ -397,5 +465,34 @@ START_TEST(crypt_lmhash)
if
(
pSystemFunction032
)
test_SystemFunction032
();
pSystemFunction012
=
(
descrypt
)
GetProcAddress
(
module
,
"SystemFunction012"
);
pSystemFunction013
=
(
descrypt
)
GetProcAddress
(
module
,
"SystemFunction013"
);
pSystemFunction014
=
(
descrypt
)
GetProcAddress
(
module
,
"SystemFunction014"
);
pSystemFunction015
=
(
descrypt
)
GetProcAddress
(
module
,
"SystemFunction015"
);
pSystemFunction016
=
(
descrypt
)
GetProcAddress
(
module
,
"SystemFunction016"
);
pSystemFunction017
=
(
descrypt
)
GetProcAddress
(
module
,
"SystemFunction017"
);
pSystemFunction018
=
(
descrypt
)
GetProcAddress
(
module
,
"SystemFunction018"
);
pSystemFunction019
=
(
descrypt
)
GetProcAddress
(
module
,
"SystemFunction019"
);
pSystemFunction020
=
(
descrypt
)
GetProcAddress
(
module
,
"SystemFunction020"
);
pSystemFunction021
=
(
descrypt
)
GetProcAddress
(
module
,
"SystemFunction021"
);
pSystemFunction022
=
(
descrypt
)
GetProcAddress
(
module
,
"SystemFunction022"
);
pSystemFunction023
=
(
descrypt
)
GetProcAddress
(
module
,
"SystemFunction023"
);
/* these all encrypt two DES blocks */
test_SystemFunction_encrypt
(
pSystemFunction012
,
12
);
test_SystemFunction_encrypt
(
pSystemFunction014
,
14
);
test_SystemFunction_encrypt
(
pSystemFunction016
,
16
);
test_SystemFunction_encrypt
(
pSystemFunction018
,
18
);
test_SystemFunction_encrypt
(
pSystemFunction020
,
20
);
test_SystemFunction_encrypt
(
pSystemFunction022
,
22
);
/* these all decrypt two DES blocks */
test_SystemFunction_decrypt
(
pSystemFunction013
,
13
);
test_SystemFunction_decrypt
(
pSystemFunction015
,
15
);
test_SystemFunction_decrypt
(
pSystemFunction017
,
17
);
test_SystemFunction_decrypt
(
pSystemFunction019
,
19
);
test_SystemFunction_decrypt
(
pSystemFunction021
,
21
);
test_SystemFunction_decrypt
(
pSystemFunction023
,
23
);
FreeLibrary
(
module
);
}
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