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
85655db1
Commit
85655db1
authored
Sep 07, 2006
by
Kai Blin
Committed by
Alexandre Julliard
Sep 08, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
secur32: Fix generation of the session key.
parent
822e6af6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
7 deletions
+23
-7
ntlm.c
dlls/secur32/ntlm.c
+18
-1
secur32_priv.h
dlls/secur32/secur32_priv.h
+1
-1
ntlm.c
dlls/secur32/tests/ntlm.c
+2
-3
util.c
dlls/secur32/util.c
+2
-2
No files found.
dlls/secur32/ntlm.c
View file @
85655db1
...
...
@@ -648,7 +648,24 @@ static SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(
helper
->
session_key
=
HeapAlloc
(
GetProcessHeap
(),
0
,
16
);
/*Generate the dummy session key = MD4(MD4(password))*/
if
(
helper
->
password
)
SECUR32_CreateNTLMv1SessionKey
(
helper
->
password
,
helper
->
session_key
);
{
SEC_WCHAR
*
unicode_password
;
int
passwd_lenW
;
TRACE
(
"Converting password to unicode.
\n
"
);
passwd_lenW
=
MultiByteToWideChar
(
CP_ACP
,
0
,
(
LPCSTR
)
helper
->
password
,
helper
->
pwlen
,
NULL
,
0
);
unicode_password
=
HeapAlloc
(
GetProcessHeap
(),
0
,
passwd_lenW
*
sizeof
(
SEC_WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
(
LPCSTR
)
helper
->
password
,
helper
->
pwlen
,
unicode_password
,
passwd_lenW
);
SECUR32_CreateNTLMv1SessionKey
((
PBYTE
)
unicode_password
,
lstrlenW
(
unicode_password
)
*
sizeof
(
SEC_WCHAR
),
helper
->
session_key
);
HeapFree
(
GetProcessHeap
(),
0
,
unicode_password
);
}
else
memset
(
helper
->
session_key
,
0
,
16
);
}
...
...
dlls/secur32/secur32_priv.h
View file @
85655db1
...
...
@@ -137,7 +137,7 @@ SECURITY_STATUS decodeBase64(char *in_buf, int in_len, BYTE *out_buf,
/* Functions from util.c */
ULONG
ComputeCrc32
(
const
BYTE
*
pData
,
INT
iLen
);
SECURITY_STATUS
SECUR32_CreateNTLMv1SessionKey
(
const
char
*
password
,
PBYTE
session_key
);
SECURITY_STATUS
SECUR32_CreateNTLMv1SessionKey
(
PBYTE
password
,
int
len
,
PBYTE
session_key
);
arc4_info
*
SECUR32_arc4Alloc
(
void
);
void
SECUR32_arc4Init
(
arc4_info
*
a4i
,
const
BYTE
*
key
,
unsigned
int
keyLen
);
void
SECUR32_arc4Process
(
arc4_info
*
a4i
,
BYTE
*
inoutString
,
unsigned
int
length
);
...
...
dlls/secur32/tests/ntlm.c
View file @
85655db1
...
...
@@ -807,12 +807,11 @@ static void testSignSeal()
sec_status
=
pEncryptMessage
(
client
.
ctxt
,
0
,
crypt
,
0
);
ok
(
sec_status
==
SEC_E_OK
,
"EncryptMessage returned %s, not SEC_E_OK.
\n
"
,
getSecError
(
sec_status
));
todo_wine
{
ok
(
!
memcmp
(
crypt
->
pBuffers
[
0
].
pvBuffer
,
crypt_trailer_client
,
crypt
->
pBuffers
[
0
].
cbBuffer
),
"Crypt trailer not as expected.
\n
"
);
ok
(
!
memcmp
(
crypt
->
pBuffers
[
1
].
pvBuffer
,
crypt_message_client
,
crypt
->
pBuffers
[
1
].
cbBuffer
),
"Crypt message not as expected.
\n
"
);
}
data
[
0
].
cbBuffer
=
sizeof
(
crypt_trailer_server
);
data
[
1
].
cbBuffer
=
sizeof
(
crypt_message_server
);
...
...
@@ -823,10 +822,10 @@ static void testSignSeal()
todo_wine
{
ok
(
sec_status
==
SEC_E_OK
,
"DecryptMessage returned %s, not SEC_E_OK.
\n
"
,
getSecError
(
sec_status
));
}
ok
(
!
memcmp
(
crypt
->
pBuffers
[
1
].
pvBuffer
,
message_binary
,
crypt
->
pBuffers
[
1
].
cbBuffer
),
"Failed to decrypt message correctly.
\n
"
);
}
end:
cleanupBuffers
(
&
client
);
...
...
dlls/secur32/util.c
View file @
85655db1
...
...
@@ -106,7 +106,7 @@ ULONG ComputeCrc32(const BYTE *pData, INT iLen)
return
~
crc
;
}
SECURITY_STATUS
SECUR32_CreateNTLMv1SessionKey
(
const
char
*
password
,
PBYTE
session_key
)
SECURITY_STATUS
SECUR32_CreateNTLMv1SessionKey
(
PBYTE
password
,
int
len
,
PBYTE
session_key
)
{
MD4_CTX
ctx
;
BYTE
ntlm_hash
[
16
];
...
...
@@ -114,7 +114,7 @@ SECURITY_STATUS SECUR32_CreateNTLMv1SessionKey(const char* password, PBYTE sessi
TRACE
(
"(%p, %p)
\n
"
,
password
,
session_key
);
MD4Init
(
&
ctx
);
MD4Update
(
&
ctx
,
(
const
unsigned
char
*
)
password
,
l
strlenA
(
password
)
);
MD4Update
(
&
ctx
,
(
const
unsigned
char
*
)
password
,
l
en
);
MD4Final
(
&
ctx
);
memcpy
(
ntlm_hash
,
ctx
.
digest
,
0x10
);
...
...
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