Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp304128ybi; Sat, 15 Jun 2019 01:18:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyx5srFU+DBe/gnqefscifEp8Nc0C6rpRGuMdZ8uYdX4O7Xnc65nWOk1dKT5rGXOEMhFiJ0 X-Received: by 2002:a17:90a:9f0b:: with SMTP id n11mr14853177pjp.98.1560586712335; Sat, 15 Jun 2019 01:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560586712; cv=none; d=google.com; s=arc-20160816; b=cRtLJEM7NwALl3ZdswL/T5NMFnjgjaax9SIuxbUvna//0agLYSMnfw9/EDlUW2aSa4 B8GtybfpgZsGYLqv8iLHGg5RF9Ic8ws/avd/3Phi/l/8QOMnXfbK80sbjoFtF7q6RM6i 8Gut0S6DTeepE0Z2R7Yg0d1MMx6l+CJIYoUtbhMGvhpepg+Yr13lY3zSfZnhPBhLV/y6 DS9gSpUZs2mklMA+AmSKpfD8W+WPVpVmaO3YbNgwo2YzxoImn+BJ9FXvU5t8PUbQkHRh 8CgqM4eeXiosqY6aessiX32ASLXpkYFAkHwbRatVTBdGjGtKhDftks9VxtFR6KxVsuFM l9lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=+Zco0FR9mmqB3Bll/AYl3OOsNrGQR4TrxurFLcfKqYQ=; b=iOXwEKvnXTuHiMA9uRQDDT9fm0UghAJHtx6EvjV3rW30LZHpi+/GbjS6Fv6Tw0LE/7 OZHUHBXbWiky6WN17/vBMtfXVb+QmfltHtSl2sZg/jsZOncWOa2VNbQ3barE8TCXGWdZ lKuW7nnIm7/4XTaNYwJGSZdoMcugURciH5Ohp1M4ps4vHo72cYxaX0KVq7PP1DgX9iIq MGjE82CFTc4dA/8AN86n9z4Ait1T4T5FLMS0KWiTHjeapaVXwmQZNLsQYBXbjNvu1hyr qbFAtVf9U0xdxcVAoWK1zoihtmDsKmi3xLYVLtcjriXDmNmMKWmFm5wyWfRcJ/ZywiY1 xIag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b="S/HGbpHT"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si4494295pjn.44.2019.06.15.01.18.13; Sat, 15 Jun 2019 01:18:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b="S/HGbpHT"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726115AbfFOISK (ORCPT + 99 others); Sat, 15 Jun 2019 04:18:10 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:56048 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725825AbfFOISJ (ORCPT ); Sat, 15 Jun 2019 04:18:09 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 45Qr2Q4R0Yz9v0Dw; Sat, 15 Jun 2019 10:18:06 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=S/HGbpHT; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id sapXI2Lu1-d5; Sat, 15 Jun 2019 10:18:06 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 45Qr2Q2t64z9v0Dk; Sat, 15 Jun 2019 10:18:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1560586686; bh=+Zco0FR9mmqB3Bll/AYl3OOsNrGQR4TrxurFLcfKqYQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=S/HGbpHTpbiPjpxKnfGawh1W0KnxaGu2okWAzbwWln7hJjfGK8J0BaGEsZJ9KK+oe cpxxNcwCu10adPTu3ZeKimZC24Qg14UlA20Iai4/FBlyMbUpCwWgdbsC8cmITBMZUX yqCKNNY3JpKWsyfcNcoVVS2GkvW59SX/ypVnzbZ0= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6BFB38B7B3; Sat, 15 Jun 2019 10:18:07 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id D6B_beVqunfZ; Sat, 15 Jun 2019 10:18:07 +0200 (CEST) Received: from PO15451 (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BFCD58B77A; Sat, 15 Jun 2019 10:18:06 +0200 (CEST) Subject: Re: [PATCH v3 2/4] crypto: talitos - fix hash on SEC1. To: Horia Geanta , Herbert Xu , "David S. Miller" Cc: "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" References: <732ca0ff440bf4cd589d844cfda71d96efd500f5.1560429844.git.christophe.leroy@c-s.fr> From: Christophe Leroy Message-ID: Date: Sat, 15 Jun 2019 10:18:06 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >