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
4f520dbd
Commit
4f520dbd
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 SystemFunction008.
parent
9088debb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
6 deletions
+89
-6
advapi32.spec
dlls/advapi32/advapi32.spec
+1
-1
crypt_lmhash.c
dlls/advapi32/crypt_lmhash.c
+35
-0
crypt_lmhash.c
dlls/advapi32/tests/crypt_lmhash.c
+53
-5
No files found.
dlls/advapi32/advapi32.spec
View file @
4f520dbd
...
...
@@ -602,7 +602,7 @@
@ stub SystemFunction005
@ stdcall SystemFunction006(ptr ptr)
@ stub SystemFunction007
@ st
ub SystemFunction008
@ st
dcall SystemFunction008(ptr ptr ptr)
@ stub SystemFunction009
@ stub SystemFunction010
@ stub SystemFunction011
...
...
dlls/advapi32/crypt_lmhash.c
View file @
4f520dbd
...
...
@@ -54,3 +54,38 @@ NTSTATUS WINAPI SystemFunction006( LPCSTR password, LPSTR hash )
return
STATUS_SUCCESS
;
}
/******************************************************************************
* SystemFunction008 [ADVAPI32.@]
*
* Creates a LM response from a challenge and a password hash
*
* PARAMS
* challenge [I] Challenge from authentication server
* hash [I] NTLM hash (from SystemFunction006)
* response [O] response to send back to the server
*
* RETURNS
* Success: STATUS_SUCCESS
* Failure: STATUS_UNSUCCESSFUL
*
* NOTES
* see http://davenport.sourceforge.net/ntlm.html#theLmResponse
*
*/
NTSTATUS
WINAPI
SystemFunction008
(
const
LPBYTE
challenge
,
const
LPBYTE
hash
,
LPBYTE
response
)
{
BYTE
key
[
7
*
3
];
if
(
!
challenge
||
!
response
)
return
STATUS_UNSUCCESSFUL
;
memset
(
key
,
0
,
sizeof
key
);
memcpy
(
key
,
hash
,
0x10
);
CRYPT_DEShash
(
response
,
key
,
challenge
);
CRYPT_DEShash
(
response
+
8
,
key
+
7
,
challenge
);
CRYPT_DEShash
(
response
+
16
,
key
+
14
,
challenge
);
return
STATUS_SUCCESS
;
}
dlls/advapi32/tests/crypt_lmhash.c
View file @
4f520dbd
/*
* Unit tests for SystemFunction
006
(LMHash?)
* Unit tests for SystemFunction
XXX
(LMHash?)
*
* Copyright 2004 Hans Leidekker
* Copyright 2006 Mike McCormack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -20,12 +21,18 @@
#include <stdio.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
typedef
VOID
(
WINAPI
*
fnSystemFunction006
)(
PCSTR
passwd
,
PSTR
lmhash
);
typedef
DWORD
(
WINAPI
*
fnSystemFunction008
)(
const
LPBYTE
,
const
LPBYTE
,
LPBYTE
);
fnSystemFunction006
pSystemFunction006
;
fnSystemFunction008
pSystemFunction008
;
static
void
test_SystemFunction006
(
void
)
{
...
...
@@ -45,6 +52,47 @@ static void test_SystemFunction006(void)
lmhash
[
12
],
lmhash
[
13
],
lmhash
[
14
],
lmhash
[
15
]
);
}
static
void
test_SystemFunction008
(
void
)
{
/* example data from http://davenport.sourceforge.net/ntlm.html */
unsigned
char
hash
[
0x40
]
=
{
0xff
,
0x37
,
0x50
,
0xbc
,
0xc2
,
0xb2
,
0x24
,
0x12
,
0xc2
,
0x26
,
0x5b
,
0x23
,
0x73
,
0x4e
,
0x0d
,
0xac
};
unsigned
char
challenge
[
0x40
]
=
{
0x01
,
0x23
,
0x45
,
0x67
,
0x89
,
0xab
,
0xcd
,
0xef
};
unsigned
char
expected
[
0x18
]
=
{
0xc3
,
0x37
,
0xcd
,
0x5c
,
0xbd
,
0x44
,
0xfc
,
0x97
,
0x82
,
0xa6
,
0x67
,
0xaf
,
0x6d
,
0x42
,
0x7c
,
0x6d
,
0xe6
,
0x7c
,
0x20
,
0xc2
,
0xd3
,
0xe7
,
0x7c
,
0x56
};
unsigned
char
output
[
0x18
];
NTSTATUS
r
;
r
=
pSystemFunction008
(
0
,
0
,
0
);
ok
(
r
==
STATUS_UNSUCCESSFUL
,
"wrong error code
\n
"
);
r
=
pSystemFunction008
(
challenge
,
0
,
0
);
ok
(
r
==
STATUS_UNSUCCESSFUL
,
"wrong error code
\n
"
);
r
=
pSystemFunction008
(
challenge
,
hash
,
0
);
ok
(
r
==
STATUS_UNSUCCESSFUL
,
"wrong error code
\n
"
);
/* crashes */
if
(
0
)
{
r
=
pSystemFunction008
(
challenge
,
0
,
output
);
ok
(
r
==
STATUS_UNSUCCESSFUL
,
"wrong error code
\n
"
);
}
r
=
pSystemFunction008
(
0
,
0
,
output
);
ok
(
r
==
STATUS_UNSUCCESSFUL
,
"wrong error code
\n
"
);
memset
(
output
,
0
,
sizeof
output
);
r
=
pSystemFunction008
(
challenge
,
hash
,
output
);
ok
(
r
==
STATUS_SUCCESS
,
"wrong error code
\n
"
);
ok
(
!
memcmp
(
output
,
expected
,
sizeof
expected
),
"response wrong
\n
"
);
}
START_TEST
(
crypt_lmhash
)
{
HMODULE
module
;
...
...
@@ -52,12 +100,12 @@ START_TEST(crypt_lmhash)
if
(
!
(
module
=
LoadLibrary
(
"advapi32.dll"
)))
return
;
pSystemFunction006
=
(
fnSystemFunction006
)
GetProcAddress
(
module
,
"SystemFunction006"
);
if
(
!
pSystemFunction006
)
goto
out
;
if
(
pSystemFunction006
)
test_SystemFunction006
();
out
:
pSystemFunction008
=
(
fnSystemFunction008
)
GetProcAddress
(
module
,
"SystemFunction008"
);
if
(
pSystemFunction008
)
test_SystemFunction008
();
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