aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smbencrypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/smbencrypt.c')
-rw-r--r--fs/cifs/smbencrypt.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c
index 90542a39be17..58bbfd992cc0 100644
--- a/fs/cifs/smbencrypt.c
+++ b/fs/cifs/smbencrypt.c
@@ -80,7 +80,7 @@ SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24)
80 80
81/* Routines for Windows NT MD4 Hash functions. */ 81/* Routines for Windows NT MD4 Hash functions. */
82static int 82static int
83_my_wcslen(__u16 * str) 83_my_wcslen(__u16 *str)
84{ 84{
85 int len = 0; 85 int len = 0;
86 while (*str++ != 0) 86 while (*str++ != 0)
@@ -96,7 +96,7 @@ _my_wcslen(__u16 * str)
96 */ 96 */
97 97
98static int 98static int
99_my_mbstowcs(__u16 * dst, const unsigned char *src, int len) 99_my_mbstowcs(__u16 *dst, const unsigned char *src, int len)
100{ /* BB not a very good conversion routine - change/fix */ 100{ /* BB not a very good conversion routine - change/fix */
101 int i; 101 int i;
102 __u16 val; 102 __u16 val;
@@ -125,9 +125,9 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16)
125 /* Password cannot be longer than 128 characters */ 125 /* Password cannot be longer than 128 characters */
126 if (passwd) { 126 if (passwd) {
127 len = strlen((char *) passwd); 127 len = strlen((char *) passwd);
128 if (len > 128) { 128 if (len > 128)
129 len = 128; 129 len = 128;
130 } 130
131 /* Password must be converted to NT unicode */ 131 /* Password must be converted to NT unicode */
132 _my_mbstowcs(wpwd, passwd, len); 132 _my_mbstowcs(wpwd, passwd, len);
133 } else 133 } else
@@ -135,7 +135,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16)
135 135
136 wpwd[len] = 0; /* Ensure string is null terminated */ 136 wpwd[len] = 0; /* Ensure string is null terminated */
137 /* Calculate length in bytes */ 137 /* Calculate length in bytes */
138 len = _my_wcslen(wpwd) * sizeof (__u16); 138 len = _my_wcslen(wpwd) * sizeof(__u16);
139 139
140 mdfour(p16, (unsigned char *) wpwd, len); 140 mdfour(p16, (unsigned char *) wpwd, len);
141 memset(wpwd, 0, 129 * 2); 141 memset(wpwd, 0, 129 * 2);
@@ -167,7 +167,7 @@ nt_lm_owf_gen(char *pwd, unsigned char nt_p16[16], unsigned char p16[16])
167 E_P16((unsigned char *) passwd, (unsigned char *) p16); 167 E_P16((unsigned char *) passwd, (unsigned char *) p16);
168 168
169 /* clear out local copy of user's password (just being paranoid). */ 169 /* clear out local copy of user's password (just being paranoid). */
170 memset(passwd, '\0', sizeof (passwd)); 170 memset(passwd, '\0', sizeof(passwd));
171} 171}
172#endif 172#endif
173 173
@@ -189,8 +189,10 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n,
189 return; 189 return;
190 dom_u = user_u + 1024; 190 dom_u = user_u + 1024;
191 191
192 /* push_ucs2(NULL, user_u, user_n, (user_l+1)*2, STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); 192 /* push_ucs2(NULL, user_u, user_n, (user_l+1)*2,
193 push_ucs2(NULL, dom_u, domain_n, (domain_l+1)*2, STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); */ 193 STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER);
194 push_ucs2(NULL, dom_u, domain_n, (domain_l+1)*2,
195 STR_UNICODE|STR_NOALIGN|STR_TERMINATE|STR_UPPER); */
194 196
195 /* BB user and domain may need to be uppercased */ 197 /* BB user and domain may need to be uppercased */
196 user_l = cifs_strtoUCS(user_u, user_n, 511, nls_codepage); 198 user_l = cifs_strtoUCS(user_u, user_n, 511, nls_codepage);