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 D3D0617A303 for ; Sun, 10 May 2026 02:34:45 +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=1778380485; cv=none; b=dFiy6b9n7L+3fT/TOnErCG/8o9nTfL9atuGa/qTIUjq3ro36kOwtd+ZNId682kjkSccyiOidfs6tSc01SD/ee4wWYl7E1XbW1GfZdvEWDJp2sY38qt4aVijpFlEAYBE045gU+u5GymB0it9SGnq5I2tn8TNfSCAqK9gzMH8pSCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778380485; c=relaxed/simple; bh=8kC5sc8NCOLIPDia20N97I89lU6Ywi3QQQY5O88bdNE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lJgj6KOdkUWi99BffPVN37gIQ8PbraiyntWlPSXVJ3/0w2lBA2Vec9NwBwJ2Fqg3fDOkf/4jwsDzlYv+o+jsh3upDBK7QmMWN7lcoA+bAbFZC6FITVaaiSYYOeo9J2aVZAgza9R/BIS5+bIqMzjWBzYwURbRaMpQPFjCYuS6BgY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sAyb8sDN; 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="sAyb8sDN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40909C2BCF4; Sun, 10 May 2026 02:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778380485; bh=8kC5sc8NCOLIPDia20N97I89lU6Ywi3QQQY5O88bdNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sAyb8sDN67AKaW7U+yXR6Le6Y7JQH6MOaIQj2K2LXDaT8Re2LG+Mp73ukPtJnlq9z hPXlncyFGT/KjJ10/2O8xjzZ+9PSpDQijquNPwTRBECiy3Neb83ost7Q6fs3nYaGxI cjMn9G52mrMncut/agT0Aex+cEu2Ed9pz7VUuIWMHOuBjFGGo+I/rjF7Zv0B4od2w6 1l7F+PJy+2kvgGg0pSIWOhLFk/1p4stXYqn73n/6J5yTmrcYi/SpRH7+dNgssyX0Wb 5nZktz3hK7XMFqG4QmNy8A7VXeYXpAnHO4WOntKVLuGXNnmPU1/p0sYykldhaM1sEo HJX7ivEEjzhUg== From: Sasha Levin To: stable@vger.kernel.org Cc: Thorsten Blum , Herbert Xu , Sasha Levin Subject: [PATCH 6.12.y 2/2] crypto: caam - guard HMAC key hex dumps in hash_digest_key Date: Sat, 9 May 2026 22:34:42 -0400 Message-ID: <20260510023442.3940261-2-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260510023442.3940261-1-sashal@kernel.org> References: <2026050436-flier-macaroni-9c3a@gregkh> <20260510023442.3940261-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 9ef8ee77c52aa..31bc3d747ec0c 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 053af748be86d..cc942e5ab2799 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