From patchwork Wed Sep 8 04:44:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 162831 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o884ktFH003235 for ; Wed, 8 Sep 2010 04:49:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751241Ab0IHEtT (ORCPT ); Wed, 8 Sep 2010 00:49:19 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:48534 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751167Ab0IHEtS (ORCPT ); Wed, 8 Sep 2010 00:49:18 -0400 Received: by iwn5 with SMTP id 5so5990822iwn.19 for ; Tue, 07 Sep 2010 21:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=aHs+Bt0fg1ihe2dXSE3hfFqd6b9/pZxWMf+FGxKVfqM=; b=RmWz0TrZIEwFLBtIrsgI+TJtX1O4VFV4lmBGZsXuQeOutrEwNXkRq1hIkBDn0Lpo86 GjApbGRwXB1pshrR3XqqRT3YJzbqxK/PQJXA0RaRJcMr7uOlt5P85DCKE5KheMqjdmRC znTij0iKKi0RiyX5HE2ete5iFDc2bNbRjLqpQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=dKOEuyuPoAHQxN1+tW5FaP8WHNWxicDL7LQbzP6EnQzpyG4R4Qzo3fV0mXYI5Zol8S pOpNaDmSIWagiUiWHglc4nGChchoTdY+iaVWfZVq1y/VdhQnNpy0RqW8v2r2suSoFRkJ E/J/Upod2B3XZtKR2UV7X5AISyievu9suv9Dw= Received: by 10.231.171.18 with SMTP id f18mr9218797ibz.9.1283921358169; Tue, 07 Sep 2010 21:49:18 -0700 (PDT) Received: from localhost ([32.97.110.58]) by mx.google.com with ESMTPS id r3sm7866189ibk.13.2010.09.07.21.49.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 07 Sep 2010 21:49:17 -0700 (PDT) From: shirishpargaonkar@gmail.com To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, Shirish Pargaonkar Subject: [PATCH 2/8] ntlmv2/ntlmssp remove-unused-function CalcNTLMv2_partial_mac_key Date: Tue, 7 Sep 2010 23:44:42 -0500 Message-Id: <1283921082-13019-1-git-send-email-shirishpargaonkar@gmail.com> X-Mailer: git-send-email 1.6.0.2 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 08 Sep 2010 04:49:19 +0000 (UTC) diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 796ebc7..4bdcf13 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c @@ -224,63 +224,6 @@ int cifs_calculate_mac_key(struct session_key *key, const char *rn, return 0; } -int CalcNTLMv2_partial_mac_key(struct cifsSesInfo *ses, - const struct nls_table *nls_info) -{ - char temp_hash[16]; - struct HMACMD5Context ctx; - char *ucase_buf; - __le16 *unicode_buf; - unsigned int i, user_name_len, dom_name_len; - - if (ses == NULL) - return -EINVAL; - - E_md4hash(ses->password, temp_hash); - - hmac_md5_init_limK_to_64(temp_hash, 16, &ctx); - user_name_len = strlen(ses->userName); - if (user_name_len > MAX_USERNAME_SIZE) - return -EINVAL; - if (ses->domainName == NULL) - return -EINVAL; /* BB should we use CIFS_LINUX_DOM */ - dom_name_len = strlen(ses->domainName); - if (dom_name_len > MAX_USERNAME_SIZE) - return -EINVAL; - - ucase_buf = kmalloc((MAX_USERNAME_SIZE+1), GFP_KERNEL); - if (ucase_buf == NULL) - return -ENOMEM; - unicode_buf = kmalloc((MAX_USERNAME_SIZE+1)*4, GFP_KERNEL); - if (unicode_buf == NULL) { - kfree(ucase_buf); - return -ENOMEM; - } - - for (i = 0; i < user_name_len; i++) - ucase_buf[i] = nls_info->charset2upper[(int)ses->userName[i]]; - ucase_buf[i] = 0; - user_name_len = cifs_strtoUCS(unicode_buf, ucase_buf, - MAX_USERNAME_SIZE*2, nls_info); - unicode_buf[user_name_len] = 0; - user_name_len++; - - for (i = 0; i < dom_name_len; i++) - ucase_buf[i] = nls_info->charset2upper[(int)ses->domainName[i]]; - ucase_buf[i] = 0; - dom_name_len = cifs_strtoUCS(unicode_buf+user_name_len, ucase_buf, - MAX_USERNAME_SIZE*2, nls_info); - - unicode_buf[user_name_len + dom_name_len] = 0; - hmac_md5_update((const unsigned char *) unicode_buf, - (user_name_len+dom_name_len)*2, &ctx); - - hmac_md5_final(ses->server->ntlmv2_hash, &ctx); - kfree(ucase_buf); - kfree(unicode_buf); - return 0; -} - #ifdef CONFIG_CIFS_WEAK_PW_HASH void calc_lanman_hash(const char *password, const char *cryptkey, bool encrypt, char *lnm_session_key) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 8d63406..eadf78c 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -365,8 +365,6 @@ extern int cifs_verify_signature(struct smb_hdr *, __u32 expected_sequence_number); extern int cifs_calculate_mac_key(struct session_key *key, const char *rn, const char *pass); -extern int CalcNTLMv2_partial_mac_key(struct cifsSesInfo *, - const struct nls_table *); extern void CalcNTLMv2_response(const struct cifsSesInfo *, char *); extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *, const struct nls_table *);