linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Hartley <james.hartley@imgtec.com>
To: James Hartley <james.hartley@imgtec.com>,
	<herbert@gondor.apana.org.au>,
	Andrew Bresticker <abrestic@chromium.org>,
	Ezequiel Garcia <Ezequiel.Garcia@imgtec.com>,
	<linux-crypto@vger.kernel.org>
Subject: Re: [PATCH V2 1/2] crypto: Add Imagination Technologies hw hash accelerator
Date: Wed, 28 Jan 2015 00:29:29 +0000	[thread overview]
Message-ID: <54C82D69.9070200@imgtec.com> (raw)
In-Reply-To: <54C826EC.8050103@imgtec.com>

On 01/28/15 00:01, James Hartley wrote:
>
> > > +struct img_hash_request_ctx {
> > > +    struct img_hash_dev    *hdev;
> > > +    u8 digest[SHA256_DIGEST_SIZE] __aligned(sizeof(u32));
> > > +    unsigned long        flags;
> > > +    size_t            digsize;
> > > +
> > > +    dma_addr_t        dma_addr;
> > > +    size_t            dma_ct;
> > > +
> > > +    /* sg root */
> > > +    struct scatterlist    *sgfirst;
> > > +    /* walk state */
> > > +    struct scatterlist    *sg;
> > > +    size_t            nents;
> > > +    size_t            offset;
> > > +    unsigned int        total;
> > > +    size_t            sent;
> > > +
> > > +    unsigned long        op;
> > > +
> > > +    size_t            bufcnt;
> > > +    u8 buffer[0] __aligned(sizeof(u32)); };
> >
> > Unfortunately this is not consistent with our API since you're not 
> storing the
> > non-final hash state in the request context.
> >
> > It appears that you're finalising every request.  That means you can 
> only
> > implement finup and digest.  With finup you'll also need to be able 
> to import
> > a non-final hash state.  If the hardware cannot do that then you can 
> only
> > implement digest.
> >
> > Everything else would have to be done by a fallback driver.
> >
> > So the question is can you obtain the non-final hash state from the 
> hardware
> > and then reinsert it for the next operation?
>
> I've looked into this and unfortunately the hardware cannot do that.  
> I'll spend some
> time looking into what this means (I'm not the author of the driver, 
> so will need to
> become a bit more familiar with it).
>
Hi Herbert,

Firstly apologies that there have been quite a few weeks since we last 
discussed this driver!

I understand that because the HW does not support an initial hash state, 
I can only implement digest, and not init, update and final. You 
mentioned that I would have to do everything else using a fallback 
driver - but I'm not clear on:

- If it is mandatory to impement a fallback driver (because the 
potential users of the framework would not know only digest is supported?)
- or can I just remove the support for init update and final?

If I need to implement fallback drivers, would the Niagra2 SPU driver be 
a good reference 
http://lxr.free-electrons.com/source/drivers/crypto/n2_core.c ?

Thanks,
James

       reply	other threads:[~2015-01-28  0:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <54C826EC.8050103@imgtec.com>
2015-01-28  0:29 ` James Hartley [this message]
2015-01-28  0:56   ` [PATCH V2 1/2] crypto: Add Imagination Technologies hw hash accelerator Herbert Xu
2015-01-28 19:19     ` James Hartley
2014-11-18 20:48 [PATCH V2 0/2] crypto: Add support for the IMG " James Hartley
2014-11-18 20:48 ` [PATCH V2 1/2] crypto: Add Imagination Technologies hw " James Hartley
2014-11-20 14:22   ` Herbert Xu
2014-11-24 17:22     ` James Hartley

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=54C82D69.9070200@imgtec.com \
    --to=james.hartley@imgtec.com \
    --cc=Ezequiel.Garcia@imgtec.com \
    --cc=abrestic@chromium.org \
    --cc=herbert@gondor.apana.org.au \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).