diff options
author | Shirish Pargaonkar <shirishpargaonkar@gmail.com> | 2010-09-18 23:01:58 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-09-29 15:04:29 -0400 |
commit | 5f98ca9afb9c004f8948c0d40920503de447918a (patch) | |
tree | b9b59bb6a8226925c42c8bbbef85de95e86a9133 /fs/cifs/cifsencrypt.c | |
parent | aa91c7e4ab9b0842b7d7a7cbf8cca18b20df89b5 (diff) |
cifs NTLMv2/NTLMSSP Change variable name mac_key to session key to reflect the key it holds
Change name of variable mac_key to session key.
The reason mac_key was changed to session key is, this structure does not
hold message authentication code, it holds the session key (for ntlmv2,
ntlmv1 etc.). mac is generated as a signature in cifs_calc* functions.
Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsencrypt.c')
-rw-r--r-- | fs/cifs/cifsencrypt.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 35042d8f7338..eed70cae1275 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -42,7 +42,7 @@ extern void SMBencrypt(unsigned char *passwd, const unsigned char *c8, | |||
42 | unsigned char *p24); | 42 | unsigned char *p24); |
43 | 43 | ||
44 | static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu, | 44 | static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu, |
45 | const struct mac_key *key, char *signature) | 45 | const struct session_key *key, char *signature) |
46 | { | 46 | { |
47 | struct MD5Context context; | 47 | struct MD5Context context; |
48 | 48 | ||
@@ -78,7 +78,7 @@ int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server, | |||
78 | server->sequence_number++; | 78 | server->sequence_number++; |
79 | spin_unlock(&GlobalMid_Lock); | 79 | spin_unlock(&GlobalMid_Lock); |
80 | 80 | ||
81 | rc = cifs_calculate_signature(cifs_pdu, &server->mac_signing_key, | 81 | rc = cifs_calculate_signature(cifs_pdu, &server->session_key, |
82 | smb_signature); | 82 | smb_signature); |
83 | if (rc) | 83 | if (rc) |
84 | memset(cifs_pdu->Signature.SecuritySignature, 0, 8); | 84 | memset(cifs_pdu->Signature.SecuritySignature, 0, 8); |
@@ -89,7 +89,7 @@ int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server, | |||
89 | } | 89 | } |
90 | 90 | ||
91 | static int cifs_calc_signature2(const struct kvec *iov, int n_vec, | 91 | static int cifs_calc_signature2(const struct kvec *iov, int n_vec, |
92 | const struct mac_key *key, char *signature) | 92 | const struct session_key *key, char *signature) |
93 | { | 93 | { |
94 | struct MD5Context context; | 94 | struct MD5Context context; |
95 | int i; | 95 | int i; |
@@ -145,7 +145,7 @@ int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, | |||
145 | server->sequence_number++; | 145 | server->sequence_number++; |
146 | spin_unlock(&GlobalMid_Lock); | 146 | spin_unlock(&GlobalMid_Lock); |
147 | 147 | ||
148 | rc = cifs_calc_signature2(iov, n_vec, &server->mac_signing_key, | 148 | rc = cifs_calc_signature2(iov, n_vec, &server->session_key, |
149 | smb_signature); | 149 | smb_signature); |
150 | if (rc) | 150 | if (rc) |
151 | memset(cifs_pdu->Signature.SecuritySignature, 0, 8); | 151 | memset(cifs_pdu->Signature.SecuritySignature, 0, 8); |
@@ -156,14 +156,14 @@ int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, | |||
156 | } | 156 | } |
157 | 157 | ||
158 | int cifs_verify_signature(struct smb_hdr *cifs_pdu, | 158 | int cifs_verify_signature(struct smb_hdr *cifs_pdu, |
159 | const struct mac_key *mac_key, | 159 | const struct session_key *session_key, |
160 | __u32 expected_sequence_number) | 160 | __u32 expected_sequence_number) |
161 | { | 161 | { |
162 | unsigned int rc; | 162 | unsigned int rc; |
163 | char server_response_sig[8]; | 163 | char server_response_sig[8]; |
164 | char what_we_think_sig_should_be[20]; | 164 | char what_we_think_sig_should_be[20]; |
165 | 165 | ||
166 | if ((cifs_pdu == NULL) || (mac_key == NULL)) | 166 | if (cifs_pdu == NULL || session_key == NULL) |
167 | return -EINVAL; | 167 | return -EINVAL; |
168 | 168 | ||
169 | if (cifs_pdu->Command == SMB_COM_NEGOTIATE) | 169 | if (cifs_pdu->Command == SMB_COM_NEGOTIATE) |
@@ -192,7 +192,7 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu, | |||
192 | cpu_to_le32(expected_sequence_number); | 192 | cpu_to_le32(expected_sequence_number); |
193 | cifs_pdu->Signature.Sequence.Reserved = 0; | 193 | cifs_pdu->Signature.Sequence.Reserved = 0; |
194 | 194 | ||
195 | rc = cifs_calculate_signature(cifs_pdu, mac_key, | 195 | rc = cifs_calculate_signature(cifs_pdu, session_key, |
196 | what_we_think_sig_should_be); | 196 | what_we_think_sig_should_be); |
197 | 197 | ||
198 | if (rc) | 198 | if (rc) |
@@ -209,7 +209,7 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu, | |||
209 | } | 209 | } |
210 | 210 | ||
211 | /* We fill in key by putting in 40 byte array which was allocated by caller */ | 211 | /* We fill in key by putting in 40 byte array which was allocated by caller */ |
212 | int cifs_calculate_mac_key(struct mac_key *key, const char *rn, | 212 | int cifs_calculate_session_key(struct session_key *key, const char *rn, |
213 | const char *password) | 213 | const char *password) |
214 | { | 214 | { |
215 | char temp_key[16]; | 215 | char temp_key[16]; |
@@ -347,11 +347,11 @@ void setup_ntlmv2_rsp(struct cifsSesInfo *ses, char *resp_buf, | |||
347 | /* now calculate the MAC key for NTLMv2 */ | 347 | /* now calculate the MAC key for NTLMv2 */ |
348 | hmac_md5_init_limK_to_64(ses->server->ntlmv2_hash, 16, &context); | 348 | hmac_md5_init_limK_to_64(ses->server->ntlmv2_hash, 16, &context); |
349 | hmac_md5_update(resp_buf, 16, &context); | 349 | hmac_md5_update(resp_buf, 16, &context); |
350 | hmac_md5_final(ses->server->mac_signing_key.data.ntlmv2.key, &context); | 350 | hmac_md5_final(ses->server->session_key.data.ntlmv2.key, &context); |
351 | 351 | ||
352 | memcpy(&ses->server->mac_signing_key.data.ntlmv2.resp, resp_buf, | 352 | memcpy(&ses->server->session_key.data.ntlmv2.resp, resp_buf, |
353 | sizeof(struct ntlmv2_resp)); | 353 | sizeof(struct ntlmv2_resp)); |
354 | ses->server->mac_signing_key.len = 16 + sizeof(struct ntlmv2_resp); | 354 | ses->server->session_key.len = 16 + sizeof(struct ntlmv2_resp); |
355 | } | 355 | } |
356 | 356 | ||
357 | void CalcNTLMv2_response(const struct cifsSesInfo *ses, | 357 | void CalcNTLMv2_response(const struct cifsSesInfo *ses, |