From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8D693890E5 for ; Sun, 10 May 2026 13:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778418912; cv=none; b=CUExvQ7bhtfzys+WXg/aCjOygVrtYzYB7RIy9aZ5PjeLLxnSXTuZznXHIoHAZ9fkS8I6v4uTahPE7szuM8I936m6T3TnKP9ZPPX/hI5P0gBeqAtG58/cAd4aesad4VpuVCrDCfTGq942/k9FFH2hQklTo/O92fSy4f2bNjaTXLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778418912; c=relaxed/simple; bh=LduMNgJIPDhfv/nuxY/rpgUaUlE+mzZZ8n1sIgEhT+4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QJ4PPg+THLZkNpyYm9pM7HDnyTrQpGtxl21STtYhjlsfGYw6By6IuTNUdzPG3iHmAKp2cFu0OeEJAKPu2FehrL/ChOfTMZ5hukxjj9Nyx88MhQQDvhQVi9Lc7fyboCQFsJNDmKHeOqheC4xLGkd+Bj+VWnfdCc5O2XcNKB9sEow= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=owF+VjTO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="owF+VjTO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE6C7C2BCF6; Sun, 10 May 2026 13:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778418912; bh=LduMNgJIPDhfv/nuxY/rpgUaUlE+mzZZ8n1sIgEhT+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=owF+VjTO0aX0IyfhpL/VHO6FBYqOHEGZwMB6YMWhSr3JpuGT7M/UvxArUi3QNP1bR YTOnejwhWKsvrLUOkV2+6NQSPMv2fNq/0EgpbIRJIf56XrWFipJ6xsJzIpvyKaFQYn vNnnHwWXorr2L420TxtVXPXDGUwP8KKMzh18sjRGSGSOINeQi9V7MYig70VZYeExRw s4onYYOosKqvru4xhU6piH/Xo+D0QQOrxWaOJT/sDV52fBWKJ4vVI0X4QfsOFK7EVN euplcnWIxRFCxFHTKYtEIYtRnC3oL9YuSU6huQbaUh4kdnPGNmN/9yRTQ4n88/4joa Mb1Rr7bf90wqg== From: Sasha Levin To: stable@vger.kernel.org Cc: Thorsten Blum , Herbert Xu , Sasha Levin Subject: [PATCH 6.6.y 2/2] crypto: caam - guard HMAC key hex dumps in hash_digest_key Date: Sun, 10 May 2026 09:15:08 -0400 Message-ID: <20260510131508.4113857-2-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260510131508.4113857-1-sashal@kernel.org> References: <2026050437-viability-scholar-82fb@gregkh> <20260510131508.4113857-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Thorsten Blum [ Upstream commit 177730a273b18e195263ed953853273e901b5064 ] Use print_hex_dump_devel() for dumping sensitive HMAC key bytes in hash_digest_key() to avoid leaking secrets at runtime when CONFIG_DYNAMIC_DEBUG is enabled. Fixes: 045e36780f11 ("crypto: caam - ahash hmac support") Fixes: 3f16f6c9d632 ("crypto: caam/qi2 - add support for ahash algorithms") Cc: stable@vger.kernel.org Signed-off-by: Thorsten Blum Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/caam/caamalg_qi2.c | 4 ++-- drivers/crypto/caam/caamhash.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c index 06e0681fdbe15..ac97a15ac78b6 100644 --- a/drivers/crypto/caam/caamalg_qi2.c +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -3268,7 +3268,7 @@ static int hash_digest_key(struct caam_hash_ctx *ctx, u32 *keylen, u8 *key, dpaa2_fl_set_addr(out_fle, key_dma); dpaa2_fl_set_len(out_fle, digestsize); - print_hex_dump_debug("key_in@" __stringify(__LINE__)": ", + print_hex_dump_devel("key_in@" __stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, key, *keylen, 1); print_hex_dump_debug("shdesc@" __stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), @@ -3288,7 +3288,7 @@ static int hash_digest_key(struct caam_hash_ctx *ctx, u32 *keylen, u8 *key, /* in progress */ wait_for_completion(&result.completion); ret = result.err; - print_hex_dump_debug("digested key@" __stringify(__LINE__)": ", + print_hex_dump_devel("digested key@" __stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, key, digestsize, 1); } diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index 30cc46c4c33af..c1a06f033b118 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -393,7 +393,7 @@ static int hash_digest_key(struct caam_hash_ctx *ctx, u32 *keylen, u8 *key, append_seq_store(desc, digestsize, LDST_CLASS_2_CCB | LDST_SRCDST_BYTE_CONTEXT); - print_hex_dump_debug("key_in@"__stringify(__LINE__)": ", + print_hex_dump_devel("key_in@"__stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, key, *keylen, 1); print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), @@ -408,7 +408,7 @@ static int hash_digest_key(struct caam_hash_ctx *ctx, u32 *keylen, u8 *key, wait_for_completion(&result.completion); ret = result.err; - print_hex_dump_debug("digested key@"__stringify(__LINE__)": ", + print_hex_dump_devel("digested key@"__stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, key, digestsize, 1); } -- 2.53.0