Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3783013ybi; Mon, 29 Jul 2019 12:32:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFrJZb7iCc9xjnUARJvm524JDPenouw16rSAM+jy+12S18JWrQK1K9BOkey5knFMnHgePv X-Received: by 2002:aa7:83ce:: with SMTP id j14mr3191073pfn.55.1564428736791; Mon, 29 Jul 2019 12:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428736; cv=none; d=google.com; s=arc-20160816; b=u9dhiB1Z6AxU7Ycc1UrUVxF1Bu2zwYysaA8sARXtx6z598i3uIiykEITeBi35bke3C ceKMrPjNxrStMlfDf8OmdMDJsdymCWHG9knkTGz9j6IfIs+GZA7DQ7/M8BjJQAEp43Wg 4D2YqrDXf2x+rsLfuX9teMU3FIvzY56wrHUyRAfsO+6ieUu6Q8i/y/dO8crxDIE5hImU DFR/Y5EHSYgErpenOw4/pObUO0X+ewPgObscw+zY5N+C0GhOP8EBbx7a/XyEDwdIVmME 4Z8yWzZ7mqW4Yl73/X4KKPEM+pZF2Eih87fbX/DHcVeYJh2HUFAIb8eWkkkKoJzYP1ud /J5A== 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=ga4UYTYKyUNkoQxUJ+rYffAWyU5skIY0z+0vmz++TTk=; b=o4+HAeLiDsyv01h97dMaC4x/uZXowEHfDV9fv2mdqmxPGJb8EsyMd8S5TgskVwDpVy xm7Tb2bSPaJ6CO5T2ypsAKLepYzPFmWRDUlerC2HEJKKPrTteETyDUHNxeh0HLBggEez vH1/7jfslU9+IGmI/2DAoduEmvzhdvGereeFj43eJ/OrB++EsmLTFnEGp06BpVawsCLd Nde7tQA1R8BeyL8PezqKj2WWMDCiMjIRzolqv0IIxAW8w2skRlgKZ1lyQoElKbW2oc0f FAsL1+iHQRVXR05AJbdMhOVm22HNMFNUeLB9qVM0ETtCD1cAmxVfNVYdt0WHCRYBo6z6 ixHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="QV/oaiyi"; 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 g12si29402742pgj.124.2019.07.29.12.32.01; Mon, 29 Jul 2019 12:32:16 -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="QV/oaiyi"; 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 S1729428AbfG2TYD (ORCPT + 99 others); Mon, 29 Jul 2019 15:24:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:36234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727699AbfG2TYA (ORCPT ); Mon, 29 Jul 2019 15:24:00 -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 CCDE72171F; Mon, 29 Jul 2019 19:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428240; bh=4tBxuerOXi5CA9FZQS6VHnb6XW/YgxbWnEGxlgLeViE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QV/oaiyi6BLahAur4+nbj4uKsD4U8PYV/WQepA445YkBCpfwIC5JgKeVKlmI7iWRf MQcFmXOeibMjyMYi+vQzlk8qKq1TuYlTC0lgQXcyUbGgAWy8Usx7bLjv3quYZFJQiJ cgslZn2rrISqmRftP6XqBhBrZuQarJztQN9NiTGk= 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 4.14 014/293] crypto: talitos - fix skcipher failure due to wrong output IV Date: Mon, 29 Jul 2019 21:18:25 +0200 Message-Id: <20190729190821.511930181@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 1f8fe1795964..8707607039d3 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -1544,11 +1544,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