]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/cifs/cifsencrypt.c
serial, 8250: remove NR_IRQ usage
[linux-2.6-omap-h63xx.git] / fs / cifs / cifsencrypt.c
index 36272293027d41902231b0725aba64ba680e49dc..bd5f13d38450ba5872658b2bee53a3ca017eb812 100644 (file)
@@ -99,15 +99,16 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
        MD5Init(&context);
        MD5Update(&context, (char *)&key->data, key->len);
        for (i = 0; i < n_vec; i++) {
+               if (iov[i].iov_len == 0)
+                       continue;
                if (iov[i].iov_base == NULL) {
                        cERROR(1, ("null iovec entry"));
                        return -EIO;
-               } else if (iov[i].iov_len == 0)
-                       break; /* bail out if we are sent nothing to sign */
+               }
                /* The first entry includes a length field (which does not get
                   signed that occupies the first 4 bytes before the header */
                if (i == 0) {
-                       if (iov[0].iov_len <= 8 ) /* cmd field at offset 9 */
+                       if (iov[0].iov_len <= 8) /* cmd field at offset 9 */
                                break; /* nothing to sign or corrupt header */
                        MD5Update(&context, iov[0].iov_base+4,
                                  iov[0].iov_len-4);
@@ -122,7 +123,7 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
 
 
 int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server,
-                  __u32 * pexpected_response_sequence_number)
+                  __u32 *pexpected_response_sequence_number)
 {
        int rc = 0;
        char smb_signature[20];
@@ -293,6 +294,7 @@ void calc_lanman_hash(struct cifsSesInfo *ses, char *lnm_session_key)
 
        if ((ses->server->secMode & SECMODE_PW_ENCRYPT) == 0)
                if (extended_security & CIFSSEC_MAY_PLNTXT) {
+                       memset(lnm_session_key, 0, CIFS_SESS_KEY_SIZE);
                        memcpy(lnm_session_key, password_with_pad,
                                CIFS_ENCPWD_SIZE);
                        return;
@@ -309,9 +311,8 @@ void calc_lanman_hash(struct cifsSesInfo *ses, char *lnm_session_key)
        utf8 and other multibyte codepages each need their own strupper
        function since a byte at a time will ont work. */
 
-       for (i = 0; i < CIFS_ENCPWD_SIZE; i++) {
+       for (i = 0; i < CIFS_ENCPWD_SIZE; i++)
                password_with_pad[i] = toupper(password_with_pad[i]);
-       }
 
        SMBencrypt(password_with_pad, ses->server->cryptKey, lnm_session_key);
        /* clear password before we return/free memory */
@@ -345,7 +346,7 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses,
        user = kmalloc(2 + (len * 2), GFP_KERNEL);
        if (user == NULL)
                goto calc_exit_2;
-       len = cifs_strtoUCS(user, ses->userName, len, nls_cp);
+       len = cifs_strtoUCS((__le16 *)user, ses->userName, len, nls_cp);
        UniStrupr(user);
        hmac_md5_update((char *)user, 2*len, pctxt);
 
@@ -356,7 +357,8 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses,
                domain = kmalloc(2 + (len * 2), GFP_KERNEL);
                if (domain == NULL)
                        goto calc_exit_1;
-               len = cifs_strtoUCS(domain, ses->domainName, len, nls_cp);
+               len = cifs_strtoUCS((__le16 *)domain, ses->domainName, len,
+                                       nls_cp);
                /* the following line was removed since it didn't work well
                   with lower cased domain name that passed as an option.
                   Maybe converting the domain name earlier makes sense */