smb3.1.1: rename nonces used for GCM and CCM encryption
[linux-2.6-microblaze.git] / fs / cifs / smb2ops.c
index 5f3b6e7..dd1edab 100644 (file)
@@ -2354,6 +2354,17 @@ smb2_is_session_expired(char *buf)
        return true;
 }
 
+static bool
+smb2_is_status_io_timeout(char *buf)
+{
+       struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)buf;
+
+       if (shdr->Status == STATUS_IO_TIMEOUT)
+               return true;
+       else
+               return false;
+}
+
 static int
 smb2_oplock_response(struct cifs_tcon *tcon, struct cifs_fid *fid,
                     struct cifsInodeInfo *cinode)
@@ -3810,9 +3821,9 @@ fill_transform_hdr(struct smb2_transform_hdr *tr_hdr, unsigned int orig_len,
        tr_hdr->OriginalMessageSize = cpu_to_le32(orig_len);
        tr_hdr->Flags = cpu_to_le16(0x01);
        if (cipher_type == SMB2_ENCRYPTION_AES128_GCM)
-               get_random_bytes(&tr_hdr->Nonce, SMB3_AES128GCM_NONCE);
+               get_random_bytes(&tr_hdr->Nonce, SMB3_AES_GCM_NONCE);
        else
-               get_random_bytes(&tr_hdr->Nonce, SMB3_AES128CCM_NONCE);
+               get_random_bytes(&tr_hdr->Nonce, SMB3_AES_CCM_NONCE);
        memcpy(&tr_hdr->SessionId, &shdr->SessionId, 8);
 }
 
@@ -3982,10 +3993,10 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst,
        }
 
        if (server->cipher_type == SMB2_ENCRYPTION_AES128_GCM)
-               memcpy(iv, (char *)tr_hdr->Nonce, SMB3_AES128GCM_NONCE);
+               memcpy(iv, (char *)tr_hdr->Nonce, SMB3_AES_GCM_NONCE);
        else {
                iv[0] = 3;
-               memcpy(iv + 1, (char *)tr_hdr->Nonce, SMB3_AES128CCM_NONCE);
+               memcpy(iv + 1, (char *)tr_hdr->Nonce, SMB3_AES_CCM_NONCE);
        }
 
        aead_request_set_crypt(req, sg, sg, crypt_len, iv);
@@ -4817,6 +4828,7 @@ struct smb_version_operations smb20_operations = {
        .make_node = smb2_make_node,
        .fiemap = smb3_fiemap,
        .llseek = smb3_llseek,
+       .is_status_io_timeout = smb2_is_status_io_timeout,
 };
 
 struct smb_version_operations smb21_operations = {
@@ -4917,6 +4929,7 @@ struct smb_version_operations smb21_operations = {
        .make_node = smb2_make_node,
        .fiemap = smb3_fiemap,
        .llseek = smb3_llseek,
+       .is_status_io_timeout = smb2_is_status_io_timeout,
 };
 
 struct smb_version_operations smb30_operations = {
@@ -5027,6 +5040,7 @@ struct smb_version_operations smb30_operations = {
        .make_node = smb2_make_node,
        .fiemap = smb3_fiemap,
        .llseek = smb3_llseek,
+       .is_status_io_timeout = smb2_is_status_io_timeout,
 };
 
 struct smb_version_operations smb311_operations = {
@@ -5138,6 +5152,7 @@ struct smb_version_operations smb311_operations = {
        .make_node = smb2_make_node,
        .fiemap = smb3_fiemap,
        .llseek = smb3_llseek,
+       .is_status_io_timeout = smb2_is_status_io_timeout,
 };
 
 struct smb_version_values smb20_values = {