Re: [PATCH 08/12] crypto: caam - support crypto_engine framework for SKCIPHER algorithms

From: Herbert Xu
Date: Fri Nov 22 2019 - 06:27:05 EST


On Mon, Nov 18, 2019 at 12:30:41AM +0200, Iuliana Prodan wrote:
>
> +static int transfer_request_to_engine(struct crypto_engine *engine,
> + struct crypto_async_request *req)
> +{
> + switch (crypto_tfm_alg_type(req->tfm)) {
> + case CRYPTO_ALG_TYPE_SKCIPHER:
> + return crypto_transfer_skcipher_request_to_engine(engine,
> + skcipher_request_cast(req));
> + default:
> + return -EINVAL;
> + }
> +}

Please don't do this. As you can see the crypto engine interface
wants to you to use the correct type for the request object. That's
what you should do to.

In fact I don't understand why you're only using the crypto engine
for the backlog case. Wouldn't it be much simpler if you used the
engine unconditionally?

Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt