[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fe251307-ba89-a4bc-23f5-205a1e1343ea@nxp.com>
Date: Tue, 11 Aug 2020 17:30:41 +0300
From: Horia Geantă <horia.geanta@....com>
To: "Andrei Botila (OSS)" <andrei.botila@....nxp.com>,
Aymen Sghaier <aymen.sghaier@....com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>
Cc: "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RESEND 1/9] crypto: caam/jr - add fallback for XTS with
more than 8B IV
On 8/6/2020 7:36 PM, Andrei Botila (OSS) wrote:
> @@ -3344,12 +3382,30 @@ static int caam_cra_init(struct crypto_skcipher *tfm)
> struct caam_skcipher_alg *caam_alg =
> container_of(alg, typeof(*caam_alg), skcipher);
> struct caam_ctx *ctx = crypto_skcipher_ctx(tfm);
> + u32 alg_aai = caam_alg->caam.class1_alg_type & OP_ALG_AAI_MASK;
>
> crypto_skcipher_set_reqsize(tfm, sizeof(struct caam_skcipher_req_ctx));
This is being called twice in case of XTS.
>
> ctx->enginectx.op.do_one_request = skcipher_do_one_req;
>
> - return caam_init_common(crypto_skcipher_ctx(tfm), &caam_alg->caam,
> + if (alg_aai == OP_ALG_AAI_XTS) {
> + const char *tfm_name = crypto_tfm_alg_name(&tfm->base);
> + struct crypto_skcipher *fallback;
> +
> + fallback = crypto_alloc_skcipher(tfm_name, 0,
> + CRYPTO_ALG_NEED_FALLBACK);
Driver should select CRYPTO_XTS, such that at least the generic
xts implementation is available.
> + if (IS_ERR(fallback)) {
> + pr_err("Failed to allocate %s fallback: %ld\n",
> + tfm_name, PTR_ERR(fallback));
> + return PTR_ERR(fallback);
Shouldn't error out so early. It might be that the fallback won't be needed.
Let's postpone this until we're sure fallback is required.
Horia
Powered by blists - more mailing lists