Re: [PATCH v2] crypto: caam - guard HMAC key hex dumps in hash_digest_key

From: Herbert Xu

Date: Thu Mar 19 2026 - 00:21:00 EST


On Wed, Mar 18, 2026 at 08:46:50PM +0100, Thorsten Blum wrote:
>
> diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c
> index 167372936ca7..3392070942ab 100644
> --- a/drivers/crypto/caam/caamalg_qi2.c
> +++ b/drivers/crypto/caam/caamalg_qi2.c
> @@ -3269,8 +3269,10 @@ 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__)": ",
> - DUMP_PREFIX_ADDRESS, 16, 4, key, *keylen, 1);
> +#ifdef DEBUG
> + print_hex_dump(KERN_DEBUG, "key_in@" __stringify(__LINE__)": ",
> + DUMP_PREFIX_ADDRESS, 16, 4, key, *keylen, 1);
> +#endif

I'd prefer to keep the compiler coverage when DEBUG is off.

Please add a new helper, either print_hex_dump_devel or
print_hex_dump_sensitive that only gets enabled when DEBUG is
defined.

Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt