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 53D17345757 for ; Sun, 10 May 2026 15:10:14 +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=1778425814; cv=none; b=BumafJbZ3IMvxqwC3qJnpxRQ5f9abS40Qiv9i3OE7Z6x/RUe7v8PFGIxpetOrcfpFG5JfMIUPireTrkr4vLE1qf1CdDaqMoa6XIAjHzQlA7rHXadICfheyfdGiQaxhCu0JFzRoY/Iuiip24FYRCvppq3sEPNfkUqr0CzKi9ab8w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778425814; c=relaxed/simple; bh=vlKGjT60J1N9u9n2vpa+NCMkQ/iQzrvI7caP12E2DfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p9VYQRWiISbdsmvuqbN+Oj9XpRiXR+hpxUKe4wjD6PpB/nGdbspUEYCVttFQvB5Q0dLny/3KIfOpPIpCKvNyPh/Xp9gKiR8oBl3d0OMxN0gB7KZcJmLytxFIt81oLTOx4Wuhd5ND6lnT/TMREgwQB2QCZqI2U8njTYwOPRbECl0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mS5ENrWp; 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="mS5ENrWp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A6D9C2BCC7; Sun, 10 May 2026 15:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778425814; bh=vlKGjT60J1N9u9n2vpa+NCMkQ/iQzrvI7caP12E2DfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mS5ENrWpJADSus1GmxHXuTJoTQxFHQlLWNT+pk2HgFCKXi9JaDfKEhbmzGYLhwpKz NBFhZ1qRcAnNtOANoxybWlmAzE091DzEBJb6CpEt1HISfd/JFr89yclwiRt0QoB7HO lbpYlEptqIoasc8D6JM/tR0Ax44anmvSM1pASC+9zW8lTW+K52rE/yNIb2IuSnP8HO aNf6ahQ7t/6yioJJB8PwA306lBcBke/aa/+/nwTkbJ5LDY/KM34gwXxTlmNXCcB9jV N9EupQhKsmN54+FTTafgpKqlzeKFfzHie3gI11SZvN8bSpE+a6fo6CEVsLdBqZEUwp XV+AAg/h3XuLQ== From: Sasha Levin To: stable@vger.kernel.org Cc: Thorsten Blum , Herbert Xu , Sasha Levin Subject: [PATCH 5.15.y 2/2] crypto: caam - guard HMAC key hex dumps in hash_digest_key Date: Sun, 10 May 2026 11:10:10 -0400 Message-ID: <20260510151010.38344-2-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260510151010.38344-1-sashal@kernel.org> References: <2026050438-landline-earthworm-2d1c@gregkh> <20260510151010.38344-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 35c4e29033d55..724de2da7f288 100644 --- a/drivers/crypto/caam/caamalg_qi2.c +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -3264,7 +3264,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), @@ -3284,7 +3284,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 36ef738e4a181..25eabcadc4abb 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -390,7 +390,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), @@ -405,7 +405,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