From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 486EDC5ACB3 for ; Wed, 15 Nov 2023 22:03:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343830AbjKOWDS (ORCPT ); Wed, 15 Nov 2023 17:03:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344127AbjKOWDN (ORCPT ); Wed, 15 Nov 2023 17:03:13 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE1BA1BE for ; Wed, 15 Nov 2023 14:03:10 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56EF6C433C8; Wed, 15 Nov 2023 22:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700085790; bh=kWfWbejI1DFjy9ENuuUrjN6Qckq9isQXDhfvMV3Le5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zw5jDOR5gqaBG+eRK+rjVel8kK1UZQnC5LBi38FAlu/s8mRKEtfmqzouL31vXTkq2 Az/bK6XC9Wtf2LBi2A8u1BHe29wYOzk212oLN1q7/5d9Y0aCWfn+EAfwWInnU0AJDO Ymo5aYfjur/Oq/R9evh7Lt82k3cq6gQii3Y5k+oM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Gaurav Jain , Herbert Xu , Sasha Levin Subject: [PATCH 5.4 055/119] crypto: caam/qi2 - fix Chacha20 + Poly1305 self test failure Date: Wed, 15 Nov 2023 17:00:45 -0500 Message-ID: <20231115220134.330733288@linuxfoundation.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231115220132.607437515@linuxfoundation.org> References: <20231115220132.607437515@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gaurav Jain [ Upstream commit 7b8c6aee0d5b864e70c0da82583f9862e374eaf3 ] key buffer is not copied in chachapoly_setkey function, results in wrong output for encryption/decryption operation. fix this by memcpy the key in caam_ctx key arrary Fixes: c10a53367901 ("crypto: caam/qi2 - add support for Chacha20 + Poly1305") Signed-off-by: Gaurav Jain Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/caam/caamalg_qi2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c index 28692d068176f..b8d277bfbd329 100644 --- a/drivers/crypto/caam/caamalg_qi2.c +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -639,7 +639,8 @@ static int chachapoly_setkey(struct crypto_aead *aead, const u8 *key, return -EINVAL; } - ctx->cdata.key_virt = key; + memcpy(ctx->key, key, keylen); + ctx->cdata.key_virt = ctx->key; ctx->cdata.keylen = keylen - saltlen; return chachapoly_set_sh_desc(aead); -- 2.42.0