All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dimitrios Siganos <dimitris@siganos.org>
To: linux-crypto@vger.kernel.org
Subject: Re: hmac(sha1)
Date: Wed, 03 Mar 2010 20:17:04 +0000	[thread overview]
Message-ID: <4B8EC3C0.60502@siganos.org> (raw)
In-Reply-To: <4B8DD78D.6080707@siganos.org>

Dimitrios Siganos wrote:
> Hi,
>
> I am trying to write a hmac(sha1) algorithm and I have a few 
> questions. I have a HW crypto accelerator that does the actual crypto 
> work. I have already successfully implemented sha1 by creating a 
> CRYPTO_ALG_TYPE_DIGEST algorithm.
>
> 1) Can I implement hmac(sha1) as a CRYPTO_ALG_TYPE_DIGEST algorithm 
> (i.e. use very similar code to sha1)?
>
> 2) Do I need to create a CRYPTO_ALG_TYPE_HASH algorithm?
>
> 3) Is it possible to implement hmac(sha1) as both 
> CRYPTO_ALG_TYPE_DIGEST and CRYPTO_ALG_TYPE_HASH?
>
> 4) If I use a CRYPTO_ALG_TYPE_HASH, I need to understand the 
> scatterwalk api, is there any help on the subject?
>
> Regards,
> Dimitris
>
> -- 
> To unsubscribe from this list: send the line "unsubscribe 
> linux-crypto" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
The answer to 1) is yes because I just did it and seems to work. 
Therefore the answer is to 2) is: No, it is not needed.

I believe the answer to 3) is: yes. I believe it is possible to 
implement hmac(sha1) as both CRYPTO_ALG_TYPE_DIGEST and 
CRYPTO_ALG_TYPE_HASH.

I would like to implement hmac(sha1) as a CRYPTO_ALG_TYPE_HASH but I do 
yet understand how to convert the scatterlists into virtual addresses. 
The HW crypto api that I use, hides the DMA details from me and expects 
me to pass it virtual addresses only. I can't see any examples of 
converting scatterlists to virtual addresses in a way that is safe for 
IPsec use (i.e. safe to be called from softirq context). Any help on 
this will be appreciated.

The ultimate goal of the project is to implement a authenc(hmac(sha1), 
cbc(aes)) algorithm (for IPsec use) that will offload the work to a HW 
crypto chip. In order to understand what I am doing, I am building 
slowly upwards. I have build aes as a CIPHER, cbc(aes) as a BLKCIPHER, 
sha1 as a digest and hmac(sha1) as a digest.

My next steps are to implement cbc(aes) using ABLKCIPHER and hmac(sha1) 
using HASH and AHASH. I am using linux version 2.6.28. I can see that 
the talitos driver implements algorithms at the authenc level but I 
don't completely understand the driver and I am hoping that after going 
through the exercise of building the smaller blocks I will understand 
the operation of the talitos driver.

Any help, especially pointers to relevant documentation or examples, 
will be appreciated.

Dimitris

  reply	other threads:[~2010-03-03 20:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-03  3:29 hmac(sha1) Dimitrios Siganos
2010-03-03 20:17 ` Dimitrios Siganos [this message]
2010-03-03 22:59   ` hmac(sha1) Kim Phillips
2010-03-05  7:32 ` hmac(sha1) Herbert Xu
2010-03-05 16:17   ` hmac(sha1) Dimitrios Siganos
2010-03-09  3:08     ` hmac(sha1) Herbert Xu
2010-03-10  2:48       ` hmac(sha1) Dimitrios Siganos
2010-03-10  4:05         ` hmac(sha1) Herbert Xu

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=4B8EC3C0.60502@siganos.org \
    --to=dimitris@siganos.org \
    --cc=linux-crypto@vger.kernel.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.