diff options
Diffstat (limited to 'fs/cifs/smbencrypt.c')
-rw-r--r-- | fs/cifs/smbencrypt.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c index 4b25ba92180d..1966adaf0b29 100644 --- a/fs/cifs/smbencrypt.c +++ b/fs/cifs/smbencrypt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | Unix SMB/Netbios implementation. | 2 | Unix SMB/Netbios implementation. |
3 | Version 1.9. | 3 | Version 1.9. |
4 | SMB parameters and setup | 4 | SMB parameters and setup |
@@ -57,7 +57,7 @@ void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24); | |||
57 | 57 | ||
58 | /* | 58 | /* |
59 | This implements the X/Open SMB password encryption | 59 | This implements the X/Open SMB password encryption |
60 | It takes a password, a 8 byte "crypt key" and puts 24 bytes of | 60 | It takes a password, a 8 byte "crypt key" and puts 24 bytes of |
61 | encrypted password into p24 */ | 61 | encrypted password into p24 */ |
62 | /* Note that password must be uppercased and null terminated */ | 62 | /* Note that password must be uppercased and null terminated */ |
63 | void | 63 | void |
@@ -74,8 +74,8 @@ SMBencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24) | |||
74 | 74 | ||
75 | SMBOWFencrypt(p21, c8, p24); | 75 | SMBOWFencrypt(p21, c8, p24); |
76 | 76 | ||
77 | memset(p14,0,15); | 77 | memset(p14, 0, 15); |
78 | memset(p21,0,21); | 78 | memset(p21, 0, 21); |
79 | } | 79 | } |
80 | 80 | ||
81 | /* Routines for Windows NT MD4 Hash functions. */ | 81 | /* Routines for Windows NT MD4 Hash functions. */ |
@@ -90,14 +90,14 @@ _my_wcslen(__u16 * str) | |||
90 | 90 | ||
91 | /* | 91 | /* |
92 | * Convert a string into an NT UNICODE string. | 92 | * Convert a string into an NT UNICODE string. |
93 | * Note that regardless of processor type | 93 | * Note that regardless of processor type |
94 | * this must be in intel (little-endian) | 94 | * this must be in intel (little-endian) |
95 | * format. | 95 | * format. |
96 | */ | 96 | */ |
97 | 97 | ||
98 | static int | 98 | static int |
99 | _my_mbstowcs(__u16 * dst, const unsigned char *src, int len) | 99 | _my_mbstowcs(__u16 * dst, const unsigned char *src, int len) |
100 | { /* 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; |
103 | 103 | ||
@@ -112,7 +112,7 @@ _my_mbstowcs(__u16 * dst, const unsigned char *src, int len) | |||
112 | return i; | 112 | return i; |
113 | } | 113 | } |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * Creates the MD4 Hash of the users password in NT UNICODE. | 116 | * Creates the MD4 Hash of the users password in NT UNICODE. |
117 | */ | 117 | */ |
118 | 118 | ||
@@ -123,7 +123,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16) | |||
123 | __u16 wpwd[129]; | 123 | __u16 wpwd[129]; |
124 | 124 | ||
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; |
@@ -138,7 +138,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16) | |||
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); |
142 | } | 142 | } |
143 | 143 | ||
144 | #if 0 /* currently unused */ | 144 | #if 0 /* currently unused */ |
@@ -184,8 +184,8 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n, | |||
184 | struct HMACMD5Context ctx; | 184 | struct HMACMD5Context ctx; |
185 | 185 | ||
186 | /* might as well do one alloc to hold both (user_u and dom_u) */ | 186 | /* might as well do one alloc to hold both (user_u and dom_u) */ |
187 | user_u = kmalloc(2048 * sizeof(wchar_t),GFP_KERNEL); | 187 | user_u = kmalloc(2048 * sizeof(wchar_t), GFP_KERNEL); |
188 | if(user_u == NULL) | 188 | if (user_u == NULL) |
189 | return; | 189 | return; |
190 | dom_u = user_u + 1024; | 190 | dom_u = user_u + 1024; |
191 | 191 | ||
@@ -206,7 +206,7 @@ ntv2_owf_gen(const unsigned char owf[16], const char *user_n, | |||
206 | 206 | ||
207 | kfree(user_u); | 207 | kfree(user_u); |
208 | } | 208 | } |
209 | #endif | 209 | #endif |
210 | 210 | ||
211 | /* Does the des encryption from the NT or LM MD4 hash. */ | 211 | /* Does the des encryption from the NT or LM MD4 hash. */ |
212 | static void | 212 | static void |
@@ -256,15 +256,15 @@ SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24) | |||
256 | #if 0 | 256 | #if 0 |
257 | static void | 257 | static void |
258 | SMBOWFencrypt_ntv2(const unsigned char kr[16], | 258 | SMBOWFencrypt_ntv2(const unsigned char kr[16], |
259 | const struct data_blob * srv_chal, | 259 | const struct data_blob *srv_chal, |
260 | const struct data_blob * cli_chal, unsigned char resp_buf[16]) | 260 | const struct data_blob *cli_chal, unsigned char resp_buf[16]) |
261 | { | 261 | { |
262 | struct HMACMD5Context ctx; | 262 | struct HMACMD5Context ctx; |
263 | 263 | ||
264 | hmac_md5_init_limK_to_64(kr, 16, &ctx); | 264 | hmac_md5_init_limK_to_64(kr, 16, &ctx); |
265 | hmac_md5_update(srv_chal->data, srv_chal->length, &ctx); | 265 | hmac_md5_update(srv_chal->data, srv_chal->length, &ctx); |
266 | hmac_md5_update(cli_chal->data, cli_chal->length, &ctx); | 266 | hmac_md5_update(cli_chal->data, cli_chal->length, &ctx); |
267 | hmac_md5_final(resp_buf, &ctx); | 267 | hmac_md5_final(resp_buf, &ctx); |
268 | } | 268 | } |
269 | 269 | ||
270 | static void | 270 | static void |