From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387490; b=4p7RqbND/FwUmXM8295CIettUAj3eA9vUIunYYi+FnQ9lo6S8qQkSkkKLRdMAi9tMUih wa1V5oVWnxngpluQROHYneBK1ec2ikChY0k5Le+IJ6gOv33PLKX1YpdprStLTBJu+kq23 5DDTjj/v2tYbSLlsk9PdsEnKLWDFoPUyoPM+351I29Ep38aE9sdjlLHG6TIk3Q7AY26Sc /7TaEPa+aw2a3Xalio1XaivbgvKVBUvqV5deI+ZaEiPcCp2Mf+62faxh8IcXHPLHJYy6x PYNrsGiDQ33Qa+Rg0UCpvG68NmGLFjgV+zPUUc8j4y6J2ay0zZSlE7XBJ01KNA3i4bw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387490; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=BB7aLDMGkkBmt0gWxADbCywve5kMnNIyGbeQH1i8mNI=; b=pyI1voWkeb9F9U71Sd5+Vxnu4ZSUOD9hVfvJnyUsTYT7tBn3lnR7hkFYWdAXvJVypHqy 4ZqDuz5TjdpOCVSZxjcmCFivWcqaF8QfwDIsJfqGHUiTFwZ3ba3RQ44KHeGY79Fi9umma QxedusqpweNmMmajgDtNuDhzj0Y36CCyL9FlOyMOrZmjQF+71YH5PvaBzfJ9cUEt+98y6 9/1Ses8EQhNJS91Qp8UIeoIhJxDVjBAiwU0LtVkPexnqayHhPICUbeGl/lMVq98nqYbQn EJRtxONpnVOlh4b65AKLWxDFXYQkIBTyPwfxTXQb6/BLywWg2WhdxiUGYGib+38/Qew== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=CYaMzefI; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C5E2606A334; Fri, 4 Dec 2026 12:31:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=CYaMzefI Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E02E1F000C2; Fri, 4 Dec 2026 12:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387490; bh=BB7aLDMGkkBmt0gWxADbCywve5kMnNIyGbeQH1i8mNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CYaMzefI4ui9Fb2hFLFn5/bjKXp43emEkfwGKEh+rVdFqB99BIkug9q+TbEEHNZmH 9vmbMkQvGhtRKUNqWKVcDLpl9HFwA3iQtge/kWj+fHv+Fumbvr9Ji9rCfcEJ8/ng1m 0WDyCDZWofpIXtYLZ98NceK78zxbGEql2qxi40Ik= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , Antoine Tenart , Thomas Huth , Herbert Xu , Sasha Levin Subject: [PATCH 6.1 0265/1059] crypto: inside-secure - Zeroize temporary arrays on stack with sensitive data Date: Fri, 4 Dec 2026 18:56:36 +0900 Message-ID: <20261204100651.139988458@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Huth [ Upstream commit 5c87bcb2f98dbfe08efa016af037b0f9701ba381 ] key_tmp[] in safexcel_xcbcmac_setkey() and consts[] / _const[] in safexcel_cmac_setkey() contain crypto key material that should not get exposed to the outside once the function is done. Scrub the arrays with memzero_explicit() to avoid that the data could leak via the stack. Reported-by: Sashiko Link: https://sashiko.dev/#/patchset/20260813134953.979481-1-thuth%40redhat.com Fixes: 38f21b4bab11f ("crypto: inside-secure - Added support for the AES XCBC ahash") Fixes: 7a627db9cafdb ("crypto: inside-secure - Added support for the AES-CMAC ahash") Acked-by: Antoine Tenart Signed-off-by: Thomas Huth Signed-off-by: Herbert Xu [ sashal: Replaced aes_prepareenckey() with aes_expandkey() in the first hunk's context, since the older tree lacks the former. ] Signed-off-by: Sasha Levin --- drivers/crypto/inside-secure/safexcel_hash.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c index 08227d44a27ba..25bd91eb29b25 100644 --- a/drivers/crypto/inside-secure/safexcel_hash.c +++ b/drivers/crypto/inside-secure/safexcel_hash.c @@ -2107,6 +2107,7 @@ static int safexcel_xcbcmac_setkey(struct crypto_ahash *tfm, const u8 *key, ret = aes_expandkey(ctx->aes, (u8 *)key_tmp + 2 * AES_BLOCK_SIZE, AES_MIN_KEY_SIZE); + memzero_explicit(key_tmp, sizeof(key_tmp)); if (ret) return ret; @@ -2218,6 +2219,8 @@ static int safexcel_cmac_setkey(struct crypto_ahash *tfm, const u8 *key, } ctx->cbcmac = false; + memzero_explicit(consts, sizeof(consts)); + memzero_explicit(_const, sizeof(_const)); return 0; } -- 2.53.0