Skip to content

Commit 2adbfca

Browse files
tobluxgregkh
authored andcommitted
crypto: caam - guard HMAC key hex dumps in hash_digest_key
[ Upstream commit 177730a ] 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: 045e367 ("crypto: caam - ahash hmac support") Fixes: 3f16f6c ("crypto: caam/qi2 - add support for ahash algorithms") Cc: stable@vger.kernel.org Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f3a3e2d commit 2adbfca

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/crypto/caam/caamalg_qi2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3268,7 +3268,7 @@ static int hash_digest_key(struct caam_hash_ctx *ctx, u32 *keylen, u8 *key,
32683268
dpaa2_fl_set_addr(out_fle, key_dma);
32693269
dpaa2_fl_set_len(out_fle, digestsize);
32703270

3271-
print_hex_dump_debug("key_in@" __stringify(__LINE__)": ",
3271+
print_hex_dump_devel("key_in@" __stringify(__LINE__)": ",
32723272
DUMP_PREFIX_ADDRESS, 16, 4, key, *keylen, 1);
32733273
print_hex_dump_debug("shdesc@" __stringify(__LINE__)": ",
32743274
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,
32883288
/* in progress */
32893289
wait_for_completion(&result.completion);
32903290
ret = result.err;
3291-
print_hex_dump_debug("digested key@" __stringify(__LINE__)": ",
3291+
print_hex_dump_devel("digested key@" __stringify(__LINE__)": ",
32923292
DUMP_PREFIX_ADDRESS, 16, 4, key,
32933293
digestsize, 1);
32943294
}

drivers/crypto/caam/caamhash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ static int hash_digest_key(struct caam_hash_ctx *ctx, u32 *keylen, u8 *key,
393393
append_seq_store(desc, digestsize, LDST_CLASS_2_CCB |
394394
LDST_SRCDST_BYTE_CONTEXT);
395395

396-
print_hex_dump_debug("key_in@"__stringify(__LINE__)": ",
396+
print_hex_dump_devel("key_in@"__stringify(__LINE__)": ",
397397
DUMP_PREFIX_ADDRESS, 16, 4, key, *keylen, 1);
398398
print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ",
399399
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,
408408
wait_for_completion(&result.completion);
409409
ret = result.err;
410410

411-
print_hex_dump_debug("digested key@"__stringify(__LINE__)": ",
411+
print_hex_dump_devel("digested key@"__stringify(__LINE__)": ",
412412
DUMP_PREFIX_ADDRESS, 16, 4, key,
413413
digestsize, 1);
414414
}

0 commit comments

Comments
 (0)