Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
0a39c310
Commit
0a39c310
authored
Jul 09, 2003
by
Steve French
Committed by
Steve French
Jul 09, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More NTLMv2
parent
0a119366
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
26 deletions
+41
-26
fs/cifs/cifsencrypt.c
fs/cifs/cifsencrypt.c
+32
-22
fs/cifs/cifsproto.h
fs/cifs/cifsproto.h
+1
-2
fs/cifs/connect.c
fs/cifs/connect.c
+8
-2
No files found.
fs/cifs/cifsencrypt.c
View file @
0a39c310
...
@@ -142,50 +142,60 @@ int cifs_calculate_mac_key(char * key, const char * rn, const char * password)
...
@@ -142,50 +142,60 @@ int cifs_calculate_mac_key(char * key, const char * rn, const char * password)
int
CalcNTLMv2_partial_mac_key
(
struct
cifsSesInfo
*
ses
,
struct
nls_table
*
nls_info
)
int
CalcNTLMv2_partial_mac_key
(
struct
cifsSesInfo
*
ses
,
struct
nls_table
*
nls_info
)
{
{
char
temp_
key
[
16
];
char
temp_
hash
[
16
];
struct
HMACMD5Context
ctx
;
struct
HMACMD5Context
ctx
;
char
*
ucase_buf
;
char
*
ucase_buf
;
wchar_t
*
unicode_buf
;
wchar_t
*
unicode_buf
;
unsigned
int
i
,
user_
len
,
dom
_len
;
unsigned
int
i
,
user_
name_len
,
dom_name
_len
;
if
(
ses
)
if
(
ses
)
return
-
EINVAL
;
return
-
EINVAL
;
E_md4hash
(
ses
->
password_with_pad
,
temp_
key
);
E_md4hash
(
ses
->
password_with_pad
,
temp_
hash
);
hmac_md5_init_limK_to_64
(
temp_
key
,
16
,
&
ctx
);
hmac_md5_init_limK_to_64
(
temp_
hash
,
16
,
&
ctx
);
user_len
=
strlen
(
ses
->
userName
);
user_
name_
len
=
strlen
(
ses
->
userName
);
if
(
user_len
>
MAX_USERNAME_SIZE
)
if
(
user_
name_
len
>
MAX_USERNAME_SIZE
)
return
-
EINVAL
;
return
-
EINVAL
;
dom_len
=
strlen
(
ses
->
domainName
);
dom_
name_
len
=
strlen
(
ses
->
domainName
);
if
(
dom_len
>
MAX_USERNAME_SIZE
)
if
(
dom_
name_
len
>
MAX_USERNAME_SIZE
)
return
-
EINVAL
;
return
-
EINVAL
;
ucase_buf
=
kmalloc
((
MAX_USERNAME_SIZE
+
1
),
GFP_KERNEL
);
ucase_buf
=
kmalloc
((
MAX_USERNAME_SIZE
+
1
),
GFP_KERNEL
);
unicode_buf
=
kmalloc
((
MAX_USERNAME_SIZE
+
1
)
*
2
,
GFP_KERNEL
);
unicode_buf
=
kmalloc
((
MAX_USERNAME_SIZE
+
1
)
*
4
,
GFP_KERNEL
);
for
(
i
=
0
;
i
<
user_len
;
i
++
)
for
(
i
=
0
;
i
<
user_
name_
len
;
i
++
)
ucase_buf
[
i
]
=
nls_info
->
charset2upper
[(
int
)
ses
->
userName
[
i
]];
ucase_buf
[
i
]
=
nls_info
->
charset2upper
[(
int
)
ses
->
userName
[
i
]];
ucase_buf
[
i
]
=
0
;
ucase_buf
[
i
]
=
0
;
user_len
=
cifs_strtoUCS
(
unicode_buf
,
ucase_buf
,
MAX_USERNAME_SIZE
*
2
,
nls_info
);
user_name_len
=
cifs_strtoUCS
(
unicode_buf
,
ucase_buf
,
MAX_USERNAME_SIZE
*
2
,
nls_info
);
/* BB inc user_len + 2 or 2 for trailing nulls? */
unicode_buf
[
user_name_len
]
=
0
;
user_name_len
++
;
/* Add call to hmac md5 user BB */
for
(
i
=
0
;
i
<
dom_len
;
i
++
)
for
(
i
=
0
;
i
<
dom_
name_
len
;
i
++
)
ucase_buf
[
i
]
=
nls_info
->
charset2upper
[(
int
)
ses
->
domainName
[
i
]];
ucase_buf
[
i
]
=
nls_info
->
charset2upper
[(
int
)
ses
->
domainName
[
i
]];
ucase_buf
[
i
]
=
0
;
ucase_buf
[
i
]
=
0
;
dom_len
=
cifs_strtoUCS
(
unicode_buf
,
ucase_buf
,
MAX_USERNAME_SIZE
*
2
,
nls_info
);
dom_name_len
=
cifs_strtoUCS
(
unicode_buf
+
user_name_len
,
ucase_buf
,
MAX_USERNAME_SIZE
*
2
,
nls_info
);
/* BB inc dom_len + 1 or 2 for trailing nulls? */
/* Add call to hmac md5 domain */
/* BB add hmac md5 final BB */
unicode_buf
[
user_name_len
+
dom_name_len
]
=
0
;
hmac_md5_update
((
const
unsigned
char
*
)
unicode_buf
,
(
user_name_len
+
dom_name_len
)
*
2
,
&
ctx
);
hmac_md5_final
(
ses
->
mac_signing_key
,
&
ctx
);
kfree
(
ucase_buf
);
kfree
(
ucase_buf
);
kfree
(
unicode_buf
);
kfree
(
unicode_buf
);
return
0
;
return
0
;
}
}
void
CalcNTLMv2_response
(
const
struct
cifsSesInfo
*
ses
,
char
*
v2_session_response
)
{
struct
HMACMD5Context
context
;
memcpy
(
v2_session_response
+
8
,
ses
->
server
->
cryptKey
,
8
);
/* gen_blob(v2_session_response + 16); */
hmac_md5_init_limK_to_64
(
ses
->
mac_signing_key
,
16
,
&
context
);
hmac_md5_update
(
ses
->
server
->
cryptKey
,
8
,
&
context
);
/* hmac_md5_update(v2_session_response+16)client thing,8,&context); */
/* BB fix */
hmac_md5_final
(
v2_session_response
,
&
context
);
}
fs/cifs/cifsproto.h
View file @
0a39c310
...
@@ -229,8 +229,7 @@ extern int cifs_verify_signature(const struct smb_hdr *, const char * mac_key,
...
@@ -229,8 +229,7 @@ extern int cifs_verify_signature(const struct smb_hdr *, const char * mac_key,
__u32
expected_sequence_number
);
__u32
expected_sequence_number
);
extern
int
cifs_calculate_mac_key
(
char
*
key
,
const
char
*
rn
,
const
char
*
pass
);
extern
int
cifs_calculate_mac_key
(
char
*
key
,
const
char
*
rn
,
const
char
*
pass
);
extern
void
CalcNTLMv2_partial_mac_key
(
struct
cifsSesInfo
*
,
struct
nls_table
*
);
extern
void
CalcNTLMv2_partial_mac_key
(
struct
cifsSesInfo
*
,
struct
nls_table
*
);
extern
void
CalcNTLMv2_response
(
const
struct
cifsSesInfo
*
,
char
*
);
/* BB routines below not implemented yet BB */
extern
int
CIFSBuildServerList
(
int
xid
,
char
*
serverBufferList
,
extern
int
CIFSBuildServerList
(
int
xid
,
char
*
serverBufferList
,
int
recordlength
,
int
*
entries
,
int
recordlength
,
int
*
entries
,
...
...
fs/cifs/connect.c
View file @
0a39c310
...
@@ -665,12 +665,18 @@ int setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, struct nls_tab
...
@@ -665,12 +665,18 @@ int setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, struct nls_tab
nls_info
);
nls_info
);
if
(
!
rc
)
{
if
(
!
rc
)
{
if
(
ntlmv2_flag
)
{
if
(
ntlmv2_flag
)
{
char
*
v2_response
;
cFYI
(
1
,(
"Can use more secure NTLM version 2 password hash"
));
cFYI
(
1
,(
"Can use more secure NTLM version 2 password hash"
));
/* SMBNTv2encrypt( ...); */
/* BB fix this up */
CalcNTLMv2_partial_mac_key
(
pSesInfo
,
CalcNTLMv2_partial_mac_key
(
pSesInfo
,
nls_info
);
nls_info
);
/* cifs_calculate_ntlmv2_mac_key(pSesInfo->mac_signing_key, ntlm_session_key, */
v2_response
=
kmalloc
(
16
+
64
/* blob */
,
GFP_KERNEL
);
if
(
v2_response
)
{
CalcNTLMv2_response
(
pSesInfo
,
v2_response
);
/* cifs_calculate_ntlmv2_mac_key(pSesInfo->mac_signing_key, response, ntlm_session_key, */
kfree
(
v2_response
);
/* BB Put dummy sig in SessSetup PDU? */
/* BB Put dummy sig in SessSetup PDU? */
}
else
rc
=
-
ENOMEM
;
}
else
{
}
else
{
SMBNTencrypt
(
pSesInfo
->
password_with_pad
,
SMBNTencrypt
(
pSesInfo
->
password_with_pad
,
...
...
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