All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
To: Shirish Pargaonkar
	<shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 4/8] ntlmv2/ntlmssp define, declare, and use crypto hash functions
Date: Thu, 09 Sep 2010 22:17:46 +0530	[thread overview]
Message-ID: <4C890FB2.8010007@suse.de> (raw)
In-Reply-To: <AANLkTinAA+5aXp0mO=h4f3TiLrL6PR4Uu_DHw2Ched3J-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 09/09/2010 09:43 PM, Shirish Pargaonkar wrote:
> On Thu, Sep 9, 2010 at 7:00 AM, Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org> wrote:
>> On 09/08/2010 10:15 AM, shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>>> From: Shirish Pargaonkar <shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>>
>>>
>>> Allocate crypto hashing functions, ecurity descriptiors, and respective
>>> contexts when a smb/tcp connection is established.
>>> Release them when a tcp/smb connection is taken down.
>>>
>>> md5 and hmac-md5 are two crypto hashing functions that are used
>>> throught the life of an smb/tcp connection by various functions that
>>> calcualte signagure and ntlmv2 hash, HMAC etc.
>>>
>>>
>>> Signed-off-by: Shirish Pargaonkar <shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>> ---
>>> �fs/cifs/cifsencrypt.c | � 71 +++++++++++++++++++++++++++++++++++++++++++++++++
>>> �fs/cifs/cifsproto.h � | � �2 +
>>> �fs/cifs/connect.c � � | � 16 +++++++++--
>>> �3 files changed, 86 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
>>> index 4bdcf13..4772c4d 100644
>>> --- a/fs/cifs/cifsencrypt.c
>>> +++ b/fs/cifs/cifsencrypt.c
>>> @@ -369,3 +369,74 @@ void CalcNTLMv2_response(const struct cifsSesInfo *ses,
>>> � � � hmac_md5_final(v2_session_response, &context);
>>> �/* � cifs_dump_mem("v2_sess_rsp: ", v2_session_response, 32); */
>>> �}
>>> +
>>> +void
>>> +cifs_crypto_shash_release(struct TCP_Server_Info *server)
>>> +{
>>> + � � if (server->secmech.md5)
>>> + � � � � � � crypto_free_shash(server->secmech.md5);
>>> +
>>> + � � if (server->secmech.hmacmd5)
>>> + � � � � � � crypto_free_shash(server->secmech.hmacmd5);
>>> +
>>> + � � kfree(server->secmech.sdeschmacmd5);
>>> +
>>> + � � kfree(server->secmech.sdescmd5);
>>> +}
>>> +
>>> +int
>>> +cifs_crypto_shash_allocate(struct TCP_Server_Info *server)
>>> +{
>>> + � � int rc;
>>> + � � unsigned int size;
>>> +
>>> + � � server->secmech.hmacmd5 = crypto_alloc_shash("hmac(md5)", 0, 0);
>>> + � � if (!server->secmech.hmacmd5 ||
>>> + � � � � � � � � � � IS_ERR(server->secmech.hmacmd5)) {
>>
>> crypto_alloc_hash() seems to return a pointer to struct crypto_shash.
>> Would it be sufficient to use IS_ERR() to check?
> 
> Suresh, not sure I understand, I check for NULL value of what
> crypto_alloc_shash()
> returns.  IS_ERR() is what crypto code is using.
> Copying crypto folks on the this thread.

I was suggesting to remove the NULL value check as checking for
IS_ERR(server->secmech.hmacmd5 alone can handle NULL cases and is
sufficient.



-- 
Suresh Jayaraman

      parent reply	other threads:[~2010-09-09 16:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-08  4:45 [PATCH 4/8] ntlmv2/ntlmssp define, declare, and use crypto hash functions shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w
     [not found] ` <1283921151-13090-1-git-send-email-shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-09-08 20:00   ` Jeff Layton
2010-09-09 12:00   ` Suresh Jayaraman
2010-09-09 16:13     ` Shirish Pargaonkar
     [not found]       ` <AANLkTinAA+5aXp0mO=h4f3TiLrL6PR4Uu_DHw2Ched3J-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-09 16:47         ` Suresh Jayaraman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C890FB2.8010007@suse.de \
    --to=sjayaraman-l3a5bk7wagm@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-crypto-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.