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
72822c0f
Commit
72822c0f
authored
May 10, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
May 10, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Implement and test SystemFunction007.
parent
6969cab5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
12 deletions
+77
-12
advapi32.spec
dlls/advapi32/advapi32.spec
+1
-1
crypt_md4.c
dlls/advapi32/crypt_md4.c
+29
-0
crypt_md4.c
dlls/advapi32/tests/crypt_md4.c
+47
-11
No files found.
dlls/advapi32/advapi32.spec
View file @
72822c0f
...
...
@@ -601,7 +601,7 @@
@ stub SystemFunction004
@ stub SystemFunction005
@ stdcall SystemFunction006(ptr ptr)
@ st
ub SystemFunction007
@ st
dcall SystemFunction007(ptr ptr)
@ stdcall SystemFunction008(ptr ptr ptr)
@ stub SystemFunction009
@ stub SystemFunction010
...
...
dlls/advapi32/crypt_md4.c
View file @
72822c0f
...
...
@@ -35,7 +35,10 @@
#include <stdarg.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
typedef
struct
{
...
...
@@ -267,3 +270,29 @@ static void MD4Transform( unsigned int buf[4], const unsigned int in[16] )
buf
[
2
]
+=
c
;
buf
[
3
]
+=
d
;
}
/******************************************************************************
* SystemFunction007 [ADVAPI32.@]
*
* MD4 hash a unicode string
*
* PARAMS
* string [I] the string to hash
* output [O] the md4 hash of the string (16 bytes)
*
* RETURNS
* Success: STATUS_SUCCESS
* Failure: STATUS_UNSUCCESSFUL
*
*/
NTSTATUS
WINAPI
SystemFunction007
(
PUNICODE_STRING
string
,
LPBYTE
hash
)
{
MD4_CTX
ctx
;
MD4Init
(
&
ctx
);
MD4Update
(
&
ctx
,
(
BYTE
*
)
string
->
Buffer
,
string
->
Length
);
MD4Final
(
&
ctx
);
memcpy
(
hash
,
ctx
.
digest
,
0x10
);
return
STATUS_SUCCESS
;
}
dlls/advapi32/tests/crypt_md4.c
View file @
72822c0f
...
...
@@ -20,10 +20,13 @@
#include <stdio.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winternl.h"
typedef
struct
{
...
...
@@ -36,10 +39,12 @@ typedef struct
typedef
VOID
(
WINAPI
*
fnMD4Init
)(
MD4_CTX
*
ctx
);
typedef
VOID
(
WINAPI
*
fnMD4Update
)(
MD4_CTX
*
ctx
,
const
unsigned
char
*
src
,
const
int
len
);
typedef
VOID
(
WINAPI
*
fnMD4Final
)(
MD4_CTX
*
ctx
);
typedef
int
(
WINAPI
*
fnSystemFunction007
)(
PUNICODE_STRING
,
LPBYTE
);
fnMD4Init
pMD4Init
;
fnMD4Update
pMD4Update
;
fnMD4Final
pMD4Final
;
fnSystemFunction007
pSystemFunction007
;
#define ctxcmp( a, b ) memcmp( (char*)a, (char*)b, FIELD_OFFSET( MD4_CTX, in ) )
...
...
@@ -52,7 +57,6 @@ static void test_md4_ctx(void)
"In our bodies, there is Die"
;
int
size
=
sizeof
(
message
)
-
1
;
HMODULE
module
;
MD4_CTX
ctx
;
MD4_CTX
ctx_initialized
=
...
...
@@ -77,13 +81,6 @@ static void test_md4_ctx(void)
{
0x5f
,
0xd3
,
0x9b
,
0x29
,
0x47
,
0x53
,
0x47
,
0xaf
,
0xa5
,
0xba
,
0x0c
,
0x05
,
0xff
,
0xc0
,
0xc7
,
0xda
};
if
(
!
(
module
=
LoadLibrary
(
"advapi32.dll"
)))
return
;
pMD4Init
=
(
fnMD4Init
)
GetProcAddress
(
module
,
"MD4Init"
);
pMD4Update
=
(
fnMD4Update
)
GetProcAddress
(
module
,
"MD4Update"
);
pMD4Final
=
(
fnMD4Final
)
GetProcAddress
(
module
,
"MD4Final"
);
if
(
!
pMD4Init
||
!
pMD4Update
||
!
pMD4Final
)
goto
out
;
memset
(
&
ctx
,
0
,
sizeof
(
ctx
)
);
pMD4Init
(
&
ctx
);
...
...
@@ -99,11 +96,50 @@ static void test_md4_ctx(void)
ok
(
ctxcmp
(
&
ctx
,
&
ctx_initialized
),
"context has changed
\n
"
);
ok
(
!
memcmp
(
ctx
.
digest
,
expect
,
sizeof
(
expect
)
),
"incorrect result
\n
"
);
out:
FreeLibrary
(
module
);
}
static
void
test_SystemFunction007
(
void
)
{
int
r
;
UNICODE_STRING
str
;
BYTE
output
[
0x10
];
BYTE
expected
[
0x10
]
=
{
0x24
,
0x0a
,
0xf0
,
0x9d
,
0x84
,
0x1c
,
0xda
,
0xcf
,
0x56
,
0xeb
,
0x6b
,
0x96
,
0x55
,
0xec
,
0xcf
,
0x0a
};
WCHAR
szFoo
[]
=
{
'f'
,
'o'
,
'o'
,
0
};
#if 0
/* crashes */
r = pSystemFunction007(NULL, NULL);
ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");
#endif
str
.
Buffer
=
szFoo
;
str
.
Length
=
4
*
sizeof
(
WCHAR
);
str
.
MaximumLength
=
str
.
Length
;
memset
(
output
,
0
,
sizeof
output
);
r
=
pSystemFunction007
(
&
str
,
output
);
ok
(
r
==
STATUS_SUCCESS
,
"wrong error code
\n
"
);
ok
(
!
memcmp
(
output
,
expected
,
sizeof
expected
),
"response wrong
\n
"
);
}
START_TEST
(
crypt_md4
)
{
test_md4_ctx
();
HMODULE
module
;
if
(
!
(
module
=
LoadLibrary
(
"advapi32.dll"
)))
return
;
pMD4Init
=
(
fnMD4Init
)
GetProcAddress
(
module
,
"MD4Init"
);
pMD4Update
=
(
fnMD4Update
)
GetProcAddress
(
module
,
"MD4Update"
);
pMD4Final
=
(
fnMD4Final
)
GetProcAddress
(
module
,
"MD4Final"
);
if
(
pMD4Init
&&
pMD4Update
&&
pMD4Final
)
test_md4_ctx
();
pSystemFunction007
=
(
fnSystemFunction007
)
GetProcAddress
(
module
,
"SystemFunction007"
);
if
(
pSystemFunction007
)
test_SystemFunction007
();
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