Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp961135ybm; Tue, 21 May 2019 06:35:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWrCvGO68tdKpIiL6tKX3Sk76dwaYr6zGu5xlfizSfATylyU2RsmU7pfKO1rPgl461Co3N X-Received: by 2002:aa7:87d7:: with SMTP id i23mr86739935pfo.211.1558445754683; Tue, 21 May 2019 06:35:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558445754; cv=none; d=google.com; s=arc-20160816; b=UtdD4EqpdC5Z0eYF5EjSyJEQFACqW/yH8A4A2PU5Otp1+udVwJnp6bLJwuR8g1QoRn evEpXj38NZfd/yDbYt3NiVsw45tOPW4BnNG5ufv1Q5CA5tg01PL3QzfEFLp2Nvjc02X2 l//VZ+hnpsOtJA763iH2bRNKo9HOXQToLFW230k0dX+t6oBw8+KG2PgqSTpOAfB7hmTJ s7vXCHvBgl82FO2KFeS8FYQLgAyr9ZocXynw7PD6Qovuqs7zKG8m8YVS+H/4BadkFlk6 4BUL0NVi9r6xzKm/KQrqQD5bXz3Dnsxx5uPGFnahfjWjOSc3qhdOw6pSW4j+O2r0i0ey tnig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=TcuJ+OElTRYibwxTdLgf+9A9AnKmYb54DTdEQjLJFJo=; b=qaVobGIY2GEYdGSrtjDaBIfPB2vbiyPA3FeiHg5WmPTY4IHpArf25+YFUwr6cLE7jn DgTLGYvbd9xhEj5v2LQvY26BhY5RdbERjXq2uF1N1jXtedaCbMRGPlvBoHT/ikx2o83o HURS3czdSf2WqqfnRSkYl4f+hs5/hrkP1193V3i3yaH+jgEpehlazmOf6Pr1QnqwG4Q0 Dr8taTVUh3LegCgtjGSpmq2BFev5Y/edtWhHwHILCzD5bnKtCuVq+XnZklw4FJoEUb3U RKhbaIk/VS+suGn7gZpLhJQUx6XR3wfZZXgxQ02oUEvyGsZa8uZ9ERLY3JWsXzmPA5Oe kTcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=S3O9Monj; 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 d5si18082305pla.376.2019.05.21.06.35.38; Tue, 21 May 2019 06:35:54 -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=S3O9Monj; 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 S1728402AbfEUNeL (ORCPT + 99 others); Tue, 21 May 2019 09:34:11 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:6907 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728385AbfEUNeK (ORCPT ); Tue, 21 May 2019 09:34:10 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 457cDZ6D68z9v1ns; Tue, 21 May 2019 15:34: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=S3O9Monj; 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 hN9Xq_QN1r0e; Tue, 21 May 2019 15:34: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 457cDZ5444z9v1nh; Tue, 21 May 2019 15:34:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1558445646; bh=TcuJ+OElTRYibwxTdLgf+9A9AnKmYb54DTdEQjLJFJo=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=S3O9MonjIpiQ12xaI+dxvArbcylwLpVqYoRlppDeMSIe0h/yXjnEKOe9htL+5Bj0/ 5vc2p5BcwsAkRyspGAo2kWmLHhVEDGrjIG4J2Zahm3EUMFs9zRx4AU+6ePQ8m9sRSt eCvBuTUuxHmI5awSEJPt5KPFk5/xnPo99mD11cdg= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2719E8B80D; Tue, 21 May 2019 15:34:08 +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 f4BLSVzRffHC; Tue, 21 May 2019 15:34:08 +0200 (CEST) Received: from po16846vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id EE6638B80C; Tue, 21 May 2019 15:34:07 +0200 (CEST) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id BD6E868458; Tue, 21 May 2019 13:34:07 +0000 (UTC) Message-Id: <6edc4ab00aab67632659d12451e4437399550159.1558445259.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 01/15] crypto: talitos - fix skcipher failure due to wrong output IV To: Herbert Xu , "David S. Miller" , horia.geanta@nxp.com Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 21 May 2019 13:34:07 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Selftests report the following: [ 2.984845] alg: skcipher: cbc-aes-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 2.995377] 00000000: 3d af ba 42 9d 9e b4 30 b4 22 da 80 2c 9f ac 41 [ 3.032673] alg: skcipher: cbc-des-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 3.043185] 00000000: fe dc ba 98 76 54 32 10 [ 3.063238] alg: skcipher: cbc-3des-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 3.073818] 00000000: 7d 33 88 93 0f 93 b2 42 This above dumps show that the actual output IV is indeed the input IV. This is due to the IV not being copied back into the request. This patch fixes that. Signed-off-by: Christophe Leroy Fixes: 4de9d0b547b9 ("crypto: talitos - Add ablkcipher algorithms") Cc: stable@vger.kernel.org Reviewed-by: Horia Geanta --- drivers/crypto/talitos.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 1d429fc073d1..f443cbe7da80 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -1637,11 +1637,15 @@ static void ablkcipher_done(struct device *dev, int err) { struct ablkcipher_request *areq = context; + struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); + struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher); + unsigned int ivsize = crypto_ablkcipher_ivsize(cipher); struct talitos_edesc *edesc; edesc = container_of(desc, struct talitos_edesc, desc); common_nonsnoop_unmap(dev, edesc, areq); + memcpy(areq->info, ctx->iv, ivsize); kfree(edesc); -- 2.13.3