Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10083820ybi; Wed, 24 Jul 2019 15:39:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbo4A0AiMr0NBuAoYpTPm5dkDeJELKiu+aKYN+iZpT4Qc8Pj74XkeXIhC6/NN871TYgzyJ X-Received: by 2002:aa7:9819:: with SMTP id e25mr13091086pfl.47.1564007952994; Wed, 24 Jul 2019 15:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564007952; cv=none; d=google.com; s=arc-20160816; b=RfNj/UzZBRbqVg/AN+cXJ9t9ScrQXkKdCNOZiFTveZvM07keQ7qKcLgEJn/8YxK43I sbbpxK4T92j/wofGmuxzI7/DS0EsFMRoGBy08MfbW39wc/r3fIvtLAa4k5PtXamBE+cu 5Q2FrQX8/6z07KY55oJSeLdGWFcoZae1FMuiVuCl9/mMPM71l2Ef/SpC3g5xXZGk8H/6 OHWK8yEECV9JR7//jYdG//fXnSd/cHwgeP/PtVcCfCJKjQAReWTwr4rSUQ8vPCM6QaIs fxGFG04ZnEyQaNwwJ9b9GYuixfcjIYfzeTR5rKYqwourcDx6AemF3U385frPXYVif+mY alPg== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JWngnn8fYqpyzHkB7dvH6+SUfG/6jbGW63uFwYr/GLc=; b=rngIT/GR94SFq57StN9dVNFtoGYSKsjIZHsYxJnqon52PMzP2lwouou6O/W1RS7lnK zfgBBSZQklsK9b2zTY1WP2/jlNkg5bfD4pfzF4AFYCW2hC8OIQxEczNo9qpzQyY4vaoR av1kdcLhj960QTxekKTVNgmXSP7woiIItZXM+EizaX3YR9O6miZdR3QH2JWz2Kb6gDhv mO7yI7AqQ9Vs5Bj1obNzmnlrjwdMQmfaMG5Hw4KQctLcQLrm6vbmldvXFFxZ7xnPmJ5r dg/iUaqK1SCZTb+pgLG+tJmYOXxNXkPIINO1YoewYI2mNiIc1xigP1lGrxipywGcmSNt ACdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vCkpt5p+; 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 m12si15487718pjq.60.2019.07.24.15.38.58; Wed, 24 Jul 2019 15:39:12 -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=@kernel.org header.s=default header.b=vCkpt5p+; 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 S2387833AbfGXTXi (ORCPT + 99 others); Wed, 24 Jul 2019 15:23:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:39392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727593AbfGXTXh (ORCPT ); Wed, 24 Jul 2019 15:23:37 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CDCC822387; Wed, 24 Jul 2019 19:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996216; bh=bu466d31ZG83S78E9LnHXITEMycjX7VQlNIXd5cHdPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vCkpt5p+RANTzTqkuKD+EMF/GQ04XS1eO1elG6WkH9Yqbx72mkZYer8pJrTkGJCXa 6BNZYcOwy67iloNxqbukY7BPMJixAFL31fHOPg3ik0rI848UlrPiAW7YyyFMdG5z6p BqR/7MDn+IM6kpvhXSLK2mnoAMLaY2gP5FKB/Fpw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , =?UTF-8?q?Horia=20Geant=C4=83?= , Herbert Xu , Sasha Levin Subject: [PATCH 5.2 020/413] crypto: talitos - fix skcipher failure due to wrong output IV Date: Wed, 24 Jul 2019 21:15:11 +0200 Message-Id: <20190724191736.891673121@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 3e03e792865ae48b8cfc69a0b4d65f02f467389f ] 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 Reviewed-by: Horia Geantă Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/talitos.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 8c57c5af0930..396199b2db7d 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -1606,11 +1606,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.20.1