Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Hsieh, Che-Min" <cheminh@qti.qualcomm.com>,
	Garg Vakul-B16394 <B16394@freescale.com>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>
Subject: Re: Questions about the Crypto API
Date: Mon, 12 Aug 2013 10:49:13 -0300	[thread overview]
Message-ID: <20130812134913.GA5173@oc8526070481.ibm.com> (raw)
In-Reply-To: <20130810011541.GA6549@gondor.apana.org.au>

On Sat, Aug 10, 2013 at 11:15:41AM +1000, Herbert Xu wrote:
> On Fri, Aug 09, 2013 at 01:09:12PM +0000, Hsieh, Che-Min wrote:
> > Marcelo/Herbert:
> > 
> > I believe It is. Herbert, please correct me if I am wrong.
> > A single tfm is used as a user context to crypto, so to speak. But a user is not a thread.
> > Let us use ipsec as example.
> > For each security association (SA), it will take up a tfm.
> > Assume I have IP sec setup between my local host and remote host.  I might have two SA's, one for each direction.
> > Now, I might run ping. Simultaneously, I might run iperf. I might run a lot of different things  between these two ip hosts.
> > But only two tfm's are involved.
> > I have seen this happening   in our system with ipsec setup as described above.
> > While an  async request is outstanding in the driver,  another request is  issued to the same driver for the same tfm.
> 
> Yes you're absolutely right.
> 
> Unless I've misunderstood Marcelo's question is different from
> what Garg was asking.
> 
> Marcelo: The tfm, be it blkcipher or ablkcipher can always be used
> in parallel by the user on different CPUs.  For example, IPsec may
> receive two packets on two CPUs through the same SA, in which case
> decryption will be carried out in parallel.

So does that means that it's possible to keep data in the tfm's context
that is the same for a single SA, such as the AES expanded key, but it's
not possible to keep data that is specific for the current operation,
such as an operation state that the driver might require?

Actually I think that probably I have misunderstood the blkcipher
interface, so here it is another question: is each encrypt/decrypt call
a complete operation? I mean, I'm considering that I could always chain
a series of calls to encrypt data in separated chunks, in a similar way
that is done for the hash interface and because that I'm assuming that I
would have to keep state between those calls if the device requires
that.

> 
> Garg: For any tfm, blkcipher or ablkcipher, they must return results
> in the order they were given.  For a blkcipher which is synchronous,
> this is always true by definition since we return only after the
> result has been completed.  For an async ablkcipher, this means that
> if you receive two requests on the same CPU, then the first request
> must be served and completed before the second request's completion
> can be initiated.
> 
> Sorry for any confusion this might have caused.
> 
> Cheers,
> -- 
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
> --
> 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
> 

  reply	other threads:[~2013-08-12 13:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05 20:25 Questions about the Crypto API Marcelo Cerri
2013-08-06  7:00 ` Herbert Xu
2013-08-06 12:05   ` Marcelo Cerri
2013-08-06 14:16     ` Marcelo Cerri
2013-08-08  5:01       ` Herbert Xu
2013-08-08 14:04         ` Hsieh, Che-Min
2013-08-10  1:21           ` Herbert Xu
2013-08-10  2:15             ` Hsieh, Che-Min
2013-08-10  6:17               ` Herbert Xu
2013-08-08  5:02     ` Herbert Xu
2013-08-08 14:50   ` Garg Vakul-B16394
2013-08-09 12:55     ` Marcelo Cerri
     [not found]       ` <A83C99F8370D4D42BEB2D2B3153A6BBC23D55A6E@NASANEXD02C.na.qualcomm.com>
2013-08-10  1:15         ` Herbert Xu
2013-08-12 13:49           ` Marcelo Cerri [this message]
2013-08-13 19:25             ` Hsieh, Che-Min
2013-08-16  6:37               ` Herbert Xu
2013-08-16  6:30             ` 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=20130812134913.GA5173@oc8526070481.ibm.com \
    --to=mhcerri@linux.vnet.ibm.com \
    --cc=B16394@freescale.com \
    --cc=cheminh@qti.qualcomm.com \
    --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