From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Horia Geanta <horia.geanta@nxp.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 2/4] crypto: talitos - fix hash on SEC1.
Date: Sat, 15 Jun 2019 10:18:06 +0200 [thread overview]
Message-ID: <e98f196d-a47c-f2ae-e729-fe2613628da7@c-s.fr> (raw)
In-Reply-To: <VI1PR0402MB34855C37F53DC1012DAF670798EE0@VI1PR0402MB3485.eurprd04.prod.outlook.com>
Le 14/06/2019 à 13:32, Horia Geanta a écrit :
> On 6/13/2019 3:48 PM, Christophe Leroy wrote:
>> @@ -336,15 +336,18 @@ static void flush_channel(struct device *dev, int ch, int error, int reset_ch)
>> tail = priv->chan[ch].tail;
>> while (priv->chan[ch].fifo[tail].desc) {
>> __be32 hdr;
>> + struct talitos_edesc *edesc;
>>
>> request = &priv->chan[ch].fifo[tail];
>> + edesc = container_of(request->desc, struct talitos_edesc, desc);
> Not needed for all cases, should be moved to the block that uses it.
Ok.
>
>>
>> /* descriptors with their done bits set don't get the error */
>> rmb();
>> if (!is_sec1)
>> hdr = request->desc->hdr;
>> else if (request->desc->next_desc)
>> - hdr = (request->desc + 1)->hdr1;
>> + hdr = ((struct talitos_desc *)
>> + (edesc->buf + edesc->dma_len))->hdr1;
>> else
>> hdr = request->desc->hdr1;
>>
> [snip]
>> @@ -2058,7 +2065,18 @@ static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes)
>> sg_copy_to_buffer(areq->src, nents,
>> ctx_buf + req_ctx->nbuf, offset);
>> req_ctx->nbuf += offset;
>> - req_ctx->psrc = areq->src;
>> + for (sg = areq->src; sg && offset >= sg->length;
>> + offset -= sg->length, sg = sg_next(sg))
>> + ;
>> + if (offset) {
>> + sg_init_table(req_ctx->bufsl, 2);
>> + sg_set_buf(req_ctx->bufsl, sg_virt(sg) + offset,
>> + sg->length - offset);
>> + sg_chain(req_ctx->bufsl, 2, sg_next(sg));
>> + req_ctx->psrc = req_ctx->bufsl;
> Isn't this what scatterwalk_ffwd() does?
Thanks for pointing this, I wasn't aware of that function. Looking at it
it seems to do the same. Unfortunately, some tests fails with 'wrong
result' when using it instead.
Comparing the results of scatterwalk_ffwd() with what I get with my open
codying, I see the following difference:
scatterwalk_ffwd() uses sg_page(sg) + sg->offset + len
while my open codying results in virt_to_page(sg_virt(sg) + len)
When sg->offset + len is greater than PAGE_SIZE, the resulting SG entry
is different allthough valid in both cases. I think this difference
results in sg_copy_to_buffer() failing. I'm still investigating. Any idea ?
Christophe
>
> Horia
>
next prev parent reply other threads:[~2019-06-15 8:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-13 12:48 [PATCH v3 0/4] Additional fixes on Talitos driver Christophe Leroy
2019-06-13 12:48 ` [PATCH v3 1/4] crypto: talitos - move struct talitos_edesc into talitos.h Christophe Leroy
2019-06-13 12:50 ` Christophe Leroy
2019-06-13 12:48 ` [PATCH v3 2/4] crypto: talitos - fix hash on SEC1 Christophe Leroy
2019-06-13 19:07 ` Horia Geanta
2019-06-14 7:57 ` Christophe Leroy
2019-06-14 11:32 ` Horia Geanta
2019-06-15 8:18 ` Christophe Leroy [this message]
2019-06-15 8:37 ` Issue with sg_copy_to_buffer() ? (was Re: [PATCH v3 2/4] crypto: talitos - fix hash on SEC1.) Christophe Leroy
2019-06-13 12:48 ` [PATCH v3 3/4] crypto: talitos - eliminate unneeded 'done' functions at build time Christophe Leroy
2019-06-13 12:48 ` [PATCH v3 4/4] crypto: talitos - drop icv_ool Christophe Leroy
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=e98f196d-a47c-f2ae-e729-fe2613628da7@c-s.fr \
--to=christophe.leroy@c-s.fr \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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