linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: LABBE Corentin <clabbe.montjoie@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: davem@davemloft.net, baolin.wang@linaro.org,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] crypto: engine: permit to enqueue ashash_request
Date: Thu, 2 Jun 2016 11:12:13 +0200	[thread overview]
Message-ID: <20160602091213.GA2521@Red> (raw)
In-Reply-To: <20160602083258.GB15226@gondor.apana.org.au>

On Thu, Jun 02, 2016 at 04:32:59PM +0800, Herbert Xu wrote:
> On Mon, May 30, 2016 at 03:32:01PM +0200, LABBE Corentin wrote:
> > The current crypto engine allow only ablkcipher_request to be enqueued.
> > Thus denying any use of it for hardware that also handle hash algo.
> > 
> > This patch convert all ablkcipher_request references to the
> > more general crypto_async_request.
> > 
> > Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
> 
> First of all your patches break bisection which is unacceptable.
> 

How do I break bisection ?

> Secondly you should not be casting generic requests to a specific type.
> 
I didnt add any request type check since omap use engine only for ciphers.
My view if usage of crypt_one_request() if hash and ciphers coule be used is to test
crypto_tfm_alg_type(areq->tfm) to check which alg is used (CRYPTO_ALG_TYPE_AHASH vs CRYPTO_ALG_TYPE_ABLKCIPHER)

For example, this is my setted crypt_one_request function:
int handle_request(struct crypto_engine *engine, struct crypto_async_request *areq)
{
        int rtype;
        struct ahash_request *hreq;
        struct ablkcipher_request *breq;
        int err = -EINVAL;
        rtype = crypto_tfm_alg_type(areq->tfm);
        switch (rtype) {
        case CRYPTO_ALG_TYPE_AHASH:
                hreq = ahash_request_cast(areq);
                err = sun4i_ss_hash(hreq);
                break;
        case CRYPTO_ALG_TYPE_ABLKCIPHER:
                breq = ablkcipher_request_cast(areq);
                err = sun4i_ss_cipher(breq);
        }
        crypto_finalize_request(engine, areq, err);
        return 0;
}


> Assuming a single engine only has to deal with one type of requests,
> what you could do is to create a separate engine type for each
> crypto type that you want to support.
> 

So, if my hwcrypto can handle hash and ciphers, I need to have two engine and each crypt_one_request()/hash_one_request()
need to lock the engine.
Having only one engine that handle all types permit to avoid this locking.

Regards

  reply	other threads:[~2016-06-02  9:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30 13:32 [PATCH v2 0/2] crypto: engine: permit to enqueue ashash_request LABBE Corentin
2016-05-30 13:32 ` [PATCH v2 1/2] " LABBE Corentin
2016-06-01  2:27   ` Baolin Wang
2016-06-02  8:32   ` Herbert Xu
2016-06-02  9:12     ` LABBE Corentin [this message]
2016-06-02  9:19       ` Herbert Xu
2016-06-02  9:38         ` LABBE Corentin
2016-06-02  9:42           ` Herbert Xu
2016-05-30 13:32 ` [PATCH v2 2/2] crypto: omap: convert to the new cryptoengine API LABBE Corentin
2016-06-01  2:28   ` Baolin Wang

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=20160602091213.GA2521@Red \
    --to=clabbe.montjoie@gmail.com \
    --cc=baolin.wang@linaro.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@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).